diff --git a/Cargo.lock b/Cargo.lock index 8a885ded..08be9e67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1594,7 +1594,8 @@ dependencies = [ "semver", "serde", "serde_json", - "sha2 0.10.6", + "serde_path_to_error", + "sha2 0.10.2", "solang-parser", "svm-rs", "svm-rs-builds", @@ -3726,6 +3727,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "184c643044780f7ceb59104cef98a5a6f12cb2288a7bc701ab93a362b49fd47d" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" diff --git a/ethers-solc/Cargo.toml b/ethers-solc/Cargo.toml index 9caca7d4..5b60c3c5 100644 --- a/ethers-solc/Cargo.toml +++ b/ethers-solc/Cargo.toml @@ -62,6 +62,7 @@ rand = "0.8.5" pretty_assertions = "1.3.0" tempfile = "3.3.0" tokio = { version = "1.18", features = ["full"] } +serde_path_to_error = "0.1.8" [[bench]] name = "compile_many" diff --git a/ethers-solc/src/artifacts/ast/macros.rs b/ethers-solc/src/artifacts/ast/macros.rs index ebad35c7..5302e268 100644 --- a/ethers-solc/src/artifacts/ast/macros.rs +++ b/ethers-solc/src/artifacts/ast/macros.rs @@ -11,6 +11,7 @@ macro_rules! ast_node { ) => { $(#[$struct_meta])* #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] + #[serde(rename_all = "camelCase")] pub struct $name { pub id: usize, #[serde(with = "serde_helpers::display_from_str")] @@ -37,10 +38,15 @@ macro_rules! expr_node { ast_node!( $(#[$struct_meta])* struct $name { + #[serde(default, deserialize_with = "serde_helpers::default_for_null")] argument_types: Vec, + #[serde(default)] is_constant: bool, + #[serde(default)] is_l_value: bool, + #[serde(default)] is_pure: bool, + #[serde(default)] l_value_requested: bool, type_descriptions: TypeDescriptions, $( @@ -52,5 +58,47 @@ macro_rules! expr_node { } } +/// A macro that expands to a struct with common statement node fields. +macro_rules! stmt_node { + ( + $(#[$struct_meta:meta])* + struct $name:ident { + $( + $(#[$field_meta:meta])* + $field:ident: $ty:ty + ),* $(,)* + } + ) => { + ast_node!( + $(#[$struct_meta])* + struct $name { + // TODO + documentation: Option, + $( + $(#[$field_meta])* + $field: $ty + ),* + } + ); + } +} + +/// A macro that expands to an enum where each variant also contains a struct of the same name. +/// +/// The inner value of each variant is boxed since AST types are inherently recursive. +macro_rules! node_group { + ($group:ident; $( $name:ident ),* $(,)*) => { + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] + #[serde(tag = "nodeType")] + pub enum $group { + $( + $name(Box<$name>), + )* + } + }; +} + pub(crate) use ast_node; pub(crate) use expr_node; +pub(crate) use node_group; +pub(crate) use stmt_node; diff --git a/ethers-solc/src/artifacts/ast/misc.rs b/ethers-solc/src/artifacts/ast/misc.rs index 09976d46..ced7f7a2 100644 --- a/ethers-solc/src/artifacts/ast/misc.rs +++ b/ethers-solc/src/artifacts/ast/misc.rs @@ -3,10 +3,10 @@ use std::{fmt, fmt::Write, str::FromStr}; /// Represents the source location of a node: `::`. /// -/// The `length` and `index` can be -1 which is represented as `None` +/// The `start`, `length` and `index` can be -1 which is represented as `None` #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SourceLocation { - pub start: usize, + pub start: Option, pub length: Option, pub index: Option, } @@ -21,7 +21,7 @@ impl FromStr for SourceLocation { let start = split .next() .ok_or_else(invalid_location)? - .parse::() + .parse::() .map_err(|_| invalid_location())?; let length = split .next() @@ -34,6 +34,7 @@ impl FromStr for SourceLocation { .parse::() .map_err(|_| invalid_location())?; + let start = if start < 0 { None } else { Some(start as usize) }; let length = if length < 0 { None } else { Some(length as usize) }; let index = if index < 0 { None } else { Some(index as usize) }; @@ -43,7 +44,11 @@ impl FromStr for SourceLocation { impl fmt::Display for SourceLocation { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.start.fmt(f)?; + if let Some(start) = self.start { + start.fmt(f)?; + } else { + f.write_str("-1")?; + } f.write_char(':')?; if let Some(length) = self.length { length.fmt(f)?; @@ -60,25 +65,9 @@ impl fmt::Display for SourceLocation { } } +/// Function mutability specifier. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum Expression { - Assignment, - BinaryOperation, - Conditional, - ElementaryTypeNameExpression, - FunctionCall, - FunctionCallOptions, - Identifier, - IndexAccess, - IndexRangeAccess, - Literal, - MemberAccess, - NewExpression, - TupleExpression, - UnaryOperation, -} - -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] pub enum StateMutability { Payable, Pure, @@ -86,23 +75,18 @@ pub enum StateMutability { View, } +/// Variable mutability specifier. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum TypeName { - ArrayTypeName, - ElementaryTypeName, - FunctionTypeName, - Mapping, - UserDefinedTypeName, -} - -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] pub enum Mutability { Mutable, Immutable, Constant, } +/// Storage location specifier. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] pub enum StorageLocation { Calldata, Default, @@ -110,7 +94,9 @@ pub enum StorageLocation { Storage, } +/// Visibility specifier. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] pub enum Visibility { External, Public, @@ -118,50 +104,10 @@ pub enum Visibility { Private, } +/// A type description. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum Statement { - Block, - Break, - Continue, - DoWhileStatement, - EmitStatement, - ExpressionStatement, - ForStatement, - IfStatement, - InlineAssembly, - PlaceholderStatement, - Return, - RevertStatement, - TryStatement, - UncheckedBlock, - VariableDeclarationStatement, - WhileStatement, -} - -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum YulStatement { - YulAssignment, - YulBlock, - YulBreak, - YulContinue, - YulExpressionStatement, - YulLeave, - YulForLoop, - YulFunctionDefinition, - YulIf, - YulSwitch, - YulVariableDeclaration, -} - -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum YulExpression { - YulFunctionCall, - YulIdentifier, - YulLiteral, -} - -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum YulLiteral { - YulLiteralValue, - YulLiteralHexValue, +#[serde(rename_all = "camelCase")] +pub struct TypeDescriptions { + pub type_identifier: Option, + pub type_string: Option, } diff --git a/ethers-solc/src/artifacts/ast/mod.rs b/ethers-solc/src/artifacts/ast/mod.rs index b257a95f..31f3a496 100644 --- a/ethers-solc/src/artifacts/ast/mod.rs +++ b/ethers-solc/src/artifacts/ast/mod.rs @@ -1,17 +1,32 @@ -//! Bindings for solc's `ast` output field +//! Bindings for the Solidity and Yul ASTs. +//! +//! The Yul AST bindings are available in the [yul] module. +//! +//! To gain an overview of the AST, it might be helpful to start at the entry point of a complete +//! Solidity AST: the [SourceUnit] node. +//! +//! # Version Support +//! +//! These types should be compatible with at least Solidity 0.5.x and above, but may also support +//! 0.4.x-0.5.x in most cases. +//! +//! The legacy Solidity AST is not supported. mod macros; mod misc; - pub use misc::*; pub mod util; pub mod visitor; +/// Types for the Yul AST. +/// +/// The Yul AST is embedded into the Solidity AST for inline assembly blocks. +pub mod yul; + use crate::artifacts::serde_helpers; -use macros::{ast_node, expr_node}; +use macros::{ast_node, expr_node, node_group, stmt_node}; use serde::{Deserialize, Serialize}; use std::collections::BTreeMap; - -// TODO: Node ID +use yul::YulBlock; ast_node!( /// The root node of a Solidity AST. @@ -20,14 +35,16 @@ ast_node!( absolute_path: String, #[serde(default, rename = "exportedSymbols")] exported_symbols: BTreeMap>, + #[serde(default)] license: Option, #[serde(default, skip_serializing_if = "Vec::is_empty")] nodes: Vec, } ); -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum SourceUnitPart { +node_group! { + SourceUnitPart; + PragmaDirective, ImportDirective, UsingForDirective, @@ -40,33 +57,50 @@ pub enum SourceUnitPart { ContractDefinition, } -ast_node!( - struct ContractDefinition { - name: String, - name_location: Option, - is_abstract: bool, - base_contracts: Vec, - canonical_name: Option, - contract_dependencies: Vec, - kind: ContractKind, - documentation: Option, - fully_implemented: bool, - linearized_base_contracts: Vec, - nodes: Vec, - scope: usize, - used_errors: Vec, - } -); +node_group! { + Expression; -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum ContractKind { - Contract, - Interface, - Library, + Assignment, + BinaryOperation, + Conditional, + ElementaryTypeNameExpression, + FunctionCall, + FunctionCallOptions, + Identifier, + IndexAccess, + IndexRangeAccess, + Literal, + MemberAccess, + NewExpression, + TupleExpression, + UnaryOperation, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum ContractDefinitionPart { +node_group! { + Statement; + + Block, + Break, + Continue, + DoWhileStatement, + EmitStatement, + ExpressionStatement, + ForStatement, + IfStatement, + InlineAssembly, + PlaceholderStatement, + Return, + RevertStatement, + TryStatement, + UncheckedBlock, + VariableDeclarationStatement, + WhileStatement, + +} + +node_group! { + ContractDefinitionPart; + EnumDefinition, ErrorDefinition, EventDefinition, @@ -78,125 +112,250 @@ pub enum ContractDefinitionPart { VariableDeclaration, } +node_group! { + TypeName; + + ArrayTypeName, + ElementaryTypeName, + FunctionTypeName, + Mapping, + UserDefinedTypeName, +} + +// TODO: Better name +node_group! { + UserDefinedTypeNameOrIdentifierPath; + + UserDefinedTypeName, + IdentifierPath, +} + +// TODO: Better name +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum BlockOrStatement { + Statement(Statement), + Block(Block), +} + +// TODO: Better name +node_group! { + ExpressionOrVariableDeclarationStatement; + + ExpressionStatement, + VariableDeclarationStatement +} + +// TODO: Better name +node_group! { + IdentifierOrIdentifierPath; + + Identifier, + IdentifierPath +} + ast_node!( + /// A contract definition. + struct ContractDefinition { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + #[serde(default, rename = "abstract")] + is_abstract: bool, + base_contracts: Vec, + canonical_name: Option, + contract_dependencies: Vec, + #[serde(rename = "contractKind")] + kind: ContractKind, + documentation: Option, + fully_implemented: bool, + linearized_base_contracts: Vec, + nodes: Vec, + scope: usize, + #[serde(default)] + used_errors: Vec, + } +); + +/// All Solidity contract kinds. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum ContractKind { + /// A normal contract. + Contract, + /// An interface. + Interface, + /// A library. + Library, +} + +ast_node!( + /// An inheritance specifier. struct InheritanceSpecifier { + #[serde(default, deserialize_with = "serde_helpers::default_for_null")] arguments: Vec, base_name: UserDefinedTypeNameOrIdentifierPath, } ); -// TODO: Better name -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum UserDefinedTypeNameOrIdentifierPath { - UserDefinedTypeName, - IdentifierPath, -} - expr_node!( + /// An assignment expression. struct Assignment { + #[serde(rename = "leftHandSide")] lhs: Expression, operator: AssignmentOperator, + #[serde(rename = "rightHandSide")] rhs: Expression, } ); +/// Assignment operators. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum AssignmentOperator { - /// = + /// Simple assignment (`=`) + #[serde(rename = "=")] Assign, - /// += + /// Add and assign (`+=`) + #[serde(rename = "+=")] AddAssign, - /// -= + /// Subtract and assign (`-=`) + #[serde(rename = "-=")] SubAssign, - /// *= + /// Multiply and assign (`*=`) + #[serde(rename = "*=")] MulAssign, - /// /= + /// Divide and assign (`/=`) + #[serde(rename = "/=")] DivAssign, - /// %= + /// Modulo and assign (`%=`) + #[serde(rename = "%=")] ModAssign, - /// |= + /// Bitwise or and assign (`|=`) + #[serde(rename = "|=")] OrAssign, - /// &= + /// Bitwise and and assign (`&=`) + #[serde(rename = "&=")] AndAssign, - /// ^= + /// Bitwise xor and assign (`^=`) + #[serde(rename = "^=")] XorAssign, - /// >>= + /// Right shift and assign (`>>=`) + #[serde(rename = ">>=")] ShrAssign, - /// <<= + /// Left shift and assign (`<<=`) + #[serde(rename = "<<=")] ShlAssign, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct TypeDescriptions { - pub type_identifier: Option, - pub type_string: Option, -} - ast_node!( + /// A binary operation. struct BinaryOperation { common_type: TypeDescriptions, + #[serde(rename = "leftExpression")] lhs: Expression, operator: BinaryOperator, + #[serde(rename = "rightExpression")] rhs: Expression, } ); +/// Binary operators. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum BinaryOperator { - /// + + /// Addition (`+`) + #[serde(rename = "+")] Add, - /// - + /// Subtraction (`-`) + #[serde(rename = "-")] Sub, - /// * + /// Multiplication (`*`) + #[serde(rename = "*")] Mul, - /// / + /// Division (`/`) + #[serde(rename = "/")] Div, - /// % + /// Modulo (`%`) + #[serde(rename = "%")] Mod, - /// ** + /// Exponentiation (`**`) + #[serde(rename = "**")] Pow, - /// && + /// Logical and (`&&`) + #[serde(rename = "&&")] And, - /// || + /// Logical or (`||`) + #[serde(rename = "||")] Or, - /// != + /// Not equals (`!=`) + #[serde(rename = "!=")] NotEqual, - /// == + /// Equals (`==`) + #[serde(rename = "==")] Equal, - /// < + /// Less than (`<`) + #[serde(rename = "<")] LessThan, - /// <= + /// Less than or equal (`<=`) + #[serde(rename = "<=")] LessThanOrEqual, - /// > + /// Greater than (`>`) + #[serde(rename = ">")] GreaterThan, - /// >= + /// Greater than or equal (`>=`) + #[serde(rename = ">=")] GreaterThanOrEqual, - /// ^ + /// Bitwise xor (`^`) + #[serde(rename = "^")] Xor, - /// & + /// Bitwise not (`~`) + #[serde(rename = "~")] + BitNot, + /// Bitwise and (`&`) + #[serde(rename = "&")] BitAnd, - /// | + /// Bitwise or (`|`) + #[serde(rename = "|")] BitOr, - /// << + /// Shift left (`<<`) + #[serde(rename = "<<")] Shl, - /// >> + /// Shift right (`>>`) + #[serde(rename = ">>")] Shr, } expr_node!( + /// A conditional expression. struct Conditional { + /// The condition. condition: Expression, + /// The expression to evaluate if falsy. false_expression: Expression, + /// The expression to evaluate if truthy. true_expression: Expression, } ); expr_node!( struct ElementaryTypeNameExpression { - type_name: ElementaryTypeName, + type_name: ElementaryOrRawTypeName, } ); +// TODO: Better name +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ElementaryOrRawTypeName { + /// An [ElementaryTypeName] node that describes the type. + /// + /// This variant applies to newer compiler versions. + ElementaryTypeName(ElementaryTypeName), + /// A string representing the type name. + /// + /// This variant applies to older compiler versions. + Raw(String), +} + ast_node!( struct ElementaryTypeName { type_descriptions: TypeDescriptions, @@ -206,23 +365,31 @@ ast_node!( ); expr_node!( + /// A function call expression. struct FunctionCall { arguments: Vec, expression: Expression, kind: FunctionCallKind, names: Vec, + #[serde(default)] try_call: bool, } ); +/// Function call kinds. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum FunctionCallKind { + /// A regular function call. FunctionCall, + /// A type conversion (e.g. `bytes(x)`). TypeConversion, + /// A struct constructor call (e.g. `MyStruct({ ... })`). StructConstructorCall, } expr_node!( + /// A function call options expression (e.g. `x.f{gas: 1}`). struct FunctionCallOptions { expression: Expression, names: Vec, @@ -231,18 +398,700 @@ expr_node!( ); ast_node!( - struct StructuredDocumentation { - text: String, + /// An identifier. + struct Identifier { + #[serde(default, deserialize_with = "serde_helpers::default_for_null")] + argument_types: Vec, + name: String, + overloaded_declarations: Vec, + referenced_declaration: Option, + type_descriptions: TypeDescriptions, + } +); + +expr_node!( + /// An index access. + struct IndexAccess { + base_expression: Expression, + index_expression: Option, + } +); + +expr_node!( + /// An index range access. + struct IndexRangeAccess { + base_expression: Expression, + start_expression: Option, + end_expression: Option, + } +); + +expr_node!( + /// A literal value. + struct Literal { + // TODO + hex_value: String, + kind: LiteralKind, + subdenomination: Option, // TODO + value: Option, // TODO + } +); + +/// Literal kinds. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum LiteralKind { + /// A boolean. + Bool, + /// A number. + Number, + /// A string. + String, + /// A hexadecimal string. + HexString, + /// A unicode string. + UnicodeString, +} + +expr_node!( + /// Member access. + struct MemberAccess { + expression: Expression, + member_name: String, + referenced_declaration: Option, + } +); + +expr_node!( + /// A `new` expression. + struct NewExpression { + type_name: TypeName, + } +); + +ast_node!( + /// An array type name. + struct ArrayTypeName { + type_descriptions: TypeDescriptions, + base_type: TypeName, + length: Option, + } +); + +ast_node!( + /// A function type name. + struct FunctionTypeName { + type_descriptions: TypeDescriptions, + parameter_types: ParameterList, + return_parameter_types: ParameterList, + state_mutability: StateMutability, + visibility: Visibility, + } +); + +ast_node!( + /// A parameter list. + struct ParameterList { + parameters: Vec, + } +); + +ast_node!( + /// A variable declaration. + struct VariableDeclaration { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + #[serde(default, deserialize_with = "serde_helpers::default_for_null")] + base_functions: Vec, + /// Marks whether or not the variable is a constant before Solidity 0.7.x. + /// + /// After 0.7.x you must use `mutability`. For cross-version compatibility use + /// [`VariableDeclaration::mutability()`]. + #[serde(default)] + constant: bool, + /// Marks whether or not the variable is a state variable before Solidity 0.7.x. + /// + /// After 0.7.x you must use `mutability`. For cross-version compatibility use + /// [`VariableDeclaration::mutability()`]. + #[serde(default)] + state_variable: bool, + documentation: Option, + function_selector: Option, // TODO + #[serde(default)] + indexed: bool, + /// Marks the variable's mutability from Solidity 0.7.x onwards. + /// For cross-version compatibility use [`VariableDeclaration::mutability()`]. + #[serde(default)] + mutability: Option, + overrides: Option, + scope: usize, + storage_location: StorageLocation, + type_descriptions: TypeDescriptions, + type_name: Option, + value: Option, + visibility: Visibility, + } +); + +impl VariableDeclaration { + /// Returns the mutability of the variable that was declared. + /// + /// This is a helper to check variable mutability across Solidity versions. + pub fn mutability(&self) -> &Mutability { + if let Some(mutability) = &self.mutability { + mutability + } else if self.constant { + &Mutability::Constant + } else if self.state_variable { + &Mutability::Mutable + } else { + unreachable!() + } + } +} + +/// Structured documentation (NatSpec). +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum StructuredDocumentation { + /// The documentation is provided in the form of an AST node. + Parsed { text: String }, + /// The documentation is provided in the form of a string literal. + Text(String), +} + +ast_node!( + /// An override specifier. + struct OverrideSpecifier { + overrides: Vec, + } +); + +ast_node!( + /// A user defined type name. + struct UserDefinedTypeName { + type_descriptions: TypeDescriptions, + contract_scope: Option, // TODO + name: Option, + path_node: Option, + referenced_declaration: isize, + } +); + +ast_node!( + /// An identifier path. + struct IdentifierPath { + name: String, + referenced_declaration: isize, + } +); + +ast_node!( + /// A mapping type. + struct Mapping { + type_descriptions: TypeDescriptions, + key_type: TypeName, + value_type: TypeName, + } +); + +expr_node!( + /// A tuple expression. + struct TupleExpression { + components: Vec, + is_inline_array: bool, + } +); + +expr_node!( + /// A unary operation. + struct UnaryOperation { + operator: UnaryOperator, + /// Whether the unary operator is before or after the expression (e.g. `x++` vs. `++x`) + prefix: bool, + sub_expression: Expression, + } +); + +/// Unary operators. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub enum UnaryOperator { + /// Increment (`++`) + #[serde(rename = "++")] + Increment, + /// Decrement (`--`) + #[serde(rename = "--")] + Decrement, + /// Negate (`-`) + #[serde(rename = "-")] + Negate, + /// Not (`!`) + #[serde(rename = "!")] + Not, + /// Bitwise not (`~`) + #[serde(rename = "~")] + BitNot, + /// `delete` + #[serde(rename = "delete")] + Delete, +} + +ast_node!( + /// An enum definition. + struct EnumDefinition { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + canonical_name: String, + members: Vec, + } +); + +ast_node!( + /// An enum value. + struct EnumValue { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + } +); + +ast_node!( + /// A custom error definition. + struct ErrorDefinition { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + documentation: Option, + error_selector: Option, // TODO + parameters: ParameterList, + } +); + +ast_node!( + /// An event definition. + struct EventDefinition { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + anonymous: bool, + event_selector: Option, // TODO + documentation: Option, + parameters: ParameterList, + } +); + +ast_node!( + /// A function definition. + struct FunctionDefinition { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + #[serde(default)] + base_functions: Vec, + body: Option, + documentation: Option, + function_selector: Option, // TODO + implemented: bool, + modifiers: Vec, + overrides: Option, + parameters: ParameterList, + return_parameters: ParameterList, + scope: usize, + visibility: Visibility, + /// The kind of function this node defines. Only valid for Solidity versions 0.5.x and + /// above. + /// + /// For cross-version compatibility use [`FunctionDefinition::kind()`]. + kind: Option, + /// The state mutability of the function. + /// + /// Note: This was introduced in Solidity 0.5.x. For cross-version compatibility use + /// [`FunctionDefinition::state_mutability()`]. + #[serde(default)] + state_mutability: Option, + #[serde(default, rename = "virtual")] + is_virtual: bool, + /// Whether or not this function is the constructor. Only valid for Solidity versions below + /// 0.5.x. + /// + /// After 0.5.x you must use `kind`. For cross-version compatibility use + /// [`FunctionDefinition::kind()`]. + #[serde(default)] + is_constructor: bool, + /// Whether or not this function is constant (view or pure). Only valid for Solidity + /// versions below 0.5.x. + /// + /// After 0.5.x you must use `state_mutability`. For cross-version compatibility use + /// [`FunctionDefinition::state_mutability()`]. + #[serde(default)] + is_declared_const: bool, + /// Whether or not this function is payable. Only valid for Solidity versions below + /// 0.5.x. + /// + /// After 0.5.x you must use `state_mutability`. For cross-version compatibility use + /// [`FunctionDefinition::state_mutability()`]. + #[serde(default)] + is_payable: bool, + } +); + +impl FunctionDefinition { + /// The kind of function this node defines. + pub fn kind(&self) -> &FunctionKind { + if let Some(kind) = &self.kind { + kind + } else if self.is_constructor { + &FunctionKind::Constructor + } else { + &FunctionKind::Function + } + } + + /// The state mutability of the function. + /// + /// Note: Before Solidity 0.5.x, this is an approximation, as there was no distinction between + /// `view` and `pure`. + pub fn state_mutability(&self) -> &StateMutability { + if let Some(state_mutability) = &self.state_mutability { + state_mutability + } else if self.is_declared_const { + &StateMutability::View + } else if self.is_payable { + &StateMutability::Payable + } else { + &StateMutability::Nonpayable + } + } +} + +/// Function kinds. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum FunctionKind { + /// A contract function. + Function, + /// A receive function. + Receive, + /// A constructor. + Constructor, + /// A fallback function. + Fallback, + /// A free-standing function. + FreeFunction, +} + +ast_node!( + /// A block of statements. + struct Block { + documentation: Option, + #[serde(default, deserialize_with = "serde_helpers::default_for_null")] + statements: Vec, + } +); + +stmt_node!( + /// The break keyword. + struct Break {} +); + +stmt_node!( + /// The continue keyword. + struct Continue {} +); + +stmt_node!( + /// A do while statement. + struct DoWhileStatement { + block: Block, + condition: Expression, + } +); + +stmt_node!( + /// An emit statement. + struct EmitStatement { + event_call: FunctionCall, + } +); + +stmt_node!( + /// An expression statement. + struct ExpressionStatement { + expression: Expression, + } +); + +stmt_node!( + /// A for statement. + struct ForStatement { + body: BlockOrStatement, + condition: Option, + initialization_expression: Option, + loop_expression: Option, + } +); + +stmt_node!( + /// A variable declaration statement. + struct VariableDeclarationStatement { + assignments: Vec>, + declarations: Vec>, + initial_value: Option, + } +); + +stmt_node!( + /// An if statement. + struct IfStatement { + condition: Expression, + false_body: Option, + true_body: BlockOrStatement, + } +); + +ast_node!( + /// A block of inline assembly. + /// + /// Refer to the [yul] module for Yul AST nodes. + struct InlineAssembly { + documentation: Option, + #[serde(rename = "AST")] + ast: YulBlock, + // TODO: We need this camel case for the AST, but pascal case other places in ethers-solc + //evm_version: EvmVersion, + external_references: Vec, + #[serde(default)] + flags: Vec, + } +); + +/// A reference to an external variable or slot in an inline assembly block. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ExternalInlineAssemblyReference { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub declaration: usize, + #[serde(default)] + pub offset: bool, + #[serde(default)] + pub slot: bool, + #[serde(default)] + pub length: bool, + pub value_size: usize, + pub suffix: Option, +} + +/// An assembly reference suffix. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum AssemblyReferenceSuffix { + /// The reference refers to a storage slot. + Slot, + /// The reference refers to an offset. + Offset, + /// The reference refers to a length. + Length, +} + +/// Inline assembly flags. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub enum InlineAssemblyFlag { + MemorySafe, +} + +stmt_node!( + /// A placeholder statement (`_`) + struct PlaceholderStatement {} +); + +stmt_node!( + /// A return statement. + struct Return { + expression: Option, + function_return_parameters: usize, + } +); + +stmt_node!( + /// A revert statement. + struct RevertStatement { + error_call: FunctionCall, + } +); + +stmt_node!( + /// A try/catch statement. + struct TryStatement { + clauses: Vec, + external_call: FunctionCall, + } +); + +ast_node!( + /// A try/catch clause. + struct TryCatchClause { + block: Block, + error_name: String, + #[serde(default)] + parameters: Vec, + } +); + +stmt_node!( + /// An unchecked block. + struct UncheckedBlock { + statements: Vec, + } +); + +stmt_node!( + /// A while statement. + struct WhileStatement { + body: BlockOrStatement, + condition: Expression, + } +); + +ast_node!( + /// A modifier or base constructor invocation. + struct ModifierInvocation { + #[serde(default)] + arguments: Vec, + kind: Option, + modifier_name: IdentifierOrIdentifierPath, + } +); + +/// Modifier invocation kinds. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum ModifierInvocationKind { + /// A regular modifier invocation. + ModifierInvocation, + /// A base constructor invocation. + BaseConstructorSpecifier, +} + +ast_node!( + /// A modifier definition. + struct ModifierDefinition { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + #[serde(default, deserialize_with = "serde_helpers::default_for_null")] + base_modifiers: Vec, + body: Block, + documentation: Option, + overrides: Option, + parameters: ParameterList, + #[serde(default, rename = "virtual")] + is_virtual: bool, + visibility: Visibility, + } +); + +ast_node!( + /// A struct definition. + struct StructDefinition { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + canonical_name: String, + members: Vec, + scope: usize, + visibility: Visibility, + } +); + +ast_node!( + /// A user defined value type definition. + struct UserDefinedValueTypeDefinition { + name: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + canonical_name: Option, + underlying_type: TypeName, + } +); + +ast_node!( + /// A using for directive. + struct UsingForDirective { + #[serde(default)] + function_list: Vec, + #[serde(default)] + global: bool, + library_name: Option, + type_name: Option, + } +); + +/// A wrapper around [IdentifierPath] for the [UsingForDirective]. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct FunctionIdentifierPath { + pub function: IdentifierPath, +} + +ast_node!( + /// An import directive. + struct ImportDirective { + absolute_path: String, + file: String, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + name_location: Option, + scope: usize, + source_unit: usize, + symbol_aliases: Vec, + unit_alias: String, + } +); + +/// A symbol alias. +/// +/// Symbol aliases can be defined using the [ImportDirective]. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct SymbolAlias { + pub foreign: Identifier, + pub local: Option, + #[serde(default, with = "serde_helpers::display_from_str_opt")] + pub name_location: Option, +} + +ast_node!( + /// A pragma directive. + struct PragmaDirective { + literals: Vec, } ); #[cfg(test)] mod tests { use super::*; + use std::{fs, path::PathBuf}; #[test] fn can_parse_ast() { - let ast = include_str!("../../test-data/ast/ast-erc4626.json"); - let _ast: SourceUnit = serde_json::from_str(ast).unwrap(); + fs::read_dir(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test-data").join("ast")) + .unwrap() + .for_each(|path| { + let path = path.unwrap().path(); + let path_str = path.to_string_lossy(); + + let input = fs::read_to_string(&path).unwrap(); + let deserializer = &mut serde_json::Deserializer::from_str(&input); + let result: Result = serde_path_to_error::deserialize(deserializer); + match result { + Err(e) => { + println!("... {} fail: {e}", path_str); + panic!(); + } + Ok(_) => { + println!("... {} ok", path_str); + } + } + }) } } diff --git a/ethers-solc/src/artifacts/ast/yul.rs b/ethers-solc/src/artifacts/ast/yul.rs new file mode 100644 index 00000000..556083cb --- /dev/null +++ b/ethers-solc/src/artifacts/ast/yul.rs @@ -0,0 +1,192 @@ +use super::{macros::node_group, misc::SourceLocation}; +use crate::artifacts::serde_helpers; +use serde::{Deserialize, Serialize}; + +node_group! { + YulStatement; + + YulAssignment, + YulBlock, + YulBreak, + YulContinue, + YulExpressionStatement, + YulLeave, + YulForLoop, + YulFunctionDefinition, + YulIf, + YulSwitch, + YulVariableDeclaration, +} + +node_group! { + YulExpression; + + YulFunctionCall, + YulIdentifier, + YulLiteral, +} + +/// A Yul block. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulBlock { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub statements: Vec, +} + +/// A Yul assignment statement. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct YulAssignment { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub value: YulExpression, + pub variable_names: Vec, +} + +/// A Yul function call. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct YulFunctionCall { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub arguments: Vec, + pub function_name: YulIdentifier, +} + +/// A Yul identifier. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulIdentifier { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub name: String, +} + +/// A literal Yul value. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct YulLiteral { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub hex_value: Option, // TODO + pub value: Option, // TODO + pub kind: YulLiteralKind, + pub type_name: Option, // TODO +} + +/// Yul literal value kinds. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum YulLiteralKind { + /// A number literal. + Number, + /// A string literal. + String, + /// A boolean literal. + Bool, +} + +/// A Yul keyword. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulKeyword { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, +} + +/// The Yul break keyword. +pub type YulBreak = YulKeyword; +/// The Yul continue keyword. +pub type YulContinue = YulKeyword; +/// The Yul leave keyword. +pub type YulLeave = YulKeyword; + +/// A Yul expression statement. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulExpressionStatement { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub expression: YulExpression, +} + +/// A Yul for loop. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulForLoop { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub body: YulBlock, + pub condition: YulExpression, + pub post: YulBlock, + pub pre: YulBlock, +} + +/// A Yul function definition. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct YulFunctionDefinition { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub body: YulBlock, + pub name: String, + #[serde(default)] + pub parameters: Vec, + #[serde(default)] + pub return_variables: Vec, +} + +/// A Yul type name. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct YulTypedName { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub name: String, + #[serde(rename = "type")] + pub type_name: String, // TODO +} + +/// A Yul if statement. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulIf { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub body: YulBlock, + pub condition: YulExpression, +} + +/// A Yul switch statement. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulSwitch { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub cases: Vec, + pub expression: YulExpression, +} + +/// A Yul switch statement case. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulCase { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub body: YulBlock, + pub value: YulCaseValue, +} + +/// A Yul switch case value. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum YulCaseValue { + /// A case defined by a literal value. + YulLiteral(YulLiteral), + /// The default case + // TODO: How do we make this only match "default"? + Default(String), +} + +/// A Yul variable declaration. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct YulVariableDeclaration { + #[serde(with = "serde_helpers::display_from_str")] + pub src: SourceLocation, + pub value: Option, + pub variables: Vec, +} diff --git a/ethers-solc/src/artifacts/mod.rs b/ethers-solc/src/artifacts/mod.rs index 7b42276b..7de6b01b 100644 --- a/ethers-solc/src/artifacts/mod.rs +++ b/ethers-solc/src/artifacts/mod.rs @@ -1846,7 +1846,10 @@ impl SourceFile { pub fn contains_contract_definition(&self) -> bool { if let Some(ref ast) = self.ast { // contract definitions are only allowed at the source-unit level - return ast.nodes.iter().any(|node| matches!(node, SourceUnitPart::ContractDefinition)) + return ast + .nodes + .iter() + .any(|node| matches!(node, SourceUnitPart::ContractDefinition(_))) // abstract contract, interfaces: ContractDefinition } diff --git a/ethers-solc/test-data/ast/abstract_contract.json b/ethers-solc/test-data/ast/abstract_contract.json new file mode 100644 index 00000000..168433eb --- /dev/null +++ b/ethers-solc/test-data/ast/abstract_contract.json @@ -0,0 +1,73 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 5 + ] + }, + "id": 6, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": true, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "C", + "nameLocation": "18:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "37:4:1", + "statements": [] + }, + "id": 4, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "34:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "37:0:1" + }, + "scope": 5, + "src": "23:18:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 6, + "src": "0:43:1", + "usedErrors": [] + } + ], + "src": "0:44:1" +} diff --git a/ethers-solc/test-data/ast/address_payable.json b/ethers-solc/test-data/ast/address_payable.json new file mode 100644 index 00000000..cc87fc3b --- /dev/null +++ b/ethers-solc/test-data/ast/address_payable.json @@ -0,0 +1,574 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 39 + ] + }, + "id": 40, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 39, + "linearizedBaseContracts": + [ + 39 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "constant": false, + "functionSelector": "97682884", + "id": 4, + "mutability": "mutable", + "name": "m", + "nameLocation": "60:1:1", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "17:44:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_address_$_t_address_payable_$", + "typeString": "mapping(address => address payable)" + }, + "typeName": + { + "id": 3, + "keyType": + { + "id": 1, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "25:7:1", + "typeDescriptions": + { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "17:35:1", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_address_$_t_address_payable_$", + "typeString": "mapping(address => address payable)" + }, + "valueType": + { + "id": 2, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "36:15:1", + "stateMutability": "payable", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + } + }, + "visibility": "public" + }, + { + "body": + { + "id": 37, + "nodeType": "Block", + "src": "134:122:1", + "statements": + [ + { + "assignments": + [ + 12 + ], + "declarations": + [ + { + "constant": false, + "id": 12, + "mutability": "mutable", + "name": "a", + "nameLocation": "160:1:1", + "nodeType": "VariableDeclaration", + "scope": 37, + "src": "144:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + }, + "typeName": + { + "id": 11, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "144:15:1", + "stateMutability": "payable", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "visibility": "internal" + } + ], + "id": 16, + "initialValue": + { + "baseExpression": + { + "id": 13, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "164:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_address_$_t_address_payable_$", + "typeString": "mapping(address => address payable)" + } + }, + "id": 15, + "indexExpression": + { + "id": 14, + "name": "arg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6, + "src": "166:3:1", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "164:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "144:26:1" + }, + { + "expression": + { + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": + { + "id": 17, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "180:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": + { + "id": 18, + "name": "arg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6, + "src": "184:3:1", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "180:7:1", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "id": 20, + "nodeType": "ExpressionStatement", + "src": "180:7:1" + }, + { + "assignments": + [ + 22 + ], + "declarations": + [ + { + "constant": false, + "id": 22, + "mutability": "mutable", + "name": "c", + "nameLocation": "205:1:1", + "nodeType": "VariableDeclaration", + "scope": 37, + "src": "197:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": + { + "id": 21, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "197:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": + { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 27, + "initialValue": + { + "arguments": + [ + { + "id": 25, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "217:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_contract$_C_$39", + "typeString": "contract C" + } + } + ], + "expression": + { + "argumentTypes": + [ + { + "typeIdentifier": "t_contract$_C_$39", + "typeString": "contract C" + } + ], + "id": 24, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "209:7:1", + "typeDescriptions": + { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": + { + "id": 23, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "209:7:1", + "typeDescriptions": {} + } + }, + "id": 26, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "209:13:1", + "tryCall": false, + "typeDescriptions": + { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "197:25:1" + }, + { + "expression": + { + "id": 35, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": + { + "baseExpression": + { + "id": 28, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "232:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_address_$_t_address_payable_$", + "typeString": "mapping(address => address payable)" + } + }, + "id": 30, + "indexExpression": + { + "id": 29, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 22, + "src": "234:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "232:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": + { + "arguments": + [ + { + "hexValue": "30", + "id": 33, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "247:1:1", + "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": "239:8:1", + "typeDescriptions": + { + "typeIdentifier": "t_type$_t_address_payable_$", + "typeString": "type(address payable)" + }, + "typeName": + { + "id": 31, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "239:8:1", + "stateMutability": "payable", + "typeDescriptions": {} + } + }, + "id": 34, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "239:10:1", + "tryCall": false, + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "232:17:1", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "id": 36, + "nodeType": "ExpressionStatement", + "src": "232:17:1" + } + ] + }, + "functionSelector": "fc68521a", + "id": 38, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "76:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 7, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 6, + "mutability": "mutable", + "name": "arg", + "nameLocation": "94:3:1", + "nodeType": "VariableDeclaration", + "scope": 38, + "src": "78:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + }, + "typeName": + { + "id": 5, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "78:15:1", + "stateMutability": "payable", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "visibility": "internal" + } + ], + "src": "77:21:1" + }, + "returnParameters": + { + "id": 10, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 9, + "mutability": "mutable", + "name": "r", + "nameLocation": "131:1:1", + "nodeType": "VariableDeclaration", + "scope": 38, + "src": "115:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + }, + "typeName": + { + "id": 8, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "115:15:1", + "stateMutability": "payable", + "typeDescriptions": + { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "visibility": "internal" + } + ], + "src": "114:19:1" + }, + "scope": 39, + "src": "67:189:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 40, + "src": "0:258:1", + "usedErrors": [] + } + ], + "src": "0:259:1" +} diff --git a/ethers-solc/test-data/ast/array_type_name.json b/ethers-solc/test-data/ast/array_type_name.json new file mode 100644 index 00000000..c1bcaa98 --- /dev/null +++ b/ethers-solc/test-data/ast/array_type_name.json @@ -0,0 +1,79 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 4 + ] + }, + "id": 5, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 4, + "linearizedBaseContracts": + [ + 4 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "constant": false, + "id": 3, + "mutability": "mutable", + "name": "i", + "nameLocation": "20:1:1", + "nodeType": "VariableDeclaration", + "scope": 4, + "src": "13:8:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[]" + }, + "typeName": + { + "baseType": + { + "id": 1, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "13:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2, + "nodeType": "ArrayTypeName", + "src": "13:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "scope": 5, + "src": "0:24:1", + "usedErrors": [] + } + ], + "src": "0:25:1" +} diff --git a/ethers-solc/test-data/ast/ast-erc4626.json b/ethers-solc/test-data/ast/ast-erc4626.json deleted file mode 100644 index cc733b85..00000000 --- a/ethers-solc/test-data/ast/ast-erc4626.json +++ /dev/null @@ -1,6612 +0,0 @@ -{ - "absolutePath": "/home/oliver/Projects/github/rari-capital/solmate/src/mixins/ERC4626.sol", - "id": 2954, - "exportedSymbols": { - "ERC20": [ - 31408 - ], - "ERC4626": [ - 2953 - ], - "FixedPointMathLib": [ - 32321 - ], - "SafeTransferLib": [ - 32785 - ] - }, - "nodeType": "SourceUnit", - "src": "42:6474:4", - "nodes": [ - { - "id": 2434, - "nodeType": "PragmaDirective", - "src": "42:24:4", - "literals": [ - "solidity", - ">=", - "0.8", - ".0" - ] - }, - { - "id": 2436, - "nodeType": "ImportDirective", - "src": "68:42:4", - "absolutePath": "/home/oliver/Projects/github/rari-capital/solmate/src/tokens/ERC20.sol", - "file": "../tokens/ERC20.sol", - "nameLocation": "-1:-1:-1", - "scope": 2954, - "sourceUnit": 31409, - "symbolAliases": [ - { - "foreign": { - "id": 2435, - "name": "ERC20", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "src": "76:5:4", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" - }, - { - "id": 2438, - "nodeType": "ImportDirective", - "src": "111:61:4", - "absolutePath": "/home/oliver/Projects/github/rari-capital/solmate/src/utils/SafeTransferLib.sol", - "file": "../utils/SafeTransferLib.sol", - "nameLocation": "-1:-1:-1", - "scope": 2954, - "sourceUnit": 32786, - "symbolAliases": [ - { - "foreign": { - "id": 2437, - "name": "SafeTransferLib", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "src": "119:15:4", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" - }, - { - "id": 2440, - "nodeType": "ImportDirective", - "src": "173:65:4", - "absolutePath": "/home/oliver/Projects/github/rari-capital/solmate/src/utils/FixedPointMathLib.sol", - "file": "../utils/FixedPointMathLib.sol", - "nameLocation": "-1:-1:-1", - "scope": 2954, - "sourceUnit": 32322, - "symbolAliases": [ - { - "foreign": { - "id": 2439, - "name": "FixedPointMathLib", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "src": "181:17:4", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" - }, - { - "id": 2953, - "nodeType": "ContractDefinition", - "src": "395:6120:4", - "nodes": [ - { - "id": 2447, - "nodeType": "UsingForDirective", - "src": "436:32:4", - "libraryName": { - "id": 2444, - "name": "SafeTransferLib", - "nodeType": "IdentifierPath", - "referencedDeclaration": 32785, - "src": "442:15:4" - }, - "typeName": { - "id": 2446, - "nodeType": "UserDefinedTypeName", - "pathNode": { - "id": 2445, - "name": "ERC20", - "nodeType": "IdentifierPath", - "referencedDeclaration": 31408, - "src": "462:5:4" - }, - "referencedDeclaration": 31408, - "src": "462:5:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - } - }, - { - "id": 2450, - "nodeType": "UsingForDirective", - "src": "473:36:4", - "libraryName": { - "id": 2448, - "name": "FixedPointMathLib", - "nodeType": "IdentifierPath", - "referencedDeclaration": 32321, - "src": "479:17:4" - }, - "typeName": { - "id": 2449, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "501:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - }, - { - "id": 2460, - "nodeType": "EventDefinition", - "src": "694:93:4", - "anonymous": false, - "name": "Deposit", - "nameLocation": "700:7:4", - "parameters": { - "id": 2459, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2452, - "indexed": true, - "mutability": "mutable", - "name": "caller", - "nameLocation": "724:6:4", - "nodeType": "VariableDeclaration", - "scope": 2460, - "src": "708:22:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2451, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "708:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2454, - "indexed": true, - "mutability": "mutable", - "name": "owner", - "nameLocation": "748:5:4", - "nodeType": "VariableDeclaration", - "scope": 2460, - "src": "732:21:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2453, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "732:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2456, - "indexed": false, - "mutability": "mutable", - "name": "assets", - "nameLocation": "763:6:4", - "nodeType": "VariableDeclaration", - "scope": 2460, - "src": "755:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2455, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "755:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2458, - "indexed": false, - "mutability": "mutable", - "name": "shares", - "nameLocation": "779:6:4", - "nodeType": "VariableDeclaration", - "scope": 2460, - "src": "771:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2457, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "771:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "707:79:4" - } - }, - { - "id": 2472, - "nodeType": "EventDefinition", - "src": "793:166:4", - "anonymous": false, - "name": "Withdraw", - "nameLocation": "799:8:4", - "parameters": { - "id": 2471, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2462, - "indexed": true, - "mutability": "mutable", - "name": "caller", - "nameLocation": "833:6:4", - "nodeType": "VariableDeclaration", - "scope": 2472, - "src": "817:22:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2461, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "817:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2464, - "indexed": true, - "mutability": "mutable", - "name": "receiver", - "nameLocation": "865:8:4", - "nodeType": "VariableDeclaration", - "scope": 2472, - "src": "849:24:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2463, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "849:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2466, - "indexed": true, - "mutability": "mutable", - "name": "owner", - "nameLocation": "899:5:4", - "nodeType": "VariableDeclaration", - "scope": 2472, - "src": "883:21:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2465, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "883:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2468, - "indexed": false, - "mutability": "mutable", - "name": "assets", - "nameLocation": "922:6:4", - "nodeType": "VariableDeclaration", - "scope": 2472, - "src": "914:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2467, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "914:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2470, - "indexed": false, - "mutability": "mutable", - "name": "shares", - "nameLocation": "946:6:4", - "nodeType": "VariableDeclaration", - "scope": 2472, - "src": "938:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2469, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "938:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "807:151:4" - } - }, - { - "id": 2475, - "nodeType": "VariableDeclaration", - "src": "1146:28:4", - "constant": false, - "functionSelector": "38d52e0f", - "mutability": "immutable", - "name": "asset", - "nameLocation": "1169:5:4", - "scope": 2953, - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - }, - "typeName": { - "id": 2474, - "nodeType": "UserDefinedTypeName", - "pathNode": { - "id": 2473, - "name": "ERC20", - "nodeType": "IdentifierPath", - "referencedDeclaration": 31408, - "src": "1146:5:4" - }, - "referencedDeclaration": 31408, - "src": "1146:5:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "visibility": "public" - }, - { - "id": 2497, - "nodeType": "FunctionDefinition", - "src": "1181:172:4", - "body": { - "id": 2496, - "nodeType": "Block", - "src": "1322:31:4", - "statements": [ - { - "expression": { - "id": 2494, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 2492, - "name": "asset", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2475, - "src": "1332:5:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 2493, - "name": "_asset", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2478, - "src": "1340:6:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "src": "1332:14:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "id": 2495, - "nodeType": "ExpressionStatement", - "src": "1332:14:4" - } - ] - }, - "implemented": true, - "kind": "constructor", - "modifiers": [ - { - "arguments": [ - { - "id": 2485, - "name": "_name", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2480, - "src": "1287:5:4", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - { - "id": 2486, - "name": "_symbol", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2482, - "src": "1294:7:4", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - { - "arguments": [], - "expression": { - "argumentTypes": [], - "expression": { - "id": 2487, - "name": "_asset", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2478, - "src": "1303:6:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "id": 2488, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "decimals", - "nodeType": "MemberAccess", - "referencedDeclaration": 31045, - "src": "1303:15:4", - "typeDescriptions": { - "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", - "typeString": "function () view external returns (uint8)" - } - }, - "id": 2489, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1303:17:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - } - } - ], - "id": 2490, - "kind": "baseConstructorSpecifier", - "modifierName": { - "id": 2484, - "name": "ERC20", - "nodeType": "IdentifierPath", - "referencedDeclaration": 31408, - "src": "1281:5:4" - }, - "nodeType": "ModifierInvocation", - "src": "1281:40:4" - } - ], - "name": "", - "nameLocation": "-1:-1:-1", - "parameters": { - "id": 2483, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2478, - "mutability": "mutable", - "name": "_asset", - "nameLocation": "1208:6:4", - "nodeType": "VariableDeclaration", - "scope": 2497, - "src": "1202:12:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - }, - "typeName": { - "id": 2477, - "nodeType": "UserDefinedTypeName", - "pathNode": { - "id": 2476, - "name": "ERC20", - "nodeType": "IdentifierPath", - "referencedDeclaration": 31408, - "src": "1202:5:4" - }, - "referencedDeclaration": 31408, - "src": "1202:5:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2480, - "mutability": "mutable", - "name": "_name", - "nameLocation": "1238:5:4", - "nodeType": "VariableDeclaration", - "scope": 2497, - "src": "1224:19:4", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string" - }, - "typeName": { - "id": 2479, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "1224:6:4", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2482, - "mutability": "mutable", - "name": "_symbol", - "nameLocation": "1267:7:4", - "nodeType": "VariableDeclaration", - "scope": 2497, - "src": "1253:21:4", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string" - }, - "typeName": { - "id": 2481, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "1253:6:4", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "visibility": "internal" - } - ], - "src": "1192:88:4" - }, - "returnParameters": { - "id": 2491, - "nodeType": "ParameterList", - "parameters": [], - "src": "1322:0:4" - }, - "scope": 2953, - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "internal" - }, - { - "id": 2549, - "nodeType": "FunctionDefinition", - "src": "1547:516:4", - "body": { - "id": 2548, - "nodeType": "Block", - "src": "1638:425:4", - "statements": [ - { - "expression": { - "arguments": [ - { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2514, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "components": [ - { - "id": 2511, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 2507, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2504, - "src": "1732:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "arguments": [ - { - "id": 2509, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2499, - "src": "1756:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2508, - "name": "previewDeposit", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2822, - "src": "1741:14:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$", - "typeString": "function (uint256) view returns (uint256)" - } - }, - "id": 2510, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1741:22:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1732:31:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 2512, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "1731:33:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "hexValue": "30", - "id": 2513, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1768:1:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "1731:38:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "hexValue": "5a45524f5f534841524553", - "id": 2515, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1771:13:4", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_2119bd5d92259e418533f96b824fbd100e3dea453e6ac4c5f7315e6344368f2f", - "typeString": "literal_string \"ZERO_SHARES\"" - }, - "value": "ZERO_SHARES" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_2119bd5d92259e418533f96b824fbd100e3dea453e6ac4c5f7315e6344368f2f", - "typeString": "literal_string \"ZERO_SHARES\"" - } - ], - "id": 2506, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - -18, - -18 - ], - "referencedDeclaration": -18, - "src": "1723:7:4", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 2516, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1723:62:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2517, - "nodeType": "ExpressionStatement", - "src": "1723:62:4" - }, - { - "expression": { - "arguments": [ - { - "expression": { - "id": 2521, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "1888:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2522, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "1888:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "arguments": [ - { - "id": 2525, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -28, - "src": "1908:4:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC4626_$2953", - "typeString": "contract ERC4626" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_contract$_ERC4626_$2953", - "typeString": "contract ERC4626" - } - ], - "id": 2524, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "1900:7:4", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_address_$", - "typeString": "type(address)" - }, - "typeName": { - "id": 2523, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1900:7:4", - "typeDescriptions": {} - } - }, - "id": 2526, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1900:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2527, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2499, - "src": "1915:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 2518, - "name": "asset", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2475, - "src": "1865:5:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "id": 2520, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "safeTransferFrom", - "nodeType": "MemberAccess", - "referencedDeclaration": 32744, - "src": "1865:22:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_ERC20_$31408_$_t_address_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_ERC20_$31408_$", - "typeString": "function (contract ERC20,address,address,uint256)" - } - }, - "id": 2528, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1865:57:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2529, - "nodeType": "ExpressionStatement", - "src": "1865:57:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2531, - "name": "receiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2501, - "src": "1939:8:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2532, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2504, - "src": "1949:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2530, - "name": "_mint", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31379, - "src": "1933:5:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 2533, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1933:23:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2534, - "nodeType": "ExpressionStatement", - "src": "1933:23:4" - }, - { - "eventCall": { - "arguments": [ - { - "expression": { - "id": 2536, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "1980:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2537, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "1980:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2538, - "name": "receiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2501, - "src": "1992:8:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2539, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2499, - "src": "2002:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2540, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2504, - "src": "2010:6:4", - "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_uint256", - "typeString": "uint256" - } - ], - "id": 2535, - "name": "Deposit", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2460, - "src": "1972:7:4", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256,uint256)" - } - }, - "id": 2541, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1972:45:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2542, - "nodeType": "EmitStatement", - "src": "1967:50:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2544, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2499, - "src": "2041:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2545, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2504, - "src": "2049:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2543, - "name": "afterDeposit", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2952, - "src": "2028:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_uint256_$returns$__$", - "typeString": "function (uint256,uint256)" - } - }, - "id": 2546, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2028:28:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2547, - "nodeType": "ExpressionStatement", - "src": "2028:28:4" - } - ] - }, - "functionSelector": "6e553f65", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "deposit", - "nameLocation": "1556:7:4", - "parameters": { - "id": 2502, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2499, - "mutability": "mutable", - "name": "assets", - "nameLocation": "1572:6:4", - "nodeType": "VariableDeclaration", - "scope": 2549, - "src": "1564:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2498, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1564:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2501, - "mutability": "mutable", - "name": "receiver", - "nameLocation": "1588:8:4", - "nodeType": "VariableDeclaration", - "scope": 2549, - "src": "1580:16:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2500, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1580:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "1563:34:4" - }, - "returnParameters": { - "id": 2505, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2504, - "mutability": "mutable", - "name": "shares", - "nameLocation": "1630:6:4", - "nodeType": "VariableDeclaration", - "scope": 2549, - "src": "1622:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2503, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1622:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "1621:16:4" - }, - "scope": 2953, - "stateMutability": "nonpayable", - "virtual": true, - "visibility": "public" - }, - { - "id": 2595, - "nodeType": "FunctionDefinition", - "src": "2069:467:4", - "body": { - "id": 2594, - "nodeType": "Block", - "src": "2157:379:4", - "statements": [ - { - "expression": { - "id": 2562, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 2558, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2556, - "src": "2167:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "arguments": [ - { - "id": 2560, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2551, - "src": "2188:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2559, - "name": "previewMint", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2846, - "src": "2176:11:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$", - "typeString": "function (uint256) view returns (uint256)" - } - }, - "id": 2561, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2176:19:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "2167:28:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2563, - "nodeType": "ExpressionStatement", - "src": "2167:28:4" - }, - { - "expression": { - "arguments": [ - { - "expression": { - "id": 2567, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "2361:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2568, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "2361:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "arguments": [ - { - "id": 2571, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -28, - "src": "2381:4:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC4626_$2953", - "typeString": "contract ERC4626" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_contract$_ERC4626_$2953", - "typeString": "contract ERC4626" - } - ], - "id": 2570, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "2373:7:4", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_address_$", - "typeString": "type(address)" - }, - "typeName": { - "id": 2569, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2373:7:4", - "typeDescriptions": {} - } - }, - "id": 2572, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2373:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2573, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2556, - "src": "2388:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 2564, - "name": "asset", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2475, - "src": "2338:5:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "id": 2566, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "safeTransferFrom", - "nodeType": "MemberAccess", - "referencedDeclaration": 32744, - "src": "2338:22:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_ERC20_$31408_$_t_address_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_ERC20_$31408_$", - "typeString": "function (contract ERC20,address,address,uint256)" - } - }, - "id": 2574, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2338:57:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2575, - "nodeType": "ExpressionStatement", - "src": "2338:57:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2577, - "name": "receiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2553, - "src": "2412:8:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2578, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2551, - "src": "2422:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2576, - "name": "_mint", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31379, - "src": "2406:5:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 2579, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2406:23:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2580, - "nodeType": "ExpressionStatement", - "src": "2406:23:4" - }, - { - "eventCall": { - "arguments": [ - { - "expression": { - "id": 2582, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "2453:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2583, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "2453:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2584, - "name": "receiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2553, - "src": "2465:8:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2585, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2556, - "src": "2475:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2586, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2551, - "src": "2483:6:4", - "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_uint256", - "typeString": "uint256" - } - ], - "id": 2581, - "name": "Deposit", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2460, - "src": "2445:7:4", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256,uint256)" - } - }, - "id": 2587, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2445:45:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2588, - "nodeType": "EmitStatement", - "src": "2440:50:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2590, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2556, - "src": "2514:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2591, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2551, - "src": "2522:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2589, - "name": "afterDeposit", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2952, - "src": "2501:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_uint256_$returns$__$", - "typeString": "function (uint256,uint256)" - } - }, - "id": 2592, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2501:28:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2593, - "nodeType": "ExpressionStatement", - "src": "2501:28:4" - } - ] - }, - "functionSelector": "94bf804d", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "mint", - "nameLocation": "2078:4:4", - "parameters": { - "id": 2554, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2551, - "mutability": "mutable", - "name": "shares", - "nameLocation": "2091:6:4", - "nodeType": "VariableDeclaration", - "scope": 2595, - "src": "2083:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2550, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "2083:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2553, - "mutability": "mutable", - "name": "receiver", - "nameLocation": "2107:8:4", - "nodeType": "VariableDeclaration", - "scope": 2595, - "src": "2099:16:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2552, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2099:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "2082:34:4" - }, - "returnParameters": { - "id": 2557, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2556, - "mutability": "mutable", - "name": "assets", - "nameLocation": "2149:6:4", - "nodeType": "VariableDeclaration", - "scope": 2595, - "src": "2141:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2555, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "2141:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "2140:16:4" - }, - "scope": 2953, - "stateMutability": "nonpayable", - "virtual": true, - "visibility": "public" - }, - { - "id": 2673, - "nodeType": "FunctionDefinition", - "src": "2542:679:4", - "body": { - "id": 2672, - "nodeType": "Block", - "src": "2679:542:4", - "statements": [ - { - "expression": { - "id": 2610, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 2606, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2604, - "src": "2689:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "arguments": [ - { - "id": 2608, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2597, - "src": "2714:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2607, - "name": "previewWithdraw", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2870, - "src": "2698:15:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$", - "typeString": "function (uint256) view returns (uint256)" - } - }, - "id": 2609, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2698:23:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "2689:32:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2611, - "nodeType": "ExpressionStatement", - "src": "2689:32:4" - }, - { - "condition": { - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 2615, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "expression": { - "id": 2612, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "2803:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2613, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "2803:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "id": 2614, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2601, - "src": "2817:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "2803:19:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 2645, - "nodeType": "IfStatement", - "src": "2799:228:4", - "trueBody": { - "id": 2644, - "nodeType": "Block", - "src": "2824:203:4", - "statements": [ - { - "assignments": [ - 2617 - ], - "declarations": [ - { - "constant": false, - "id": 2617, - "mutability": "mutable", - "name": "allowed", - "nameLocation": "2846:7:4", - "nodeType": "VariableDeclaration", - "scope": 2644, - "src": "2838:15:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2616, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "2838:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 2624, - "initialValue": { - "baseExpression": { - "baseExpression": { - "id": 2618, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31057, - "src": "2856:9:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 2620, - "indexExpression": { - "id": 2619, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2601, - "src": "2866:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "2856:16:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 2623, - "indexExpression": { - "expression": { - "id": 2621, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "2873:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2622, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "2873:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "2856:28:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "2838:46:4" - }, - { - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2631, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 2625, - "name": "allowed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2617, - "src": "2939:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "expression": { - "arguments": [ - { - "id": 2628, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "2955:7:4", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_uint256_$", - "typeString": "type(uint256)" - }, - "typeName": { - "id": 2627, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "2955:7:4", - "typeDescriptions": {} - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_type$_t_uint256_$", - "typeString": "type(uint256)" - } - ], - "id": 2626, - "name": "type", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -27, - "src": "2950:4:4", - "typeDescriptions": { - "typeIdentifier": "t_function_metatype_pure$__$returns$__$", - "typeString": "function () pure" - } - }, - "id": 2629, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2950:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_magic_meta_type_t_uint256", - "typeString": "type(uint256)" - } - }, - "id": 2630, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "memberName": "max", - "nodeType": "MemberAccess", - "src": "2950:17:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "2939:28:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 2643, - "nodeType": "IfStatement", - "src": "2935:81:4", - "trueBody": { - "expression": { - "id": 2641, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "baseExpression": { - "baseExpression": { - "id": 2632, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31057, - "src": "2969:9:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 2636, - "indexExpression": { - "id": 2633, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2601, - "src": "2979:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "2969:16:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 2637, - "indexExpression": { - "expression": { - "id": 2634, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "2986:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2635, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "2986:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "2969:28:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2640, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 2638, - "name": "allowed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2617, - "src": "3000:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "id": 2639, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2604, - "src": "3010:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "3000:16:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "2969:47:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2642, - "nodeType": "ExpressionStatement", - "src": "2969:47:4" - } - } - ] - } - }, - { - "expression": { - "arguments": [ - { - "id": 2647, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2597, - "src": "3052:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2648, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2604, - "src": "3060:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2646, - "name": "beforeWithdraw", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2944, - "src": "3037:14:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_uint256_$returns$__$", - "typeString": "function (uint256,uint256)" - } - }, - "id": 2649, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3037:30:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2650, - "nodeType": "ExpressionStatement", - "src": "3037:30:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2652, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2601, - "src": "3084:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2653, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2604, - "src": "3091:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2651, - "name": "_burn", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31407, - "src": "3078:5:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 2654, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3078:20:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2655, - "nodeType": "ExpressionStatement", - "src": "3078:20:4" - }, - { - "eventCall": { - "arguments": [ - { - "expression": { - "id": 2657, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "3123:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2658, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "3123:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2659, - "name": "receiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2599, - "src": "3135:8:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2660, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2601, - "src": "3145:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2661, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2597, - "src": "3152:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2662, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2604, - "src": "3160:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2656, - "name": "Withdraw", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2472, - "src": "3114:8:4", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_address_$_t_uint256_$_t_uint256_$returns$__$", - "typeString": "function (address,address,address,uint256,uint256)" - } - }, - "id": 2663, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3114:53:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2664, - "nodeType": "EmitStatement", - "src": "3109:58:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2668, - "name": "receiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2599, - "src": "3197:8:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2669, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2597, - "src": "3207:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 2665, - "name": "asset", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2475, - "src": "3178:5:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "id": 2667, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "safeTransfer", - "nodeType": "MemberAccess", - "referencedDeclaration": 32764, - "src": "3178:18:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_ERC20_$31408_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_ERC20_$31408_$", - "typeString": "function (contract ERC20,address,uint256)" - } - }, - "id": 2670, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3178:36:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2671, - "nodeType": "ExpressionStatement", - "src": "3178:36:4" - } - ] - }, - "functionSelector": "b460af94", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "withdraw", - "nameLocation": "2551:8:4", - "parameters": { - "id": 2602, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2597, - "mutability": "mutable", - "name": "assets", - "nameLocation": "2577:6:4", - "nodeType": "VariableDeclaration", - "scope": 2673, - "src": "2569:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2596, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "2569:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2599, - "mutability": "mutable", - "name": "receiver", - "nameLocation": "2601:8:4", - "nodeType": "VariableDeclaration", - "scope": 2673, - "src": "2593:16:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2598, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2593:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2601, - "mutability": "mutable", - "name": "owner", - "nameLocation": "2627:5:4", - "nodeType": "VariableDeclaration", - "scope": 2673, - "src": "2619:13:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2600, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2619:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "2559:79:4" - }, - "returnParameters": { - "id": 2605, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2604, - "mutability": "mutable", - "name": "shares", - "nameLocation": "2671:6:4", - "nodeType": "VariableDeclaration", - "scope": 2673, - "src": "2663:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2603, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "2663:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "2662:16:4" - }, - "scope": 2953, - "stateMutability": "nonpayable", - "virtual": true, - "visibility": "public" - }, - { - "id": 2757, - "nodeType": "FunctionDefinition", - "src": "3227:713:4", - "body": { - "id": 2756, - "nodeType": "Block", - "src": "3362:578:4", - "statements": [ - { - "condition": { - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 2687, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "expression": { - "id": 2684, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "3376:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2685, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "3376:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "id": 2686, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2679, - "src": "3390:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "3376:19:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 2717, - "nodeType": "IfStatement", - "src": "3372:228:4", - "trueBody": { - "id": 2716, - "nodeType": "Block", - "src": "3397:203:4", - "statements": [ - { - "assignments": [ - 2689 - ], - "declarations": [ - { - "constant": false, - "id": 2689, - "mutability": "mutable", - "name": "allowed", - "nameLocation": "3419:7:4", - "nodeType": "VariableDeclaration", - "scope": 2716, - "src": "3411:15:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2688, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "3411:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 2696, - "initialValue": { - "baseExpression": { - "baseExpression": { - "id": 2690, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31057, - "src": "3429:9:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 2692, - "indexExpression": { - "id": 2691, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2679, - "src": "3439:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3429:16:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 2695, - "indexExpression": { - "expression": { - "id": 2693, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "3446:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2694, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "3446:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3429:28:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "3411:46:4" - }, - { - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2703, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 2697, - "name": "allowed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2689, - "src": "3512:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "expression": { - "arguments": [ - { - "id": 2700, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "3528:7:4", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_uint256_$", - "typeString": "type(uint256)" - }, - "typeName": { - "id": 2699, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "3528:7:4", - "typeDescriptions": {} - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_type$_t_uint256_$", - "typeString": "type(uint256)" - } - ], - "id": 2698, - "name": "type", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -27, - "src": "3523:4:4", - "typeDescriptions": { - "typeIdentifier": "t_function_metatype_pure$__$returns$__$", - "typeString": "function () pure" - } - }, - "id": 2701, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3523:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_magic_meta_type_t_uint256", - "typeString": "type(uint256)" - } - }, - "id": 2702, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "memberName": "max", - "nodeType": "MemberAccess", - "src": "3523:17:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "3512:28:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 2715, - "nodeType": "IfStatement", - "src": "3508:81:4", - "trueBody": { - "expression": { - "id": 2713, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "baseExpression": { - "baseExpression": { - "id": 2704, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31057, - "src": "3542:9:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 2708, - "indexExpression": { - "id": 2705, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2679, - "src": "3552:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3542:16:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 2709, - "indexExpression": { - "expression": { - "id": 2706, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "3559:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2707, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "3559:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "3542:28:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2712, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 2710, - "name": "allowed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2689, - "src": "3573:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "id": 2711, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2675, - "src": "3583:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "3573:16:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "3542:47:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2714, - "nodeType": "ExpressionStatement", - "src": "3542:47:4" - } - } - ] - } - }, - { - "expression": { - "arguments": [ - { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2726, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "components": [ - { - "id": 2723, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 2719, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2682, - "src": "3693:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "arguments": [ - { - "id": 2721, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2675, - "src": "3716:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2720, - "name": "previewRedeem", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2882, - "src": "3702:13:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$", - "typeString": "function (uint256) view returns (uint256)" - } - }, - "id": 2722, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3702:21:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "3693:30:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 2724, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "3692:32:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "hexValue": "30", - "id": 2725, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "3728:1:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "3692:37:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "hexValue": "5a45524f5f415353455453", - "id": 2727, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "3731:13:4", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_bf169ab2ef12d57708bb5afe72ea54ba3ad2eccb91dd95f37571afa377c52483", - "typeString": "literal_string \"ZERO_ASSETS\"" - }, - "value": "ZERO_ASSETS" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_bf169ab2ef12d57708bb5afe72ea54ba3ad2eccb91dd95f37571afa377c52483", - "typeString": "literal_string \"ZERO_ASSETS\"" - } - ], - "id": 2718, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - -18, - -18 - ], - "referencedDeclaration": -18, - "src": "3684:7:4", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 2728, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3684:61:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2729, - "nodeType": "ExpressionStatement", - "src": "3684:61:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2731, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2682, - "src": "3771:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2732, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2675, - "src": "3779:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2730, - "name": "beforeWithdraw", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2944, - "src": "3756:14:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_uint256_$returns$__$", - "typeString": "function (uint256,uint256)" - } - }, - "id": 2733, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3756:30:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2734, - "nodeType": "ExpressionStatement", - "src": "3756:30:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2736, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2679, - "src": "3803:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2737, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2675, - "src": "3810:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2735, - "name": "_burn", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31407, - "src": "3797:5:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 2738, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3797:20:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2739, - "nodeType": "ExpressionStatement", - "src": "3797:20:4" - }, - { - "eventCall": { - "arguments": [ - { - "expression": { - "id": 2741, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "3842:3:4", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 2742, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "3842:10:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2743, - "name": "receiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2677, - "src": "3854:8:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2744, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2679, - "src": "3864:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2745, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2682, - "src": "3871:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2746, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2675, - "src": "3879:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2740, - "name": "Withdraw", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2472, - "src": "3833:8:4", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_address_$_t_uint256_$_t_uint256_$returns$__$", - "typeString": "function (address,address,address,uint256,uint256)" - } - }, - "id": 2747, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3833:53:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2748, - "nodeType": "EmitStatement", - "src": "3828:58:4" - }, - { - "expression": { - "arguments": [ - { - "id": 2752, - "name": "receiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2677, - "src": "3916:8:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 2753, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2682, - "src": "3926:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 2749, - "name": "asset", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2475, - "src": "3897:5:4", - "typeDescriptions": { - "typeIdentifier": "t_contract$_ERC20_$31408", - "typeString": "contract ERC20" - } - }, - "id": 2751, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "safeTransfer", - "nodeType": "MemberAccess", - "referencedDeclaration": 32764, - "src": "3897:18:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_ERC20_$31408_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_ERC20_$31408_$", - "typeString": "function (contract ERC20,address,uint256)" - } - }, - "id": 2754, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "3897:36:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 2755, - "nodeType": "ExpressionStatement", - "src": "3897:36:4" - } - ] - }, - "functionSelector": "ba087652", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "redeem", - "nameLocation": "3236:6:4", - "parameters": { - "id": 2680, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2675, - "mutability": "mutable", - "name": "shares", - "nameLocation": "3260:6:4", - "nodeType": "VariableDeclaration", - "scope": 2757, - "src": "3252:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2674, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "3252:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2677, - "mutability": "mutable", - "name": "receiver", - "nameLocation": "3284:8:4", - "nodeType": "VariableDeclaration", - "scope": 2757, - "src": "3276:16:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2676, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "3276:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2679, - "mutability": "mutable", - "name": "owner", - "nameLocation": "3310:5:4", - "nodeType": "VariableDeclaration", - "scope": 2757, - "src": "3302:13:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2678, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "3302:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "3242:79:4" - }, - "returnParameters": { - "id": 2683, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2682, - "mutability": "mutable", - "name": "assets", - "nameLocation": "3354:6:4", - "nodeType": "VariableDeclaration", - "scope": 2757, - "src": "3346:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2681, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "3346:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "3345:16:4" - }, - "scope": 2953, - "stateMutability": "nonpayable", - "virtual": true, - "visibility": "public" - }, - { - "id": 2762, - "nodeType": "FunctionDefinition", - "src": "4130:61:4", - "functionSelector": "01e1d114", - "implemented": false, - "kind": "function", - "modifiers": [], - "name": "totalAssets", - "nameLocation": "4139:11:4", - "parameters": { - "id": 2758, - "nodeType": "ParameterList", - "parameters": [], - "src": "4150:2:4" - }, - "returnParameters": { - "id": 2761, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2760, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2762, - "src": "4182:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2759, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4182:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4181:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2786, - "nodeType": "FunctionDefinition", - "src": "4197:257:4", - "body": { - "id": 2785, - "nodeType": "Block", - "src": "4276:178:4", - "statements": [ - { - "assignments": [ - 2770 - ], - "declarations": [ - { - "constant": false, - "id": 2770, - "mutability": "mutable", - "name": "supply", - "nameLocation": "4294:6:4", - "nodeType": "VariableDeclaration", - "scope": 2785, - "src": "4286:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2769, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4286:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 2772, - "initialValue": { - "id": 2771, - "name": "totalSupply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31047, - "src": "4303:11:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "4286:28:4" - }, - { - "expression": { - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2775, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 2773, - "name": "supply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2770, - "src": "4384:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "hexValue": "30", - "id": 2774, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "4394:1:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "4384:11:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseExpression": { - "arguments": [ - { - "id": 2779, - "name": "supply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2770, - "src": "4425:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "arguments": [], - "expression": { - "argumentTypes": [], - "id": 2780, - "name": "totalAssets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2762, - "src": "4433:11:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", - "typeString": "function () view returns (uint256)" - } - }, - "id": 2781, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "4433:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 2777, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2764, - "src": "4407:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2778, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "mulDivDown", - "nodeType": "MemberAccess", - "referencedDeclaration": 32285, - "src": "4407:17:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", - "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" - } - }, - "id": 2782, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "4407:40:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2783, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "Conditional", - "src": "4384:63:4", - "trueExpression": { - "id": 2776, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2764, - "src": "4398:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2768, - "id": 2784, - "nodeType": "Return", - "src": "4377:70:4" - } - ] - }, - "functionSelector": "c6e6f592", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "convertToShares", - "nameLocation": "4206:15:4", - "parameters": { - "id": 2765, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2764, - "mutability": "mutable", - "name": "assets", - "nameLocation": "4230:6:4", - "nodeType": "VariableDeclaration", - "scope": 2786, - "src": "4222:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2763, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4222:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4221:16:4" - }, - "returnParameters": { - "id": 2768, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2767, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2786, - "src": "4267:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2766, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4267:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4266:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2810, - "nodeType": "FunctionDefinition", - "src": "4460:257:4", - "body": { - "id": 2809, - "nodeType": "Block", - "src": "4539:178:4", - "statements": [ - { - "assignments": [ - 2794 - ], - "declarations": [ - { - "constant": false, - "id": 2794, - "mutability": "mutable", - "name": "supply", - "nameLocation": "4557:6:4", - "nodeType": "VariableDeclaration", - "scope": 2809, - "src": "4549:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2793, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4549:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 2796, - "initialValue": { - "id": 2795, - "name": "totalSupply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31047, - "src": "4566:11:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "4549:28:4" - }, - { - "expression": { - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2799, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 2797, - "name": "supply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2794, - "src": "4647:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "hexValue": "30", - "id": 2798, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "4657:1:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "4647:11:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseExpression": { - "arguments": [ - { - "arguments": [], - "expression": { - "argumentTypes": [], - "id": 2803, - "name": "totalAssets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2762, - "src": "4688:11:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", - "typeString": "function () view returns (uint256)" - } - }, - "id": 2804, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "4688:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2805, - "name": "supply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2794, - "src": "4703:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 2801, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2788, - "src": "4670:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2802, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "mulDivDown", - "nodeType": "MemberAccess", - "referencedDeclaration": 32285, - "src": "4670:17:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", - "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" - } - }, - "id": 2806, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "4670:40:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2807, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "Conditional", - "src": "4647:63:4", - "trueExpression": { - "id": 2800, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2788, - "src": "4661:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2792, - "id": 2808, - "nodeType": "Return", - "src": "4640:70:4" - } - ] - }, - "functionSelector": "07a2d13a", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "convertToAssets", - "nameLocation": "4469:15:4", - "parameters": { - "id": 2789, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2788, - "mutability": "mutable", - "name": "shares", - "nameLocation": "4493:6:4", - "nodeType": "VariableDeclaration", - "scope": 2810, - "src": "4485:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2787, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4485:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4484:16:4" - }, - "returnParameters": { - "id": 2792, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2791, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2810, - "src": "4530:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2790, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4530:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4529:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2822, - "nodeType": "FunctionDefinition", - "src": "4723:125:4", - "body": { - "id": 2821, - "nodeType": "Block", - "src": "4801:47:4", - "statements": [ - { - "expression": { - "arguments": [ - { - "id": 2818, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2812, - "src": "4834:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2817, - "name": "convertToShares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2786, - "src": "4818:15:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$", - "typeString": "function (uint256) view returns (uint256)" - } - }, - "id": 2819, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "4818:23:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2816, - "id": 2820, - "nodeType": "Return", - "src": "4811:30:4" - } - ] - }, - "functionSelector": "ef8b30f7", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "previewDeposit", - "nameLocation": "4732:14:4", - "parameters": { - "id": 2813, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2812, - "mutability": "mutable", - "name": "assets", - "nameLocation": "4755:6:4", - "nodeType": "VariableDeclaration", - "scope": 2822, - "src": "4747:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2811, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4747:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4746:16:4" - }, - "returnParameters": { - "id": 2816, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2815, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2822, - "src": "4792:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2814, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4792:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4791:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2846, - "nodeType": "FunctionDefinition", - "src": "4854:251:4", - "body": { - "id": 2845, - "nodeType": "Block", - "src": "4929:176:4", - "statements": [ - { - "assignments": [ - 2830 - ], - "declarations": [ - { - "constant": false, - "id": 2830, - "mutability": "mutable", - "name": "supply", - "nameLocation": "4947:6:4", - "nodeType": "VariableDeclaration", - "scope": 2845, - "src": "4939:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2829, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4939:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 2832, - "initialValue": { - "id": 2831, - "name": "totalSupply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31047, - "src": "4956:11:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "4939:28:4" - }, - { - "expression": { - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2835, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 2833, - "name": "supply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2830, - "src": "5037:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "hexValue": "30", - "id": 2834, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "5047:1:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "5037:11:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseExpression": { - "arguments": [ - { - "arguments": [], - "expression": { - "argumentTypes": [], - "id": 2839, - "name": "totalAssets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2762, - "src": "5076:11:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", - "typeString": "function () view returns (uint256)" - } - }, - "id": 2840, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "5076:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "id": 2841, - "name": "supply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2830, - "src": "5091:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 2837, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2824, - "src": "5060:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2838, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "mulDivUp", - "nodeType": "MemberAccess", - "referencedDeclaration": 32298, - "src": "5060:15:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", - "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" - } - }, - "id": 2842, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "5060:38:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2843, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "Conditional", - "src": "5037:61:4", - "trueExpression": { - "id": 2836, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2824, - "src": "5051:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2828, - "id": 2844, - "nodeType": "Return", - "src": "5030:68:4" - } - ] - }, - "functionSelector": "b3d7f6b9", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "previewMint", - "nameLocation": "4863:11:4", - "parameters": { - "id": 2825, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2824, - "mutability": "mutable", - "name": "shares", - "nameLocation": "4883:6:4", - "nodeType": "VariableDeclaration", - "scope": 2846, - "src": "4875:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2823, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4875:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4874:16:4" - }, - "returnParameters": { - "id": 2828, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2827, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2846, - "src": "4920:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2826, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4920:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4919:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2870, - "nodeType": "FunctionDefinition", - "src": "5111:255:4", - "body": { - "id": 2869, - "nodeType": "Block", - "src": "5190:176:4", - "statements": [ - { - "assignments": [ - 2854 - ], - "declarations": [ - { - "constant": false, - "id": 2854, - "mutability": "mutable", - "name": "supply", - "nameLocation": "5208:6:4", - "nodeType": "VariableDeclaration", - "scope": 2869, - "src": "5200:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2853, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5200:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 2856, - "initialValue": { - "id": 2855, - "name": "totalSupply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31047, - "src": "5217:11:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "5200:28:4" - }, - { - "expression": { - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 2859, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 2857, - "name": "supply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2854, - "src": "5298:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "hexValue": "30", - "id": 2858, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "5308:1:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "5298:11:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseExpression": { - "arguments": [ - { - "id": 2863, - "name": "supply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2854, - "src": "5337:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "arguments": [], - "expression": { - "argumentTypes": [], - "id": 2864, - "name": "totalAssets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2762, - "src": "5345:11:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", - "typeString": "function () view returns (uint256)" - } - }, - "id": 2865, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "5345:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 2861, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2848, - "src": "5321:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2862, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "mulDivUp", - "nodeType": "MemberAccess", - "referencedDeclaration": 32298, - "src": "5321:15:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", - "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" - } - }, - "id": 2866, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "5321:38:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 2867, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "Conditional", - "src": "5298:61:4", - "trueExpression": { - "id": 2860, - "name": "assets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2848, - "src": "5312:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2852, - "id": 2868, - "nodeType": "Return", - "src": "5291:68:4" - } - ] - }, - "functionSelector": "0a28a477", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "previewWithdraw", - "nameLocation": "5120:15:4", - "parameters": { - "id": 2849, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2848, - "mutability": "mutable", - "name": "assets", - "nameLocation": "5144:6:4", - "nodeType": "VariableDeclaration", - "scope": 2870, - "src": "5136:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2847, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5136:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "5135:16:4" - }, - "returnParameters": { - "id": 2852, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2851, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2870, - "src": "5181:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2850, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5181:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "5180:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2882, - "nodeType": "FunctionDefinition", - "src": "5372:124:4", - "body": { - "id": 2881, - "nodeType": "Block", - "src": "5449:47:4", - "statements": [ - { - "expression": { - "arguments": [ - { - "id": 2878, - "name": "shares", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2872, - "src": "5482:6:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2877, - "name": "convertToAssets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2810, - "src": "5466:15:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$", - "typeString": "function (uint256) view returns (uint256)" - } - }, - "id": 2879, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "5466:23:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2876, - "id": 2880, - "nodeType": "Return", - "src": "5459:30:4" - } - ] - }, - "functionSelector": "4cdad506", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "previewRedeem", - "nameLocation": "5381:13:4", - "parameters": { - "id": 2873, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2872, - "mutability": "mutable", - "name": "shares", - "nameLocation": "5403:6:4", - "nodeType": "VariableDeclaration", - "scope": 2882, - "src": "5395:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2871, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5395:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "5394:16:4" - }, - "returnParameters": { - "id": 2876, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2875, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2882, - "src": "5440:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2874, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5440:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "5439:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2896, - "nodeType": "FunctionDefinition", - "src": "5693:108:4", - "body": { - "id": 2895, - "nodeType": "Block", - "src": "5760:41:4", - "statements": [ - { - "expression": { - "expression": { - "arguments": [ - { - "id": 2891, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "5782:7:4", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_uint256_$", - "typeString": "type(uint256)" - }, - "typeName": { - "id": 2890, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5782:7:4", - "typeDescriptions": {} - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_type$_t_uint256_$", - "typeString": "type(uint256)" - } - ], - "id": 2889, - "name": "type", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -27, - "src": "5777:4:4", - "typeDescriptions": { - "typeIdentifier": "t_function_metatype_pure$__$returns$__$", - "typeString": "function () pure" - } - }, - "id": 2892, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "5777:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_magic_meta_type_t_uint256", - "typeString": "type(uint256)" - } - }, - "id": 2893, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "memberName": "max", - "nodeType": "MemberAccess", - "src": "5777:17:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2888, - "id": 2894, - "nodeType": "Return", - "src": "5770:24:4" - } - ] - }, - "functionSelector": "402d267d", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "maxDeposit", - "nameLocation": "5702:10:4", - "parameters": { - "id": 2885, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2884, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2896, - "src": "5713:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2883, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "5713:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "5712:9:4" - }, - "returnParameters": { - "id": 2888, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2887, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2896, - "src": "5751:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2886, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5751:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "5750:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2910, - "nodeType": "FunctionDefinition", - "src": "5807:105:4", - "body": { - "id": 2909, - "nodeType": "Block", - "src": "5871:41:4", - "statements": [ - { - "expression": { - "expression": { - "arguments": [ - { - "id": 2905, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "5893:7:4", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_uint256_$", - "typeString": "type(uint256)" - }, - "typeName": { - "id": 2904, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5893:7:4", - "typeDescriptions": {} - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_type$_t_uint256_$", - "typeString": "type(uint256)" - } - ], - "id": 2903, - "name": "type", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -27, - "src": "5888:4:4", - "typeDescriptions": { - "typeIdentifier": "t_function_metatype_pure$__$returns$__$", - "typeString": "function () pure" - } - }, - "id": 2906, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "5888:13:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_magic_meta_type_t_uint256", - "typeString": "type(uint256)" - } - }, - "id": 2907, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "memberName": "max", - "nodeType": "MemberAccess", - "src": "5888:17:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2902, - "id": 2908, - "nodeType": "Return", - "src": "5881:24:4" - } - ] - }, - "functionSelector": "c63d75b6", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "maxMint", - "nameLocation": "5816:7:4", - "parameters": { - "id": 2899, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2898, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2910, - "src": "5824:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2897, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "5824:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "5823:9:4" - }, - "returnParameters": { - "id": 2902, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2901, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2910, - "src": "5862:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2900, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5862:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "5861:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2924, - "nodeType": "FunctionDefinition", - "src": "5918:131:4", - "body": { - "id": 2923, - "nodeType": "Block", - "src": "5992:57:4", - "statements": [ - { - "expression": { - "arguments": [ - { - "baseExpression": { - "id": 2918, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31051, - "src": "6025:9:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 2920, - "indexExpression": { - "id": 2919, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2912, - "src": "6035:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "6025:16:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 2917, - "name": "convertToAssets", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2810, - "src": "6009:15:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$", - "typeString": "function (uint256) view returns (uint256)" - } - }, - "id": 2921, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "6009:33:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2916, - "id": 2922, - "nodeType": "Return", - "src": "6002:40:4" - } - ] - }, - "functionSelector": "ce96cb77", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "maxWithdraw", - "nameLocation": "5927:11:4", - "parameters": { - "id": 2913, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2912, - "mutability": "mutable", - "name": "owner", - "nameLocation": "5947:5:4", - "nodeType": "VariableDeclaration", - "scope": 2924, - "src": "5939:13:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2911, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "5939:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "5938:15:4" - }, - "returnParameters": { - "id": 2916, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2915, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2924, - "src": "5983:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2914, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5983:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "5982:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2936, - "nodeType": "FunctionDefinition", - "src": "6055:112:4", - "body": { - "id": 2935, - "nodeType": "Block", - "src": "6127:40:4", - "statements": [ - { - "expression": { - "baseExpression": { - "id": 2931, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 31051, - "src": "6144:9:4", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 2933, - "indexExpression": { - "id": 2932, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 2926, - "src": "6154:5:4", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "6144:16:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 2930, - "id": 2934, - "nodeType": "Return", - "src": "6137:23:4" - } - ] - }, - "functionSelector": "d905777e", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "maxRedeem", - "nameLocation": "6064:9:4", - "parameters": { - "id": 2927, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2926, - "mutability": "mutable", - "name": "owner", - "nameLocation": "6082:5:4", - "nodeType": "VariableDeclaration", - "scope": 2936, - "src": "6074:13:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2925, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "6074:7:4", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "6073:15:4" - }, - "returnParameters": { - "id": 2930, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2929, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 2936, - "src": "6118:7:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2928, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "6118:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "6117:9:4" - }, - "scope": 2953, - "stateMutability": "view", - "virtual": true, - "visibility": "public" - }, - { - "id": 2944, - "nodeType": "FunctionDefinition", - "src": "6359:75:4", - "body": { - "id": 2943, - "nodeType": "Block", - "src": "6432:2:4", - "statements": [] - }, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "beforeWithdraw", - "nameLocation": "6368:14:4", - "parameters": { - "id": 2941, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2938, - "mutability": "mutable", - "name": "assets", - "nameLocation": "6391:6:4", - "nodeType": "VariableDeclaration", - "scope": 2944, - "src": "6383:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2937, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "6383:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2940, - "mutability": "mutable", - "name": "shares", - "nameLocation": "6407:6:4", - "nodeType": "VariableDeclaration", - "scope": 2944, - "src": "6399:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2939, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "6399:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "6382:32:4" - }, - "returnParameters": { - "id": 2942, - "nodeType": "ParameterList", - "parameters": [], - "src": "6432:0:4" - }, - "scope": 2953, - "stateMutability": "nonpayable", - "virtual": true, - "visibility": "internal" - }, - { - "id": 2952, - "nodeType": "FunctionDefinition", - "src": "6440:73:4", - "body": { - "id": 2951, - "nodeType": "Block", - "src": "6511:2:4", - "statements": [] - }, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "afterDeposit", - "nameLocation": "6449:12:4", - "parameters": { - "id": 2949, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 2946, - "mutability": "mutable", - "name": "assets", - "nameLocation": "6470:6:4", - "nodeType": "VariableDeclaration", - "scope": 2952, - "src": "6462:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2945, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "6462:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 2948, - "mutability": "mutable", - "name": "shares", - "nameLocation": "6486:6:4", - "nodeType": "VariableDeclaration", - "scope": 2952, - "src": "6478:14:4", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 2947, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "6478:7:4", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "6461:32:4" - }, - "returnParameters": { - "id": 2950, - "nodeType": "ParameterList", - "parameters": [], - "src": "6511:0:4" - }, - "scope": 2953, - "stateMutability": "nonpayable", - "virtual": true, - "visibility": "internal" - } - ], - "abstract": true, - "baseContracts": [ - { - "baseName": { - "id": 2442, - "name": "ERC20", - "nodeType": "IdentifierPath", - "referencedDeclaration": 31408, - "src": "424:5:4" - }, - "id": 2443, - "nodeType": "InheritanceSpecifier", - "src": "424:5:4" - } - ], - "canonicalName": "ERC4626", - "contractDependencies": [], - "contractKind": "contract", - "documentation": { - "id": 2441, - "nodeType": "StructuredDocumentation", - "src": "240:155:4", - "text": "@notice Minimal ERC4626 tokenized Vault implementation.\n @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/mixins/ERC4626.sol)" - }, - "fullyImplemented": false, - "linearizedBaseContracts": [ - 2953, - 31408 - ], - "name": "ERC4626", - "nameLocation": "413:7:4", - "scope": 2954, - "usedErrors": [] - } - ], - "license": "AGPL-3.0-only" -} diff --git a/ethers-solc/test-data/ast/base_constructor_call.json b/ethers-solc/test-data/ast/base_constructor_call.json new file mode 100644 index 00000000..774981fa --- /dev/null +++ b/ethers-solc/test-data/ast/base_constructor_call.json @@ -0,0 +1,226 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "A": + [ + 7 + ], + "C": + [ + 17 + ] + }, + "id": 18, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "A", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 7, + "linearizedBaseContracts": + [ + 7 + ], + "name": "A", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 5, + "nodeType": "Block", + "src": "31:2:1", + "statements": [] + }, + "id": 6, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 3, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 2, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6, + "src": "25:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 1, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "25:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "24:6:1" + }, + "returnParameters": + { + "id": 4, + "nodeType": "ParameterList", + "parameters": [], + "src": "31:0:1" + }, + "scope": 7, + "src": "13:20:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 18, + "src": "0:35:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": + [ + { + "baseName": + { + "id": 8, + "name": "A", + "nameLocations": + [ + "50:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 7, + "src": "50:1:1" + }, + "id": 9, + "nodeType": "InheritanceSpecifier", + "src": "50:1:1" + } + ], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 17, + "linearizedBaseContracts": + [ + 17, + 7 + ], + "name": "C", + "nameLocation": "45:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 15, + "nodeType": "Block", + "src": "73:2:1", + "statements": [] + }, + "id": 16, + "implemented": true, + "kind": "constructor", + "modifiers": + [ + { + "arguments": + [ + { + "hexValue": "32", + "id": 12, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "70:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + } + ], + "id": 13, + "kind": "baseConstructorSpecifier", + "modifierName": + { + "id": 11, + "name": "A", + "nameLocations": + [ + "68:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 7, + "src": "68:1:1" + }, + "nodeType": "ModifierInvocation", + "src": "68:4:1" + } + ], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 10, + "nodeType": "ParameterList", + "parameters": [], + "src": "65:2:1" + }, + "returnParameters": + { + "id": 14, + "nodeType": "ParameterList", + "parameters": [], + "src": "73:0:1" + }, + "scope": 17, + "src": "54:21:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 18, + "src": "36:41:1", + "usedErrors": [] + } + ], + "src": "0:78:1" +} diff --git a/ethers-solc/test-data/ast/bit_not.json b/ethers-solc/test-data/ast/bit_not.json new file mode 100644 index 00000000..1f9708a9 --- /dev/null +++ b/ethers-solc/test-data/ast/bit_not.json @@ -0,0 +1,390 @@ +{ + "absolutePath": "Bytes.sol", + "exportedSymbols": + { + "Bytes": + [ + 25 + ] + }, + "id": 26, + "license": "UNLICENSED", + "nodeType": "SourceUnit", + "nodes": + [ + { + "id": 1, + "literals": + [ + "solidity", + "0.8", + ".13" + ], + "nodeType": "PragmaDirective", + "src": "40:23:0" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Bytes", + "contractDependencies": [], + "contractKind": "library", + "fullyImplemented": true, + "id": 25, + "linearizedBaseContracts": + [ + 25 + ], + "name": "Bytes", + "nameLocation": "73:5:0", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 23, + "nodeType": "Block", + "src": "207:164:0", + "statements": + [ + { + "expression": + { + "commonType": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + }, + "id": 21, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": + { + "id": 12, + "name": "_packedBools", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "314:12:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": + { + "id": 20, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "~", + "prefix": true, + "src": "329:28:0", + "subExpression": + { + "components": + [ + { + "commonType": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + }, + "id": 18, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": + { + "arguments": + [ + { + "hexValue": "31", + "id": 15, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "339:1:0", + "typeDescriptions": + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "expression": + { + "argumentTypes": + [ + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + } + ], + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "331:7:0", + "typeDescriptions": + { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + }, + "typeName": + { + "id": 13, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "331:7:0", + "typeDescriptions": {} + } + }, + "id": 16, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "331:10:0", + "tryCall": false, + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": + { + "id": 17, + "name": "_boolNumber", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "345:11:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "src": "331:25:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + } + ], + "id": 19, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "330:27:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "src": "314:43:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "functionReturnParameters": 11, + "id": 22, + "nodeType": "Return", + "src": "307:50:0" + } + ] + }, + "id": 24, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setBoolean", + "nameLocation": "92:10:0", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 8, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 3, + "mutability": "mutable", + "name": "_packedBools", + "nameLocation": "116:12:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "108:20:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + }, + "typeName": + { + "id": 2, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "108:7:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5, + "mutability": "mutable", + "name": "_boolNumber", + "nameLocation": "142:11:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "134:19:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + }, + "typeName": + { + "id": 4, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "134:7:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 7, + "mutability": "mutable", + "name": "_value", + "nameLocation": "164:6:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "159:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": + { + "id": 6, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "159:4:0", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "102:72:0" + }, + "returnParameters": + { + "id": 11, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 10, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "198:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + }, + "typeName": + { + "id": 9, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "198:7:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "visibility": "internal" + } + ], + "src": "197:9:0" + }, + "scope": 25, + "src": "83:288:0", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 26, + "src": "65:308:0", + "usedErrors": [] + } + ], + "src": "40:334:0" +} \ No newline at end of file diff --git a/ethers-solc/test-data/ast/call.json b/ethers-solc/test-data/ast/call.json new file mode 100644 index 00000000..9d318604 --- /dev/null +++ b/ethers-solc/test-data/ast/call.json @@ -0,0 +1,171 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "37:59:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "56:34:1", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "arguments": + [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "67:1:1", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "70:1:1", + "type": "", + "value": "1" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "73:1:1", + "type": "", + "value": "2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "76:1:1", + "type": "", + "value": "3" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "79:1:1", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "82:1:1", + "type": "", + "value": "5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "85:1:1", + "type": "", + "value": "6" + } + ], + "functionName": + { + "name": "call", + "nodeType": "YulIdentifier", + "src": "62:4:1" + }, + "nodeType": "YulFunctionCall", + "src": "62:25:1" + } + ], + "functionName": + { + "name": "pop", + "nodeType": "YulIdentifier", + "src": "58:3:1" + }, + "nodeType": "YulFunctionCall", + "src": "58:30:1" + }, + "nodeType": "YulExpressionStatement", + "src": "58:30:1" + } + ] + }, + "evmVersion": "london", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "47:43:1" + } + ] + }, + "functionSelector": "b582ec5f", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "j", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "37:0:1" + }, + "scope": 6, + "src": "17:79:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:98:1", + "usedErrors": [] + } + ], + "src": "0:99:1" +} diff --git a/ethers-solc/test-data/ast/constructor.json b/ethers-solc/test-data/ast/constructor.json new file mode 100644 index 00000000..9ac4ac9c --- /dev/null +++ b/ethers-solc/test-data/ast/constructor.json @@ -0,0 +1,73 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 5 + ] + }, + "id": 6, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "28:4:1", + "statements": [] + }, + "id": 4, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "25:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "28:0:1" + }, + "scope": 5, + "src": "14:18:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 6, + "src": "0:34:1", + "usedErrors": [] + } + ], + "src": "0:35:1" +} diff --git a/ethers-solc/test-data/ast/contract_dep_order.json b/ethers-solc/test-data/ast/contract_dep_order.json new file mode 100644 index 00000000..83865d7d --- /dev/null +++ b/ethers-solc/test-data/ast/contract_dep_order.json @@ -0,0 +1,218 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "A": + [ + 1 + ], + "B": + [ + 4 + ], + "C": + [ + 7 + ], + "D": + [ + 10 + ], + "E": + [ + 13 + ] + }, + "id": 14, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "A", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 1, + "linearizedBaseContracts": + [ + 1 + ], + "name": "A", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 14, + "src": "0:14:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": + [ + { + "baseName": + { + "id": 2, + "name": "A", + "nameLocations": + [ + "29:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1, + "src": "29:1:1" + }, + "id": 3, + "nodeType": "InheritanceSpecifier", + "src": "29:1:1" + } + ], + "canonicalName": "B", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 4, + "linearizedBaseContracts": + [ + 4, + 1 + ], + "name": "B", + "nameLocation": "24:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 14, + "src": "15:19:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": + [ + { + "baseName": + { + "id": 5, + "name": "B", + "nameLocations": + [ + "49:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4, + "src": "49:1:1" + }, + "id": 6, + "nodeType": "InheritanceSpecifier", + "src": "49:1:1" + } + ], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 7, + "linearizedBaseContracts": + [ + 7, + 4, + 1 + ], + "name": "C", + "nameLocation": "44:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 14, + "src": "35:19:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": + [ + { + "baseName": + { + "id": 8, + "name": "C", + "nameLocations": + [ + "69:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 7, + "src": "69:1:1" + }, + "id": 9, + "nodeType": "InheritanceSpecifier", + "src": "69:1:1" + } + ], + "canonicalName": "D", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 10, + "linearizedBaseContracts": + [ + 10, + 7, + 4, + 1 + ], + "name": "D", + "nameLocation": "64:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 14, + "src": "55:19:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": + [ + { + "baseName": + { + "id": 11, + "name": "D", + "nameLocations": + [ + "89:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 10, + "src": "89:1:1" + }, + "id": 12, + "nodeType": "InheritanceSpecifier", + "src": "89:1:1" + } + ], + "canonicalName": "E", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 13, + "linearizedBaseContracts": + [ + 13, + 10, + 7, + 4, + 1 + ], + "name": "E", + "nameLocation": "84:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 14, + "src": "75:19:1", + "usedErrors": [] + } + ], + "src": "0:95:1" +} diff --git a/ethers-solc/test-data/ast/documentation_1.json b/ethers-solc/test-data/ast/documentation_1.json new file mode 100644 index 00000000..3d51055a --- /dev/null +++ b/ethers-solc/test-data/ast/documentation_1.json @@ -0,0 +1,43 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 2 + ] + }, + "id": 3, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "documentation": + { + "id": 1, + "nodeType": "StructuredDocumentation", + "src": "0:27:1", + "text": "This contract is empty" + }, + "fullyImplemented": true, + "id": 2, + "linearizedBaseContracts": + [ + 2 + ], + "name": "C", + "nameLocation": "37:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 3, + "src": "28:13:1", + "usedErrors": [] + } + ], + "src": "28:14:1" +} diff --git a/ethers-solc/test-data/ast/documentation_2.json b/ethers-solc/test-data/ast/documentation_2.json new file mode 100644 index 00000000..822c5eac --- /dev/null +++ b/ethers-solc/test-data/ast/documentation_2.json @@ -0,0 +1,43 @@ +{ + "absolutePath": "b", + "exportedSymbols": + { + "C": + [ + 5 + ] + }, + "id": 6, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "documentation": + { + "id": 4, + "nodeType": "StructuredDocumentation", + "src": "0:61:2", + "text": "This contract is empty\nand has a line-breaking comment." + }, + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "C", + "nameLocation": "71:1:2", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 6, + "src": "62:13:2", + "usedErrors": [] + } + ], + "src": "62:14:2" +} diff --git a/ethers-solc/test-data/ast/documentation_3.json b/ethers-solc/test-data/ast/documentation_3.json new file mode 100644 index 00000000..dee8b83f --- /dev/null +++ b/ethers-solc/test-data/ast/documentation_3.json @@ -0,0 +1,179 @@ +{ + "absolutePath": "c", + "exportedSymbols": + { + "C": + [ + 23 + ] + }, + "id": 24, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 23, + "linearizedBaseContracts": + [ + 23 + ], + "name": "C", + "nameLocation": "9:1:3", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "constant": false, + "documentation": + { + "id": 7, + "nodeType": "StructuredDocumentation", + "src": "15:32:3", + "text": "Some comment on state var." + }, + "functionSelector": "c19d93fb", + "id": 9, + "mutability": "mutable", + "name": "state", + "nameLocation": "60:5:3", + "nodeType": "VariableDeclaration", + "scope": 23, + "src": "48:17:3", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 8, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "48:4:3", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "public" + }, + { + "anonymous": false, + "documentation": + { + "id": 10, + "nodeType": "StructuredDocumentation", + "src": "69:26:3", + "text": "Some comment on Evt." + }, + "eventSelector": "a69007916fc1145953e5a7032d7c3eab4b8e2f33ec59b0f71e732904eeede3a4", + "id": 12, + "name": "Evt", + "nameLocation": "102:3:3", + "nodeType": "EventDefinition", + "parameters": + { + "id": 11, + "nodeType": "ParameterList", + "parameters": [], + "src": "105:2:3" + }, + "src": "96:12:3" + }, + { + "body": + { + "id": 16, + "nodeType": "Block", + "src": "153:6:3", + "statements": + [ + { + "id": 15, + "nodeType": "PlaceholderStatement", + "src": "155:1:3" + } + ] + }, + "documentation": + { + "id": 13, + "nodeType": "StructuredDocumentation", + "src": "111:26:3", + "text": "Some comment on mod." + }, + "id": 17, + "name": "mod", + "nameLocation": "147:3:3", + "nodeType": "ModifierDefinition", + "parameters": + { + "id": 14, + "nodeType": "ParameterList", + "parameters": [], + "src": "150:2:3" + }, + "src": "138:21:3", + "virtual": false, + "visibility": "internal" + }, + { + "body": + { + "id": 21, + "nodeType": "Block", + "src": "209:2:3", + "statements": [] + }, + "documentation": + { + "id": 18, + "nodeType": "StructuredDocumentation", + "src": "162:25:3", + "text": "Some comment on fn." + }, + "functionSelector": "a4a2c40b", + "id": 22, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "fn", + "nameLocation": "197:2:3", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 19, + "nodeType": "ParameterList", + "parameters": [], + "src": "199:2:3" + }, + "returnParameters": + { + "id": 20, + "nodeType": "ParameterList", + "parameters": [], + "src": "209:0:3" + }, + "scope": 23, + "src": "188:23:3", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 24, + "src": "0:213:3", + "usedErrors": [] + } + ], + "src": "0:214:3" +} diff --git a/ethers-solc/test-data/ast/documentation_local_variable.json b/ethers-solc/test-data/ast/documentation_local_variable.json new file mode 100644 index 00000000..24e38eb1 --- /dev/null +++ b/ethers-solc/test-data/ast/documentation_local_variable.json @@ -0,0 +1,491 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 41 + ] + }, + "id": 42, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 41, + "linearizedBaseContracts": + [ + 41 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 26, + "nodeType": "Block", + "src": "42:330:1", + "statements": + [ + { + "assignments": + [ + 5 + ], + "declarations": + [ + { + "constant": false, + "id": 5, + "mutability": "mutable", + "name": "x", + "nameLocation": "114:1:1", + "nodeType": "VariableDeclaration", + "scope": 26, + "src": "109:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 4, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "109:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "documentation": "Documentation for x; will appear in ast json", + "id": 7, + "initialValue": + { + "hexValue": "31", + "id": 6, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "118:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "109:10:1" + }, + { + "body": + { + "id": 24, + "nodeType": "Block", + "src": "270:96:1", + "statements": + [ + { + "assignments": + [ + 21 + ], + "declarations": + [ + { + "constant": false, + "id": 21, + "mutability": "mutable", + "name": "j", + "nameLocation": "350:1:1", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "345:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 20, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "345:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "documentation": "documentation for j; will appear in ast json", + "id": 23, + "initialValue": + { + "hexValue": "30", + "id": 22, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "354:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "345:10:1" + } + ] + }, + "condition": + { + "commonType": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 15, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": + { + "id": 13, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10, + "src": "236:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": + { + "hexValue": "3130", + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "240:2:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "236:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 25, + "initializationExpression": + { + "assignments": + [ + 10 + ], + "declarations": + [ + { + "constant": false, + "id": 10, + "mutability": "mutable", + "name": "i", + "nameLocation": "217:1:1", + "nodeType": "VariableDeclaration", + "scope": 25, + "src": "212:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 9, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "212:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 12, + "initialValue": + { + "hexValue": "30", + "id": 11, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "221:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "212:10:1" + }, + "loopExpression": + { + "expression": + { + "id": 17, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "256:3:1", + "subExpression": + { + "id": 16, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10, + "src": "258:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 18, + "nodeType": "ExpressionStatement", + "src": "256:3:1" + }, + "nodeType": "ForStatement", + "src": "129:237:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 27, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 41, + "src": "17:355:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "body": + { + "id": 39, + "nodeType": "Block", + "src": "662:2:1", + "statements": [] + }, + "functionSelector": "191157d1", + "id": 40, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "g", + "nameLocation": "386:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 37, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 30, + "mutability": "mutable", + "name": "param1", + "nameLocation": "468:6:1", + "nodeType": "VariableDeclaration", + "scope": 40, + "src": "463:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 29, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "463:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 33, + "mutability": "mutable", + "name": "param2", + "nameLocation": "555:6:1", + "nodeType": "VariableDeclaration", + "scope": 40, + "src": "550:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 32, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "550:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 36, + "mutability": "mutable", + "name": "param3", + "nameLocation": "642:6:1", + "nodeType": "VariableDeclaration", + "scope": 40, + "src": "637:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 35, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "637:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "387:267:1" + }, + "returnParameters": + { + "id": 38, + "nodeType": "ParameterList", + "parameters": [], + "src": "662:0:1" + }, + "scope": 41, + "src": "377:287:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 42, + "src": "0:666:1", + "usedErrors": [] + } + ], + "src": "0:667:1" +} diff --git a/ethers-solc/test-data/ast/documentation_on_statements.json b/ethers-solc/test-data/ast/documentation_on_statements.json new file mode 100644 index 00000000..bb3ee28d --- /dev/null +++ b/ethers-solc/test-data/ast/documentation_on_statements.json @@ -0,0 +1,376 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 27 + ] + }, + "id": 28, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 27, + "linearizedBaseContracts": + [ + 27 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "constant": false, + "id": 2, + "mutability": "mutable", + "name": "a", + "nameLocation": "50:1:1", + "nodeType": "VariableDeclaration", + "scope": 27, + "src": "45:6:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 1, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "45:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "body": + { + "id": 25, + "nodeType": "Block", + "src": "99:229:1", + "statements": + [ + { + "body": + { + "id": 21, + "nodeType": "Block", + "src": "156:66:1", + "statements": + [ + { + "expression": + { + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": + { + "id": 17, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "205:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": + { + "hexValue": "32", + "id": 18, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "210:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "205:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 20, + "nodeType": "ExpressionStatement", + "src": "205:6:1" + } + ] + }, + "condition": + { + "commonType": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 13, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": + { + "id": 11, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "143:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": + { + "hexValue": "3230", + "id": 12, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "147:2:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_20_by_1", + "typeString": "int_const 20" + }, + "value": "20" + }, + "src": "143:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 22, + "initializationExpression": + { + "assignments": + [ + 8 + ], + "declarations": + [ + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "i", + "nameLocation": "136:1:1", + "nodeType": "VariableDeclaration", + "scope": 22, + "src": "131:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 7, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "131:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 10, + "initialValue": + { + "hexValue": "30", + "id": 9, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "140:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "131:10:1" + }, + "loopExpression": + { + "expression": + { + "id": 15, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "151:3:1", + "subExpression": + { + "id": 14, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "151:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 16, + "nodeType": "ExpressionStatement", + "src": "151:3:1" + }, + "nodeType": "ForStatement", + "src": "126:96:1" + }, + { + "expression": + { + "id": 23, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "320:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6, + "id": 24, + "nodeType": "Return", + "src": "313:8:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 26, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "66:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 3, + "nodeType": "ParameterList", + "parameters": [], + "src": "67:2:1" + }, + "returnParameters": + { + "id": 6, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 5, + "mutability": "mutable", + "name": "x", + "nameLocation": "96:1:1", + "nodeType": "VariableDeclaration", + "scope": 26, + "src": "91:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 4, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "91:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "90:8:1" + }, + "scope": 27, + "src": "57:271:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + } + ], + "scope": 28, + "src": "0:330:1", + "usedErrors": [] + } + ], + "src": "0:331:1" +} diff --git a/ethers-solc/test-data/ast/documentation_triple.json b/ethers-solc/test-data/ast/documentation_triple.json new file mode 100644 index 00000000..9124e68b --- /dev/null +++ b/ethers-solc/test-data/ast/documentation_triple.json @@ -0,0 +1,386 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 28 + ] + }, + "id": 29, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 28, + "linearizedBaseContracts": + [ + 28 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "constant": false, + "documentation": + { + "id": 1, + "nodeType": "StructuredDocumentation", + "src": "17:8:1", + "text": "test" + }, + "id": 3, + "mutability": "mutable", + "name": "a", + "nameLocation": "35:1:1", + "nodeType": "VariableDeclaration", + "scope": 28, + "src": "30:6:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 2, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "30:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "body": + { + "id": 26, + "nodeType": "Block", + "src": "84:181:1", + "statements": + [ + { + "body": + { + "id": 22, + "nodeType": "Block", + "src": "142:75:1", + "statements": + [ + { + "documentation": "tee\n s \"t\" 3", + "expression": + { + "id": 20, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": + { + "id": 18, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6, + "src": "200:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": + { + "hexValue": "32", + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "205:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "200:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 21, + "nodeType": "ExpressionStatement", + "src": "200:6:1" + } + ] + }, + "condition": + { + "commonType": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": + { + "id": 12, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "129:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": + { + "hexValue": "3230", + "id": 13, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "133:2:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_20_by_1", + "typeString": "int_const 20" + }, + "value": "20" + }, + "src": "129:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "documentation": "test2", + "id": 23, + "initializationExpression": + { + "assignments": + [ + 9 + ], + "declarations": + [ + { + "constant": false, + "id": 9, + "mutability": "mutable", + "name": "i", + "nameLocation": "122:1:1", + "nodeType": "VariableDeclaration", + "scope": 23, + "src": "117:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 8, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "117:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 11, + "initialValue": + { + "hexValue": "30", + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "126:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "117:10:1" + }, + "loopExpression": + { + "expression": + { + "id": 16, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "137:3:1", + "subExpression": + { + "id": 15, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "137:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 17, + "nodeType": "ExpressionStatement", + "src": "137:3:1" + }, + "nodeType": "ForStatement", + "src": "112:105:1" + }, + { + "documentation": "tes \"t4\" ", + "expression": + { + "id": 24, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6, + "src": "257:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 7, + "id": 25, + "nodeType": "Return", + "src": "250:8:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 27, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "51:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 4, + "nodeType": "ParameterList", + "parameters": [], + "src": "52:2:1" + }, + "returnParameters": + { + "id": 7, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 6, + "mutability": "mutable", + "name": "x", + "nameLocation": "81:1:1", + "nodeType": "VariableDeclaration", + "scope": 27, + "src": "76:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 5, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "76:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "75:8:1" + }, + "scope": 28, + "src": "42:223:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + } + ], + "scope": 29, + "src": "0:267:1", + "usedErrors": [] + } + ], + "src": "0:268:1" +} diff --git a/ethers-solc/test-data/ast/empty_block.json b/ethers-solc/test-data/ast/empty_block.json new file mode 100644 index 00000000..2c23e43c --- /dev/null +++ b/ethers-solc/test-data/ast/empty_block.json @@ -0,0 +1,96 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "42:31:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "61:6:1", + "statements": + [ + { + "nodeType": "YulBlock", + "src": "63:2:1", + "statements": [] + } + ] + }, + "evmVersion": "london", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "52:15:1" + } + ] + }, + "functionSelector": "e2179b8e", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "g", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 6, + "src": "17:56:1", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:75:1", + "usedErrors": [] + } + ], + "src": "0:76:1" +} diff --git a/ethers-solc/test-data/ast/enum_value.json b/ethers-solc/test-data/ast/enum_value.json new file mode 100644 index 00000000..2cca0090 --- /dev/null +++ b/ethers-solc/test-data/ast/enum_value.json @@ -0,0 +1,63 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 4 + ] + }, + "id": 5, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 4, + "linearizedBaseContracts": + [ + 4 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "canonicalName": "C.E", + "id": 3, + "members": + [ + { + "id": 1, + "name": "A", + "nameLocation": "22:1:1", + "nodeType": "EnumValue", + "src": "22:1:1" + }, + { + "id": 2, + "name": "B", + "nameLocation": "25:1:1", + "nodeType": "EnumValue", + "src": "25:1:1" + } + ], + "name": "E", + "nameLocation": "18:1:1", + "nodeType": "EnumDefinition", + "src": "13:15:1" + } + ], + "scope": 5, + "src": "0:30:1", + "usedErrors": [] + } + ], + "src": "0:31:1" +} diff --git a/ethers-solc/test-data/ast/enum_value_declaration.json b/ethers-solc/test-data/ast/enum_value_declaration.json new file mode 100644 index 00000000..acdcc736 --- /dev/null +++ b/ethers-solc/test-data/ast/enum_value_declaration.json @@ -0,0 +1,164 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "A": + [ + 3 + ], + "f": + [ + 13 + ] + }, + "id": 14, + "nodeType": "SourceUnit", + "nodes": + [ + { + "canonicalName": "A", + "id": 3, + "members": + [ + { + "id": 1, + "name": "X", + "nameLocation": "9:1:1", + "nodeType": "EnumValue", + "src": "9:1:1" + }, + { + "id": 2, + "name": "Y", + "nameLocation": "12:1:1", + "nodeType": "EnumValue", + "src": "12:1:1" + } + ], + "name": "A", + "nameLocation": "5:1:1", + "nodeType": "EnumDefinition", + "src": "0:15:1" + }, + { + "body": + { + "id": 12, + "nodeType": "Block", + "src": "46:15:1", + "statements": + [ + { + "expression": + { + "expression": + { + "id": 9, + "name": "A", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "55:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_type$_t_enum$_A_$3_$", + "typeString": "type(enum A)" + } + }, + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "57:1:1", + "memberName": "X", + "nodeType": "MemberAccess", + "referencedDeclaration": 1, + "src": "55:3:1", + "typeDescriptions": + { + "typeIdentifier": "t_enum$_A_$3", + "typeString": "enum A" + } + }, + "functionReturnParameters": 8, + "id": 11, + "nodeType": "Return", + "src": "48:10:1" + } + ] + }, + "id": 13, + "implemented": true, + "kind": "freeFunction", + "modifiers": [], + "name": "f", + "nameLocation": "25:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 4, + "nodeType": "ParameterList", + "parameters": [], + "src": "26:2:1" + }, + "returnParameters": + { + "id": 8, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 7, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 13, + "src": "43:1:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_enum$_A_$3", + "typeString": "enum A" + }, + "typeName": + { + "id": 6, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 5, + "name": "A", + "nameLocations": + [ + "43:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3, + "src": "43:1:1" + }, + "referencedDeclaration": 3, + "src": "43:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_enum$_A_$3", + "typeString": "enum A" + } + }, + "visibility": "internal" + } + ], + "src": "42:3:1" + }, + "scope": 14, + "src": "16:45:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "src": "0:62:1" +} diff --git a/ethers-solc/test-data/ast/event_definition.json b/ethers-solc/test-data/ast/event_definition.json new file mode 100644 index 00000000..0bb614c2 --- /dev/null +++ b/ethers-solc/test-data/ast/event_definition.json @@ -0,0 +1,54 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 3 + ] + }, + "id": 4, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 3, + "linearizedBaseContracts": + [ + 3 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "anonymous": false, + "eventSelector": "92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028", + "id": 2, + "name": "E", + "nameLocation": "19:1:1", + "nodeType": "EventDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "20:2:1" + }, + "src": "13:10:1" + } + ], + "scope": 4, + "src": "0:25:1", + "usedErrors": [] + } + ], + "src": "0:26:1" +} diff --git a/ethers-solc/test-data/ast/fallback.json b/ethers-solc/test-data/ast/fallback.json new file mode 100644 index 00000000..25a9b858 --- /dev/null +++ b/ethers-solc/test-data/ast/fallback.json @@ -0,0 +1,73 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 5 + ] + }, + "id": 6, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "43:5:1", + "statements": [] + }, + "id": 4, + "implemented": true, + "kind": "fallback", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "43:0:1" + }, + "scope": 5, + "src": "15:33:1", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 6, + "src": "0:50:1", + "usedErrors": [] + } + ], + "src": "0:51:1" +} diff --git a/ethers-solc/test-data/ast/fallback_and_reveice_ether.json b/ethers-solc/test-data/ast/fallback_and_reveice_ether.json new file mode 100644 index 00000000..26b4ada7 --- /dev/null +++ b/ethers-solc/test-data/ast/fallback_and_reveice_ether.json @@ -0,0 +1,108 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 9 + ] + }, + "id": 10, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 9, + "linearizedBaseContracts": + [ + 9 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "42:5:1", + "statements": [] + }, + "id": 4, + "implemented": true, + "kind": "receive", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "22:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 9, + "src": "15:32:1", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "body": + { + "id": 7, + "nodeType": "Block", + "src": "78:5:1", + "statements": [] + }, + "id": 8, + "implemented": true, + "kind": "fallback", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 5, + "nodeType": "ParameterList", + "parameters": [], + "src": "58:2:1" + }, + "returnParameters": + { + "id": 6, + "nodeType": "ParameterList", + "parameters": [], + "src": "78:0:1" + }, + "scope": 9, + "src": "50:33:1", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 10, + "src": "0:85:1", + "usedErrors": [] + } + ], + "src": "0:86:1" +} diff --git a/ethers-solc/test-data/ast/fallback_payable.json b/ethers-solc/test-data/ast/fallback_payable.json new file mode 100644 index 00000000..4331b5ed --- /dev/null +++ b/ethers-solc/test-data/ast/fallback_payable.json @@ -0,0 +1,73 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 5 + ] + }, + "id": 6, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "34:2:1", + "statements": [] + }, + "id": 4, + "implemented": true, + "kind": "fallback", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "22:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "34:0:1" + }, + "scope": 5, + "src": "14:22:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 6, + "src": "0:38:1", + "usedErrors": [] + } + ], + "src": "0:39:1" +} diff --git a/ethers-solc/test-data/ast/function.json b/ethers-solc/test-data/ast/function.json new file mode 100644 index 00000000..04a2ac55 --- /dev/null +++ b/ethers-solc/test-data/ast/function.json @@ -0,0 +1,158 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "42:68:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "61:43:1", + "statements": + [ + { + "body": + { + "nodeType": "YulBlock", + "src": "76:22:1", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "arguments": + [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "92:2:1", + "type": "", + "value": "20" + } + ], + "functionName": + { + "name": "blockhash", + "nodeType": "YulIdentifier", + "src": "82:9:1" + }, + "nodeType": "YulFunctionCall", + "src": "82:13:1" + } + ], + "functionName": + { + "name": "pop", + "nodeType": "YulIdentifier", + "src": "78:3:1" + }, + "nodeType": "YulFunctionCall", + "src": "78:18:1" + }, + "nodeType": "YulExpressionStatement", + "src": "78:18:1" + } + ] + }, + "name": "g", + "nodeType": "YulFunctionDefinition", + "src": "63:35:1" + }, + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "g", + "nodeType": "YulIdentifier", + "src": "99:1:1" + }, + "nodeType": "YulFunctionCall", + "src": "99:3:1" + }, + "nodeType": "YulExpressionStatement", + "src": "99:3:1" + } + ] + }, + "evmVersion": "london", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "52:52:1" + } + ] + }, + "functionSelector": "b8c9d365", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "h", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 6, + "src": "17:93:1", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:112:1", + "usedErrors": [] + } + ], + "src": "0:113:1" +} diff --git a/ethers-solc/test-data/ast/function_type.json b/ethers-solc/test-data/ast/function_type.json new file mode 100644 index 00000000..924f9cdb --- /dev/null +++ b/ethers-solc/test-data/ast/function_type.json @@ -0,0 +1,232 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 17 + ] + }, + "id": 18, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 17, + "linearizedBaseContracts": + [ + 17 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 15, + "nodeType": "Block", + "src": "127:2:1", + "statements": [] + }, + "functionSelector": "d6cd4974", + "id": 16, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "22:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 7, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 6, + "mutability": "mutable", + "name": "x", + "nameLocation": "67:1:1", + "nodeType": "VariableDeclaration", + "scope": 16, + "src": "24:44:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_function_external_payable$__$returns$_t_uint256_$", + "typeString": "function () payable external returns (uint256)" + }, + "typeName": + { + "id": 5, + "nodeType": "FunctionTypeName", + "parameterTypes": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "32:2:1" + }, + "returnParameterTypes": + { + "id": 4, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 3, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5, + "src": "61:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 2, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "61:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "60:6:1" + }, + "src": "24:44:1", + "stateMutability": "payable", + "typeDescriptions": + { + "typeIdentifier": "t_function_external_payable$__$returns$_t_uint256_$", + "typeString": "function () payable external returns (uint256)" + }, + "visibility": "external" + }, + "visibility": "internal" + } + ], + "src": "23:46:1" + }, + "returnParameters": + { + "id": 14, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 13, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 16, + "src": "86:40:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", + "typeString": "function () view external returns (uint256)" + }, + "typeName": + { + "id": 12, + "nodeType": "FunctionTypeName", + "parameterTypes": + { + "id": 8, + "nodeType": "ParameterList", + "parameters": [], + "src": "94:2:1" + }, + "returnParameterTypes": + { + "id": 11, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 10, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 12, + "src": "120:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 9, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "120:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "119:6:1" + }, + "src": "86:40:1", + "stateMutability": "view", + "typeDescriptions": + { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", + "typeString": "function () view external returns (uint256)" + }, + "visibility": "external" + }, + "visibility": "internal" + } + ], + "src": "85:41:1" + }, + "scope": 17, + "src": "13:116:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 18, + "src": "0:131:1", + "usedErrors": [] + } + ], + "src": "0:132:1" +} diff --git a/ethers-solc/test-data/ast/global_enum.json b/ethers-solc/test-data/ast/global_enum.json new file mode 100644 index 00000000..0b673cff --- /dev/null +++ b/ethers-solc/test-data/ast/global_enum.json @@ -0,0 +1,34 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "E": + [ + 2 + ] + }, + "id": 3, + "nodeType": "SourceUnit", + "nodes": + [ + { + "canonicalName": "E", + "id": 2, + "members": + [ + { + "id": 1, + "name": "A", + "nameLocation": "9:1:1", + "nodeType": "EnumValue", + "src": "9:1:1" + } + ], + "name": "E", + "nameLocation": "5:1:1", + "nodeType": "EnumDefinition", + "src": "0:12:1" + } + ], + "src": "0:13:1" +} diff --git a/ethers-solc/test-data/ast/global_struct.json b/ethers-solc/test-data/ast/global_struct.json new file mode 100644 index 00000000..2c14a5e4 --- /dev/null +++ b/ethers-solc/test-data/ast/global_struct.json @@ -0,0 +1,59 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "S": + [ + 3 + ] + }, + "id": 4, + "nodeType": "SourceUnit", + "nodes": + [ + { + "canonicalName": "S", + "id": 3, + "members": + [ + { + "constant": false, + "id": 2, + "mutability": "mutable", + "name": "a", + "nameLocation": "19:1:1", + "nodeType": "VariableDeclaration", + "scope": 3, + "src": "11:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 1, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11:7:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "name": "S", + "nameLocation": "7:1:1", + "nodeType": "StructDefinition", + "scope": 4, + "src": "0:23:1", + "visibility": "public" + } + ], + "src": "0:24:1" +} diff --git a/ethers-solc/test-data/ast/inheritance_specifier.json b/ethers-solc/test-data/ast/inheritance_specifier.json new file mode 100644 index 00000000..8959d5b5 --- /dev/null +++ b/ethers-solc/test-data/ast/inheritance_specifier.json @@ -0,0 +1,80 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C1": + [ + 1 + ], + "C2": + [ + 4 + ] + }, + "id": 5, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C1", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 1, + "linearizedBaseContracts": + [ + 1 + ], + "name": "C1", + "nameLocation": "9:2:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 5, + "src": "0:14:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": + [ + { + "baseName": + { + "id": 2, + "name": "C1", + "nameLocations": + [ + "30:2:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1, + "src": "30:2:1" + }, + "id": 3, + "nodeType": "InheritanceSpecifier", + "src": "30:2:1" + } + ], + "canonicalName": "C2", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 4, + "linearizedBaseContracts": + [ + 4, + 1 + ], + "name": "C2", + "nameLocation": "24:2:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 5, + "src": "15:20:1", + "usedErrors": [] + } + ], + "src": "0:36:1" +} diff --git a/ethers-solc/test-data/ast/leave.json b/ethers-solc/test-data/ast/leave.json new file mode 100644 index 00000000..7be1136f --- /dev/null +++ b/ethers-solc/test-data/ast/leave.json @@ -0,0 +1,108 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "37:51:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "56:26:1", + "statements": + [ + { + "body": + { + "nodeType": "YulBlock", + "src": "71:9:1", + "statements": + [ + { + "nodeType": "YulLeave", + "src": "73:5:1" + } + ] + }, + "name": "f", + "nodeType": "YulFunctionDefinition", + "src": "58:22:1" + } + ] + }, + "evmVersion": "london", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "47:35:1" + } + ] + }, + "functionSelector": "ece866b9", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "l", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "37:0:1" + }, + "scope": 6, + "src": "17:71:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:90:1", + "usedErrors": [] + } + ], + "src": "0:91:1" +} diff --git a/ethers-solc/test-data/ast/license.json b/ethers-solc/test-data/ast/license.json new file mode 100644 index 00000000..9f996e05 --- /dev/null +++ b/ethers-solc/test-data/ast/license.json @@ -0,0 +1,37 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 1 + ] + }, + "id": 2, + "license": "GPL-3.0", + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 1, + "linearizedBaseContracts": + [ + 1 + ], + "name": "C", + "nameLocation": "45:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 2, + "src": "36:13:1", + "usedErrors": [] + } + ], + "src": "36:14:1" +} diff --git a/ethers-solc/test-data/ast/long_type_name_binary_operation.json b/ethers-solc/test-data/ast/long_type_name_binary_operation.json new file mode 100644 index 00000000..8340eaf4 --- /dev/null +++ b/ethers-solc/test-data/ast/long_type_name_binary_operation.json @@ -0,0 +1,175 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "c": + [ + 11 + ] + }, + "id": 12, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "c", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 11, + "linearizedBaseContracts": + [ + 11 + ], + "name": "c", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 9, + "nodeType": "Block", + "src": "33:19:1", + "statements": + [ + { + "assignments": + [ + 4 + ], + "declarations": + [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "a", + "nameLocation": "40:1:1", + "nodeType": "VariableDeclaration", + "scope": 9, + "src": "35:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 3, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "35:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 8, + "initialValue": + { + "commonType": + { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + }, + "id": 7, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": + { + "hexValue": "32", + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "44:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": + { + "hexValue": "33", + "id": 6, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "48:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "44:5:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "35:14:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 10, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "22:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 11, + "src": "13:39:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 12, + "src": "0:54:1", + "usedErrors": [] + } + ], + "src": "0:55:1" +} diff --git a/ethers-solc/test-data/ast/long_type_name_identifier.json b/ethers-solc/test-data/ast/long_type_name_identifier.json new file mode 100644 index 00000000..c810283d --- /dev/null +++ b/ethers-solc/test-data/ast/long_type_name_identifier.json @@ -0,0 +1,184 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "c": + [ + 15 + ] + }, + "id": 16, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "c", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 15, + "linearizedBaseContracts": + [ + 15 + ], + "name": "c", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "constant": false, + "id": 3, + "mutability": "mutable", + "name": "a", + "nameLocation": "20:1:1", + "nodeType": "VariableDeclaration", + "scope": 15, + "src": "13:8:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[]" + }, + "typeName": + { + "baseType": + { + "id": 1, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "13:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2, + "nodeType": "ArrayTypeName", + "src": "13:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + }, + { + "body": + { + "id": 13, + "nodeType": "Block", + "src": "43:25:1", + "statements": + [ + { + "assignments": + [ + 10 + ], + "declarations": + [ + { + "constant": false, + "id": 10, + "mutability": "mutable", + "name": "b", + "nameLocation": "60:1:1", + "nodeType": "VariableDeclaration", + "scope": 13, + "src": "45:16:1", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + }, + "typeName": + { + "baseType": + { + "id": 8, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "45:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 9, + "nodeType": "ArrayTypeName", + "src": "45:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "id": 12, + "initialValue": + { + "id": 11, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "64:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "45:20:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 14, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "32:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 4, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:2:1" + }, + "returnParameters": + { + "id": 5, + "nodeType": "ParameterList", + "parameters": [], + "src": "43:0:1" + }, + "scope": 15, + "src": "23:45:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 16, + "src": "0:70:1", + "usedErrors": [] + } + ], + "src": "0:71:1" +} diff --git a/ethers-solc/test-data/ast/loop.json b/ethers-solc/test-data/ast/loop.json new file mode 100644 index 00000000..2b634e4c --- /dev/null +++ b/ethers-solc/test-data/ast/loop.json @@ -0,0 +1,171 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "42:74:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "61:49:1", + "statements": + [ + { + "body": + { + "nodeType": "YulBlock", + "src": "90:18:1", + "statements": + [ + { + "nodeType": "YulBreak", + "src": "92:5:1" + }, + { + "nodeType": "YulContinue", + "src": "98:8:1" + } + ] + }, + "condition": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "70:1:1", + "type": "", + "value": "1" + }, + "nodeType": "YulForLoop", + "post": + { + "nodeType": "YulBlock", + "src": "72:17:1", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "arguments": + [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "84:1:1", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "sload", + "nodeType": "YulIdentifier", + "src": "78:5:1" + }, + "nodeType": "YulFunctionCall", + "src": "78:8:1" + } + ], + "functionName": + { + "name": "pop", + "nodeType": "YulIdentifier", + "src": "74:3:1" + }, + "nodeType": "YulFunctionCall", + "src": "74:13:1" + }, + "nodeType": "YulExpressionStatement", + "src": "74:13:1" + } + ] + }, + "pre": + { + "nodeType": "YulBlock", + "src": "67:2:1", + "statements": [] + }, + "src": "63:45:1" + } + ] + }, + "evmVersion": "london", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "52:58:1" + } + ] + }, + "functionSelector": "e2179b8e", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "g", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 6, + "src": "17:99:1", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:118:1", + "usedErrors": [] + } + ], + "src": "0:119:1" +} diff --git a/ethers-solc/test-data/ast/mappings.json b/ethers-solc/test-data/ast/mappings.json new file mode 100644 index 00000000..e414b56f --- /dev/null +++ b/ethers-solc/test-data/ast/mappings.json @@ -0,0 +1,253 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 19 + ] + }, + "id": 20, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 19, + "linearizedBaseContracts": + [ + 19 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "canonicalName": "C.E", + "id": 4, + "members": + [ + { + "id": 1, + "name": "A", + "nameLocation": "26:1:1", + "nodeType": "EnumValue", + "src": "26:1:1" + }, + { + "id": 2, + "name": "B", + "nameLocation": "29:1:1", + "nodeType": "EnumValue", + "src": "29:1:1" + }, + { + "id": 3, + "name": "C", + "nameLocation": "32:1:1", + "nodeType": "EnumValue", + "src": "32:1:1" + } + ], + "name": "E", + "nameLocation": "22:1:1", + "nodeType": "EnumDefinition", + "src": "17:18:1" + }, + { + "constant": false, + "id": 9, + "mutability": "mutable", + "name": "a", + "nameLocation": "59:1:1", + "nodeType": "VariableDeclaration", + "scope": 19, + "src": "40:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_contract$_C_$19_$_t_bool_$", + "typeString": "mapping(contract C => bool)" + }, + "typeName": + { + "id": 8, + "keyType": + { + "id": 6, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 5, + "name": "C", + "nameLocations": + [ + "48:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 19, + "src": "48:1:1" + }, + "referencedDeclaration": 19, + "src": "48:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_contract$_C_$19", + "typeString": "contract C" + } + }, + "nodeType": "Mapping", + "src": "40:18:1", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_contract$_C_$19_$_t_bool_$", + "typeString": "mapping(contract C => bool)" + }, + "valueType": + { + "id": 7, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "53:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 13, + "mutability": "mutable", + "name": "b", + "nameLocation": "91:1:1", + "nodeType": "VariableDeclaration", + "scope": 19, + "src": "66:26:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + }, + "typeName": + { + "id": 12, + "keyType": + { + "id": 10, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "74:7:1", + "typeDescriptions": + { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "66:24:1", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + }, + "valueType": + { + "id": 11, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "85:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 18, + "mutability": "mutable", + "name": "c", + "nameLocation": "117:1:1", + "nodeType": "VariableDeclaration", + "scope": 19, + "src": "98:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_enum$_E_$4_$_t_bool_$", + "typeString": "mapping(enum C.E => bool)" + }, + "typeName": + { + "id": 17, + "keyType": + { + "id": 15, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 14, + "name": "E", + "nameLocations": + [ + "106:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4, + "src": "106:1:1" + }, + "referencedDeclaration": 4, + "src": "106:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_enum$_E_$4", + "typeString": "enum C.E" + } + }, + "nodeType": "Mapping", + "src": "98:18:1", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_enum$_E_$4_$_t_bool_$", + "typeString": "mapping(enum C.E => bool)" + }, + "valueType": + { + "id": 16, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "111:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + }, + "visibility": "internal" + } + ], + "scope": 20, + "src": "0:121:1", + "usedErrors": [] + } + ], + "src": "0:122:1" +} diff --git a/ethers-solc/test-data/ast/modifier_definition.json b/ethers-solc/test-data/ast/modifier_definition.json new file mode 100644 index 00000000..aa448568 --- /dev/null +++ b/ethers-solc/test-data/ast/modifier_definition.json @@ -0,0 +1,176 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 14 + ] + }, + "id": 15, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 14, + "linearizedBaseContracts": + [ + 14 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 5, + "nodeType": "Block", + "src": "32:6:1", + "statements": + [ + { + "id": 4, + "nodeType": "PlaceholderStatement", + "src": "34:1:1" + } + ] + }, + "id": 6, + "name": "M", + "nameLocation": "22:1:1", + "nodeType": "ModifierDefinition", + "parameters": + { + "id": 3, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 2, + "mutability": "mutable", + "name": "i", + "nameLocation": "29:1:1", + "nodeType": "VariableDeclaration", + "scope": 6, + "src": "24:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 1, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "24:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "23:8:1" + }, + "src": "13:25:1", + "virtual": false, + "visibility": "internal" + }, + { + "body": + { + "id": 12, + "nodeType": "Block", + "src": "64:2:1", + "statements": [] + }, + "functionSelector": "28811f59", + "id": 13, + "implemented": true, + "kind": "function", + "modifiers": + [ + { + "arguments": + [ + { + "hexValue": "31", + "id": 9, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "54:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "id": 10, + "kind": "modifierInvocation", + "modifierName": + { + "id": 8, + "name": "M", + "nameLocations": + [ + "52:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 6, + "src": "52:1:1" + }, + "nodeType": "ModifierInvocation", + "src": "52:4:1" + } + ], + "name": "F", + "nameLocation": "48:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 7, + "nodeType": "ParameterList", + "parameters": [], + "src": "49:2:1" + }, + "returnParameters": + { + "id": 11, + "nodeType": "ParameterList", + "parameters": [], + "src": "64:0:1" + }, + "scope": 14, + "src": "39:27:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 15, + "src": "0:68:1", + "usedErrors": [] + } + ], + "src": "0:69:1" +} diff --git a/ethers-solc/test-data/ast/modifier_invocation.json b/ethers-solc/test-data/ast/modifier_invocation.json new file mode 100644 index 00000000..aa448568 --- /dev/null +++ b/ethers-solc/test-data/ast/modifier_invocation.json @@ -0,0 +1,176 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 14 + ] + }, + "id": 15, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 14, + "linearizedBaseContracts": + [ + 14 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 5, + "nodeType": "Block", + "src": "32:6:1", + "statements": + [ + { + "id": 4, + "nodeType": "PlaceholderStatement", + "src": "34:1:1" + } + ] + }, + "id": 6, + "name": "M", + "nameLocation": "22:1:1", + "nodeType": "ModifierDefinition", + "parameters": + { + "id": 3, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 2, + "mutability": "mutable", + "name": "i", + "nameLocation": "29:1:1", + "nodeType": "VariableDeclaration", + "scope": 6, + "src": "24:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 1, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "24:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "23:8:1" + }, + "src": "13:25:1", + "virtual": false, + "visibility": "internal" + }, + { + "body": + { + "id": 12, + "nodeType": "Block", + "src": "64:2:1", + "statements": [] + }, + "functionSelector": "28811f59", + "id": 13, + "implemented": true, + "kind": "function", + "modifiers": + [ + { + "arguments": + [ + { + "hexValue": "31", + "id": 9, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "54:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "id": 10, + "kind": "modifierInvocation", + "modifierName": + { + "id": 8, + "name": "M", + "nameLocations": + [ + "52:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 6, + "src": "52:1:1" + }, + "nodeType": "ModifierInvocation", + "src": "52:4:1" + } + ], + "name": "F", + "nameLocation": "48:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 7, + "nodeType": "ParameterList", + "parameters": [], + "src": "49:2:1" + }, + "returnParameters": + { + "id": 11, + "nodeType": "ParameterList", + "parameters": [], + "src": "64:0:1" + }, + "scope": 14, + "src": "39:27:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 15, + "src": "0:68:1", + "usedErrors": [] + } + ], + "src": "0:69:1" +} diff --git a/ethers-solc/test-data/ast/mutability.json b/ethers-solc/test-data/ast/mutability.json new file mode 100644 index 00000000..90bbf05d --- /dev/null +++ b/ethers-solc/test-data/ast/mutability.json @@ -0,0 +1,185 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 10 + ] + }, + "id": 11, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 10, + "linearizedBaseContracts": + [ + 10 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "constant": false, + "functionSelector": "0dbe671f", + "id": 3, + "mutability": "immutable", + "name": "a", + "nameLocation": "39:1:1", + "nodeType": "VariableDeclaration", + "scope": 10, + "src": "17:27:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 1, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "17:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": + { + "hexValue": "34", + "id": 2, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "43:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "visibility": "public" + }, + { + "constant": true, + "functionSelector": "4df7e3d0", + "id": 6, + "mutability": "constant", + "name": "b", + "nameLocation": "71:1:1", + "nodeType": "VariableDeclaration", + "scope": 10, + "src": "50:26:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 4, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "50:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": + { + "hexValue": "32", + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "75:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "visibility": "public" + }, + { + "constant": false, + "functionSelector": "c3da42b8", + "id": 9, + "mutability": "mutable", + "name": "c", + "nameLocation": "94:1:1", + "nodeType": "VariableDeclaration", + "scope": 10, + "src": "82:17:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 7, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "82:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": + { + "hexValue": "33", + "id": 8, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "98:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "visibility": "public" + } + ], + "scope": 11, + "src": "0:102:1", + "usedErrors": [] + } + ], + "src": "0:103:1" +} diff --git a/ethers-solc/test-data/ast/nested_functions.json b/ethers-solc/test-data/ast/nested_functions.json new file mode 100644 index 00000000..2ba3bd03 --- /dev/null +++ b/ethers-solc/test-data/ast/nested_functions.json @@ -0,0 +1,176 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 8 + ] + }, + "id": 9, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 8, + "linearizedBaseContracts": + [ + 8 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 6, + "nodeType": "Block", + "src": "57:95:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "72:76:1", + "statements": + [ + { + "body": + { + "nodeType": "YulBlock", + "src": "94:35:1", + "statements": + [ + { + "body": + { + "nodeType": "YulBlock", + "src": "118:3:1", + "statements": [] + }, + "name": "f2", + "nodeType": "YulFunctionDefinition", + "src": "104:17:1" + } + ] + }, + "name": "f1", + "nodeType": "YulFunctionDefinition", + "src": "80:49:1" + }, + { + "nodeType": "YulAssignment", + "src": "136:6:1", + "value": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "141:1:1", + "type": "", + "value": "2" + }, + "variableNames": + [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "136:1:1" + } + ] + } + ] + }, + "evmVersion": "london", + "externalReferences": + [ + { + "declaration": 3, + "isOffset": false, + "isSlot": false, + "src": "136:1:1", + "valueSize": 1 + } + ], + "id": 5, + "nodeType": "InlineAssembly", + "src": "63:85:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 7, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "24:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "25:2:1" + }, + "returnParameters": + { + "id": 4, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 3, + "mutability": "mutable", + "name": "x", + "nameLocation": "54:1:1", + "nodeType": "VariableDeclaration", + "scope": 7, + "src": "49:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 2, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "49:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "48:8:1" + }, + "scope": 8, + "src": "15:137:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + } + ], + "scope": 9, + "src": "0:154:1", + "usedErrors": [] + } + ], + "src": "0:155:1" +} diff --git a/ethers-solc/test-data/ast/non_utf8.json b/ethers-solc/test-data/ast/non_utf8.json new file mode 100644 index 00000000..926f858b --- /dev/null +++ b/ethers-solc/test-data/ast/non_utf8.json @@ -0,0 +1,237 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 15 + ] + }, + "id": 16, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 15, + "linearizedBaseContracts": + [ + 15 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 13, + "nodeType": "Block", + "src": "33:45:1", + "statements": + [ + { + "assignments": + [ + 4 + ], + "declarations": + [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "x", + "nameLocation": "49:1:1", + "nodeType": "VariableDeclaration", + "scope": 13, + "src": "35:15:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": + { + "id": 3, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "35:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 12, + "initialValue": + { + "arguments": + [ + { + "arguments": + [ + { + "hexValue": "ff", + "id": 9, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "hexString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "66:7:1", + "typeDescriptions": + { + "typeIdentifier": "t_stringliteral_8b1a944cf13a9a1c08facb2c9e98623ef3254d2ddb48113885c3e8e97fec8db9", + "typeString": "literal_string hex\"ff\"" + } + } + ], + "expression": + { + "argumentTypes": + [ + { + "typeIdentifier": "t_stringliteral_8b1a944cf13a9a1c08facb2c9e98623ef3254d2ddb48113885c3e8e97fec8db9", + "typeString": "literal_string hex\"ff\"" + } + ], + "id": 8, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "60:5:1", + "typeDescriptions": + { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": + { + "id": 7, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "60:5:1", + "typeDescriptions": {} + } + }, + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "60:14:1", + "tryCall": false, + "typeDescriptions": + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": + { + "argumentTypes": + [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 6, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "53:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": + { + "id": 5, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "53:6:1", + "typeDescriptions": {} + } + }, + "id": 11, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "53:22:1", + "tryCall": false, + "typeDescriptions": + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "35:40:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 14, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "22:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 15, + "src": "13:65:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 16, + "src": "0:80:1", + "usedErrors": [] + } + ], + "src": "0:81:1" +} diff --git a/ethers-solc/test-data/ast/override.json b/ethers-solc/test-data/ast/override.json new file mode 100644 index 00000000..a7c43767 --- /dev/null +++ b/ethers-solc/test-data/ast/override.json @@ -0,0 +1,337 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "A": + [ + 5 + ], + "B": + [ + 16 + ], + "C": + [ + 29 + ] + }, + "id": 30, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "A", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "A", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "44:2:1", + "statements": [] + }, + "functionSelector": "a399b6a2", + "id": 4, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "faa", + "nameLocation": "23:3:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "26:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "44:0:1" + }, + "scope": 5, + "src": "14:32:1", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + } + ], + "scope": 30, + "src": "0:48:1", + "usedErrors": [] + }, + { + "abstract": true, + "baseContracts": + [ + { + "baseName": + { + "id": 6, + "name": "A", + "nameLocations": + [ + "72:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 5, + "src": "72:1:1" + }, + "id": 7, + "nodeType": "InheritanceSpecifier", + "src": "72:1:1" + } + ], + "canonicalName": "B", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": false, + "id": 16, + "linearizedBaseContracts": + [ + 16, + 5 + ], + "name": "B", + "nameLocation": "67:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "functionSelector": "c2985578", + "id": 10, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "foo", + "nameLocation": "86:3:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 8, + "nodeType": "ParameterList", + "parameters": [], + "src": "89:2:1" + }, + "returnParameters": + { + "id": 9, + "nodeType": "ParameterList", + "parameters": [], + "src": "106:0:1" + }, + "scope": 16, + "src": "77:30:1", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + }, + { + "baseFunctions": + [ + 4 + ], + "body": + { + "id": 14, + "nodeType": "Block", + "src": "148:2:1", + "statements": [] + }, + "functionSelector": "a399b6a2", + "id": 15, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "faa", + "nameLocation": "118:3:1", + "nodeType": "FunctionDefinition", + "overrides": + { + "id": 12, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "139:8:1" + }, + "parameters": + { + "id": 11, + "nodeType": "ParameterList", + "parameters": [], + "src": "121:2:1" + }, + "returnParameters": + { + "id": 13, + "nodeType": "ParameterList", + "parameters": [], + "src": "148:0:1" + }, + "scope": 16, + "src": "109:41:1", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + } + ], + "scope": 30, + "src": "49:103:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": + [ + { + "baseName": + { + "id": 17, + "name": "B", + "nameLocations": + [ + "167:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 16, + "src": "167:1:1" + }, + "id": 18, + "nodeType": "InheritanceSpecifier", + "src": "167:1:1" + } + ], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 29, + "linearizedBaseContracts": + [ + 29, + 16, + 5 + ], + "name": "C", + "nameLocation": "162:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "baseFunctions": + [ + 10 + ], + "body": + { + "id": 22, + "nodeType": "Block", + "src": "203:3:1", + "statements": [] + }, + "functionSelector": "c2985578", + "id": 23, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "foo", + "nameLocation": "181:3:1", + "nodeType": "FunctionDefinition", + "overrides": + { + "id": 20, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "194:8:1" + }, + "parameters": + { + "id": 19, + "nodeType": "ParameterList", + "parameters": [], + "src": "184:2:1" + }, + "returnParameters": + { + "id": 21, + "nodeType": "ParameterList", + "parameters": [], + "src": "203:0:1" + }, + "scope": 29, + "src": "172:34:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": + [ + 15 + ], + "body": + { + "id": 27, + "nodeType": "Block", + "src": "239:3:1", + "statements": [] + }, + "functionSelector": "a399b6a2", + "id": 28, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "faa", + "nameLocation": "217:3:1", + "nodeType": "FunctionDefinition", + "overrides": + { + "id": 25, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "230:8:1" + }, + "parameters": + { + "id": 24, + "nodeType": "ParameterList", + "parameters": [], + "src": "220:2:1" + }, + "returnParameters": + { + "id": 26, + "nodeType": "ParameterList", + "parameters": [], + "src": "239:0:1" + }, + "scope": 29, + "src": "208:34:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 30, + "src": "153:91:1", + "usedErrors": [] + } + ], + "src": "0:245:1" +} diff --git a/ethers-solc/test-data/ast/placeholder_statement.json b/ethers-solc/test-data/ast/placeholder_statement.json new file mode 100644 index 00000000..5a6d51b2 --- /dev/null +++ b/ethers-solc/test-data/ast/placeholder_statement.json @@ -0,0 +1,68 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 5 + ] + }, + "id": 6, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "24:6:1", + "statements": + [ + { + "id": 2, + "nodeType": "PlaceholderStatement", + "src": "26:1:1" + } + ] + }, + "id": 4, + "name": "M", + "nameLocation": "22:1:1", + "nodeType": "ModifierDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "24:0:1" + }, + "src": "13:17:1", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 6, + "src": "0:32:1", + "usedErrors": [] + } + ], + "src": "0:33:1" +} diff --git a/ethers-solc/test-data/ast/receive_ether.json b/ethers-solc/test-data/ast/receive_ether.json new file mode 100644 index 00000000..bfcb33f6 --- /dev/null +++ b/ethers-solc/test-data/ast/receive_ether.json @@ -0,0 +1,73 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 5 + ] + }, + "id": 6, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "42:5:1", + "statements": [] + }, + "id": 4, + "implemented": true, + "kind": "receive", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "22:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 5, + "src": "15:32:1", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 6, + "src": "0:49:1", + "usedErrors": [] + } + ], + "src": "0:50:1" +} diff --git a/ethers-solc/test-data/ast/short_type_name.json b/ethers-solc/test-data/ast/short_type_name.json new file mode 100644 index 00000000..b7409fbb --- /dev/null +++ b/ethers-solc/test-data/ast/short_type_name.json @@ -0,0 +1,129 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "c": + [ + 11 + ] + }, + "id": 12, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "c", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 11, + "linearizedBaseContracts": + [ + 11 + ], + "name": "c", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 9, + "nodeType": "Block", + "src": "33:20:1", + "statements": + [ + { + "assignments": + [ + 7 + ], + "declarations": + [ + { + "constant": false, + "id": 7, + "mutability": "mutable", + "name": "x", + "nameLocation": "49:1:1", + "nodeType": "VariableDeclaration", + "scope": 9, + "src": "35:15:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": + { + "baseType": + { + "id": 5, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "35:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6, + "nodeType": "ArrayTypeName", + "src": "35:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "id": 8, + "nodeType": "VariableDeclarationStatement", + "src": "35:15:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 10, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "22:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 11, + "src": "13:40:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 12, + "src": "0:55:1", + "usedErrors": [] + } + ], + "src": "0:56:1" +} diff --git a/ethers-solc/test-data/ast/short_type_name_ref.json b/ethers-solc/test-data/ast/short_type_name_ref.json new file mode 100644 index 00000000..6a0f249f --- /dev/null +++ b/ethers-solc/test-data/ast/short_type_name_ref.json @@ -0,0 +1,140 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "c": + [ + 12 + ] + }, + "id": 13, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "c", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 12, + "linearizedBaseContracts": + [ + 12 + ], + "name": "c", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 10, + "nodeType": "Block", + "src": "33:25:1", + "statements": + [ + { + "assignments": + [ + 8 + ], + "declarations": + [ + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "rows", + "nameLocation": "51:4:1", + "nodeType": "VariableDeclaration", + "scope": 10, + "src": "35:20:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptr", + "typeString": "uint256[][]" + }, + "typeName": + { + "baseType": + { + "baseType": + { + "id": 5, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "35:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6, + "nodeType": "ArrayTypeName", + "src": "35:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "id": 7, + "nodeType": "ArrayTypeName", + "src": "35:8:1", + "typeDescriptions": + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } + }, + "visibility": "internal" + } + ], + "id": 9, + "nodeType": "VariableDeclarationStatement", + "src": "35:20:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 11, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "22:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 12, + "src": "13:45:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 13, + "src": "0:60:1", + "usedErrors": [] + } + ], + "src": "0:61:1" +} diff --git a/ethers-solc/test-data/ast/slot_offset.json b/ethers-solc/test-data/ast/slot_offset.json new file mode 100644 index 00000000..a77d3e5d --- /dev/null +++ b/ethers-solc/test-data/ast/slot_offset.json @@ -0,0 +1,252 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 12 + ] + }, + "id": 13, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 12, + "linearizedBaseContracts": + [ + 12 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "canonicalName": "C.S", + "id": 3, + "members": + [ + { + "constant": false, + "id": 2, + "mutability": "mutable", + "name": "x", + "nameLocation": "33:1:1", + "nodeType": "VariableDeclaration", + "scope": 3, + "src": "28:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 1, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "28:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "name": "S", + "nameLocation": "24:1:1", + "nodeType": "StructDefinition", + "scope": 12, + "src": "17:20:1", + "visibility": "public" + }, + { + "constant": false, + "id": 6, + "mutability": "mutable", + "name": "s", + "nameLocation": "44:1:1", + "nodeType": "VariableDeclaration", + "scope": 12, + "src": "42:3:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_struct$_S_$3_storage", + "typeString": "struct C.S" + }, + "typeName": + { + "id": 5, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 4, + "name": "S", + "nameLocations": + [ + "42:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3, + "src": "42:1:1" + }, + "referencedDeclaration": 3, + "src": "42:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_struct$_S_$3_storage_ptr", + "typeString": "struct C.S" + } + }, + "visibility": "internal" + }, + { + "body": + { + "id": 10, + "nodeType": "Block", + "src": "76:70:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "95:45:1", + "statements": + [ + { + "nodeType": "YulVariableDeclaration", + "src": "97:17:1", + "value": + { + "name": "s.offset", + "nodeType": "YulIdentifier", + "src": "106:8:1" + }, + "variables": + [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "101:1:1", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "115:23:1", + "value": + { + "arguments": + [ + { + "name": "s.slot", + "nodeType": "YulIdentifier", + "src": "128:6:1" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "136:1:1", + "type": "", + "value": "2" + } + ], + "functionName": + { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "124:3:1" + }, + "nodeType": "YulFunctionCall", + "src": "124:14:1" + }, + "variables": + [ + { + "name": "y", + "nodeType": "YulTypedName", + "src": "119:1:1", + "type": "" + } + ] + } + ] + }, + "evmVersion": "london", + "externalReferences": + [ + { + "declaration": 6, + "isOffset": true, + "isSlot": false, + "src": "106:8:1", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 6, + "isOffset": false, + "isSlot": true, + "src": "128:6:1", + "suffix": "slot", + "valueSize": 1 + } + ], + "id": 9, + "nodeType": "InlineAssembly", + "src": "86:54:1" + } + ] + }, + "functionSelector": "ffae15ba", + "id": 11, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "e", + "nameLocation": "60:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 7, + "nodeType": "ParameterList", + "parameters": [], + "src": "61:2:1" + }, + "returnParameters": + { + "id": 8, + "nodeType": "ParameterList", + "parameters": [], + "src": "76:0:1" + }, + "scope": 12, + "src": "51:95:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + } + ], + "scope": 13, + "src": "0:148:1", + "usedErrors": [] + } + ], + "src": "0:149:1" +} diff --git a/ethers-solc/test-data/ast/smoke.json b/ethers-solc/test-data/ast/smoke.json new file mode 100644 index 00000000..4d4a02e2 --- /dev/null +++ b/ethers-solc/test-data/ast/smoke.json @@ -0,0 +1,36 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 1 + ] + }, + "id": 2, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 1, + "linearizedBaseContracts": + [ + 1 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 2, + "src": "0:13:1", + "usedErrors": [] + } + ], + "src": "0:14:1" +} diff --git a/ethers-solc/test-data/ast/source_location.json b/ethers-solc/test-data/ast/source_location.json new file mode 100644 index 00000000..df51e49c --- /dev/null +++ b/ethers-solc/test-data/ast/source_location.json @@ -0,0 +1,172 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 12 + ] + }, + "id": 13, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 12, + "linearizedBaseContracts": + [ + 12 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 10, + "nodeType": "Block", + "src": "33:20:1", + "statements": + [ + { + "assignments": + [ + 4 + ], + "declarations": + [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "x", + "nameLocation": "40:1:1", + "nodeType": "VariableDeclaration", + "scope": 10, + "src": "35:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 3, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "35:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 6, + "initialValue": + { + "hexValue": "32", + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "44:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "VariableDeclarationStatement", + "src": "35:10:1" + }, + { + "expression": + { + "id": 8, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "47:3:1", + "subExpression": + { + "id": 7, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "47:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 9, + "nodeType": "ExpressionStatement", + "src": "47:3:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 11, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "22:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 12, + "src": "13:40:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 13, + "src": "0:55:1", + "usedErrors": [] + } + ], + "src": "0:56:1" +} diff --git a/ethers-solc/test-data/ast/string.json b/ethers-solc/test-data/ast/string.json new file mode 100644 index 00000000..438f760c --- /dev/null +++ b/ethers-solc/test-data/ast/string.json @@ -0,0 +1,136 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 9 + ] + }, + "id": 10, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 9, + "linearizedBaseContracts": + [ + 9 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 7, + "nodeType": "Block", + "src": "33:36:1", + "statements": + [ + { + "assignments": + [ + 4 + ], + "declarations": + [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "x", + "nameLocation": "49:1:1", + "nodeType": "VariableDeclaration", + "scope": 7, + "src": "35:15:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": + { + "id": 3, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "35:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 6, + "initialValue": + { + "hexValue": "48656c6c6f20576f726c64", + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "53:13:1", + "typeDescriptions": + { + "typeIdentifier": "t_stringliteral_592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba", + "typeString": "literal_string \"Hello World\"" + }, + "value": "Hello World" + }, + "nodeType": "VariableDeclarationStatement", + "src": "35:31:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 8, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "22:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 9, + "src": "13:56:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 10, + "src": "0:71:1", + "usedErrors": [] + } + ], + "src": "0:72:1" +} diff --git a/ethers-solc/test-data/ast/stringlit.json b/ethers-solc/test-data/ast/stringlit.json new file mode 100644 index 00000000..6edf9146 --- /dev/null +++ b/ethers-solc/test-data/ast/stringlit.json @@ -0,0 +1,113 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "37:43:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "56:18:1", + "statements": + [ + { + "nodeType": "YulVariableDeclaration", + "src": "58:14:1", + "value": + { + "hexValue": "616263", + "kind": "string", + "nodeType": "YulLiteral", + "src": "67:5:1", + "type": "", + "value": "abc" + }, + "variables": + [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "62:1:1", + "type": "" + } + ] + } + ] + }, + "evmVersion": "london", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "47:27:1" + } + ] + }, + "functionSelector": "5a2ee019", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "m", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "37:0:1" + }, + "scope": 6, + "src": "17:63:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:82:1", + "usedErrors": [] + } + ], + "src": "0:83:1" +} diff --git a/ethers-solc/test-data/ast/switch.json b/ethers-solc/test-data/ast/switch.json new file mode 100644 index 00000000..c4116b64 --- /dev/null +++ b/ethers-solc/test-data/ast/switch.json @@ -0,0 +1,204 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "42:154:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "61:129:1", + "statements": + [ + { + "nodeType": "YulVariableDeclaration", + "src": "75:10:1", + "value": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "84:1:1", + "type": "", + "value": "0" + }, + "variables": + [ + { + "name": "v", + "nodeType": "YulTypedName", + "src": "79:1:1", + "type": "" + } + ] + }, + { + "cases": + [ + { + "body": + { + "nodeType": "YulBlock", + "src": "139:10:1", + "statements": + [ + { + "nodeType": "YulAssignment", + "src": "141:6:1", + "value": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "146:1:1", + "type": "", + "value": "1" + }, + "variableNames": + [ + { + "name": "v", + "nodeType": "YulIdentifier", + "src": "141:1:1" + } + ] + } + ] + }, + "nodeType": "YulCase", + "src": "132:17:1", + "value": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "137:1:1", + "type": "", + "value": "0" + } + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "170:10:1", + "statements": + [ + { + "nodeType": "YulAssignment", + "src": "172:6:1", + "value": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "177:1:1", + "type": "", + "value": "2" + }, + "variableNames": + [ + { + "name": "v", + "nodeType": "YulIdentifier", + "src": "172:1:1" + } + ] + } + ] + }, + "nodeType": "YulCase", + "src": "162:18:1", + "value": "default" + } + ], + "expression": + { + "arguments": [], + "functionName": + { + "name": "calldatasize", + "nodeType": "YulIdentifier", + "src": "105:12:1" + }, + "nodeType": "YulFunctionCall", + "src": "105:14:1" + }, + "nodeType": "YulSwitch", + "src": "98:82:1" + } + ] + }, + "evmVersion": "london", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "52:138:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 6, + "src": "17:179:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:198:1", + "usedErrors": [] + } + ], + "src": "0:199:1" +} diff --git a/ethers-solc/test-data/ast/switch_default.json b/ethers-solc/test-data/ast/switch_default.json new file mode 100644 index 00000000..476f20b2 --- /dev/null +++ b/ethers-solc/test-data/ast/switch_default.json @@ -0,0 +1,135 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "42:58:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "61:33:1", + "statements": + [ + { + "cases": + [ + { + "body": + { + "nodeType": "YulBlock", + "src": "79:2:1", + "statements": [] + }, + "nodeType": "YulCase", + "src": "72:9:1", + "value": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "77:1:1", + "type": "", + "value": "0" + } + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "90:2:1", + "statements": [] + }, + "nodeType": "YulCase", + "src": "82:10:1", + "value": "default" + } + ], + "expression": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "70:1:1", + "type": "", + "value": "0" + }, + "nodeType": "YulSwitch", + "src": "63:29:1" + } + ] + }, + "evmVersion": "london", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "52:42:1" + } + ] + }, + "functionSelector": "e2179b8e", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "g", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 6, + "src": "17:83:1", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:102:1", + "usedErrors": [] + } + ], + "src": "0:103:1" +} diff --git a/ethers-solc/test-data/ast/two_base_functions.json b/ethers-solc/test-data/ast/two_base_functions.json new file mode 100644 index 00000000..23bdf6ef --- /dev/null +++ b/ethers-solc/test-data/ast/two_base_functions.json @@ -0,0 +1,272 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "A": + [ + 5 + ], + "B": + [ + 10 + ], + "C": + [ + 22 + ] + }, + "id": 23, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "A", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 5, + "linearizedBaseContracts": + [ + 5 + ], + "name": "A", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 3, + "nodeType": "Block", + "src": "45:2:1", + "statements": [] + }, + "functionSelector": "26121ff0", + "id": 4, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "45:0:1" + }, + "scope": 5, + "src": "17:30:1", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + } + ], + "scope": 23, + "src": "0:49:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "B", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 10, + "linearizedBaseContracts": + [ + 10 + ], + "name": "B", + "nameLocation": "59:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 8, + "nodeType": "Block", + "src": "95:2:1", + "statements": [] + }, + "functionSelector": "26121ff0", + "id": 9, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "76:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 6, + "nodeType": "ParameterList", + "parameters": [], + "src": "77:2:1" + }, + "returnParameters": + { + "id": 7, + "nodeType": "ParameterList", + "parameters": [], + "src": "95:0:1" + }, + "scope": 10, + "src": "67:30:1", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + } + ], + "scope": 23, + "src": "50:49:1", + "usedErrors": [] + }, + { + "abstract": false, + "baseContracts": + [ + { + "baseName": + { + "id": 11, + "name": "A", + "nameLocations": + [ + "114:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 5, + "src": "114:1:1" + }, + "id": 12, + "nodeType": "InheritanceSpecifier", + "src": "114:1:1" + }, + { + "baseName": + { + "id": 13, + "name": "B", + "nameLocations": + [ + "117:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 10, + "src": "117:1:1" + }, + "id": 14, + "nodeType": "InheritanceSpecifier", + "src": "117:1:1" + } + ], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 22, + "linearizedBaseContracts": + [ + 22, + 10, + 5 + ], + "name": "C", + "nameLocation": "109:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "baseFunctions": + [ + 4, + 9 + ], + "body": + { + "id": 20, + "nodeType": "Block", + "src": "160:2:1", + "statements": [] + }, + "functionSelector": "26121ff0", + "id": 21, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "134:1:1", + "nodeType": "FunctionDefinition", + "overrides": + { + "id": 18, + "nodeType": "OverrideSpecifier", + "overrides": + [ + { + "id": 16, + "name": "A", + "nameLocations": + [ + "154:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 5, + "src": "154:1:1" + }, + { + "id": 17, + "name": "B", + "nameLocations": + [ + "157:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 10, + "src": "157:1:1" + } + ], + "src": "145:14:1" + }, + "parameters": + { + "id": 15, + "nodeType": "ParameterList", + "parameters": [], + "src": "135:2:1" + }, + "returnParameters": + { + "id": 19, + "nodeType": "ParameterList", + "parameters": [], + "src": "160:0:1" + }, + "scope": 22, + "src": "125:37:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 23, + "src": "100:64:1", + "usedErrors": [] + } + ], + "src": "0:165:1" +} diff --git a/ethers-solc/test-data/ast/unicode.json b/ethers-solc/test-data/ast/unicode.json new file mode 100644 index 00000000..dcb267b3 --- /dev/null +++ b/ethers-solc/test-data/ast/unicode.json @@ -0,0 +1,136 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 9 + ] + }, + "id": 10, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 9, + "linearizedBaseContracts": + [ + 9 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 7, + "nodeType": "Block", + "src": "33:42:1", + "statements": + [ + { + "assignments": + [ + 4 + ], + "declarations": + [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "x", + "nameLocation": "49:1:1", + "nodeType": "VariableDeclaration", + "scope": 7, + "src": "35:15:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": + { + "id": 3, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "35:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 6, + "initialValue": + { + "hexValue": "48656c6c6f20f09f9883", + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "unicodeString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "53:19:1", + "typeDescriptions": + { + "typeIdentifier": "t_stringliteral_cd7a99177cebb3d14b8cc54e313dbf76867c71cd6fbb9a33ce3870dc80e9992b", + "typeString": "literal_string hex\"48656c6c6f20f09f9883\"" + }, + "value": "Hello \ud83d\ude03" + }, + "nodeType": "VariableDeclarationStatement", + "src": "35:37:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 8, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "22:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 9, + "src": "13:62:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 10, + "src": "0:77:1", + "usedErrors": [] + } + ], + "src": "0:78:1" +} diff --git a/ethers-solc/test-data/ast/used_errors.json b/ethers-solc/test-data/ast/used_errors.json new file mode 100644 index 00000000..c59b4f53 --- /dev/null +++ b/ethers-solc/test-data/ast/used_errors.json @@ -0,0 +1,235 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 19 + ], + "X": + [ + 2 + ], + "f": + [ + 9 + ] + }, + "id": 20, + "nodeType": "SourceUnit", + "nodes": + [ + { + "errorSelector": "c1599bd9", + "id": 2, + "name": "X", + "nameLocation": "6:1:1", + "nodeType": "ErrorDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "7:2:1" + }, + "src": "0:10:1" + }, + { + "body": + { + "id": 8, + "nodeType": "Block", + "src": "29:15:1", + "statements": + [ + { + "errorCall": + { + "arguments": [], + "expression": + { + "argumentTypes": [], + "id": 5, + "name": "X", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2, + "src": "38:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_function_error_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "38:3:1", + "tryCall": false, + "typeDescriptions": + { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 7, + "nodeType": "RevertStatement", + "src": "31:10:1" + } + ] + }, + "id": 9, + "implemented": true, + "kind": "freeFunction", + "modifiers": [], + "name": "f", + "nameLocation": "20:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 3, + "nodeType": "ParameterList", + "parameters": [], + "src": "21:2:1" + }, + "returnParameters": + { + "id": 4, + "nodeType": "ParameterList", + "parameters": [], + "src": "29:0:1" + }, + "scope": 20, + "src": "11:33:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 19, + "linearizedBaseContracts": + [ + 19 + ], + "name": "C", + "nameLocation": "54:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "errorSelector": "2bc80f3a", + "id": 11, + "name": "T", + "nameLocation": "68:1:1", + "nodeType": "ErrorDefinition", + "parameters": + { + "id": 10, + "nodeType": "ParameterList", + "parameters": [], + "src": "69:2:1" + }, + "src": "62:10:1" + }, + { + "body": + { + "id": 17, + "nodeType": "Block", + "src": "97:8:1", + "statements": + [ + { + "expression": + { + "arguments": [], + "expression": + { + "argumentTypes": [], + "id": 14, + "name": "f", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "99:1:1", + "typeDescriptions": + { + "typeIdentifier": "t_function_internal_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 15, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "99:3:1", + "tryCall": false, + "typeDescriptions": + { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 16, + "nodeType": "ExpressionStatement", + "src": "99:3:1" + } + ] + }, + "functionSelector": "b8c9d365", + "id": 18, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "h", + "nameLocation": "86:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 12, + "nodeType": "ParameterList", + "parameters": [], + "src": "87:2:1" + }, + "returnParameters": + { + "id": 13, + "nodeType": "ParameterList", + "parameters": [], + "src": "97:0:1" + }, + "scope": 19, + "src": "77:28:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 20, + "src": "45:62:1", + "usedErrors": + [ + 2, + 11 + ] + } + ], + "src": "0:108:1" +} diff --git a/ethers-solc/test-data/ast/userDefinedValueType.json b/ethers-solc/test-data/ast/userDefinedValueType.json new file mode 100644 index 00000000..17bb19ef --- /dev/null +++ b/ethers-solc/test-data/ast/userDefinedValueType.json @@ -0,0 +1,355 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 27 + ], + "MyAddress": + [ + 2 + ], + "MyUInt": + [ + 4 + ], + "f": + [ + 16 + ] + }, + "id": 28, + "nodeType": "SourceUnit", + "nodes": + [ + { + "canonicalName": "MyAddress", + "id": 2, + "name": "MyAddress", + "nameLocation": "5:9:1", + "nodeType": "UserDefinedValueTypeDefinition", + "src": "0:26:1", + "underlyingType": + { + "id": 1, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "18:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": + { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + }, + { + "canonicalName": "MyUInt", + "id": 4, + "name": "MyUInt", + "nameLocation": "32:6:1", + "nodeType": "UserDefinedValueTypeDefinition", + "src": "27:20:1", + "underlyingType": + { + "id": 3, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "42:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + { + "body": + { + "id": 15, + "nodeType": "Block", + "src": "61:34:1", + "statements": + [ + { + "assignments": + [ + 9 + ], + "declarations": + [ + { + "constant": false, + "id": 9, + "mutability": "mutable", + "name": "a", + "nameLocation": "77:1:1", + "nodeType": "VariableDeclaration", + "scope": 15, + "src": "67:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_userDefinedValueType$_MyAddress_$2", + "typeString": "MyAddress" + }, + "typeName": + { + "id": 8, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 7, + "name": "MyAddress", + "nameLocations": + [ + "67:9:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2, + "src": "67:9:1" + }, + "referencedDeclaration": 2, + "src": "67:9:1", + "typeDescriptions": + { + "typeIdentifier": "t_userDefinedValueType$_MyAddress_$2", + "typeString": "MyAddress" + } + }, + "visibility": "internal" + } + ], + "id": 10, + "nodeType": "VariableDeclarationStatement", + "src": "67:11:1" + }, + { + "assignments": + [ + 13 + ], + "declarations": + [ + { + "constant": false, + "id": 13, + "mutability": "mutable", + "name": "b", + "nameLocation": "91:1:1", + "nodeType": "VariableDeclaration", + "scope": 15, + "src": "84:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_userDefinedValueType$_MyUInt_$4", + "typeString": "MyUInt" + }, + "typeName": + { + "id": 12, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 11, + "name": "MyUInt", + "nameLocations": + [ + "84:6:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4, + "src": "84:6:1" + }, + "referencedDeclaration": 4, + "src": "84:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_userDefinedValueType$_MyUInt_$4", + "typeString": "MyUInt" + } + }, + "visibility": "internal" + } + ], + "id": 14, + "nodeType": "VariableDeclarationStatement", + "src": "84:8:1" + } + ] + }, + "id": 16, + "implemented": true, + "kind": "freeFunction", + "modifiers": [], + "name": "f", + "nameLocation": "57:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 5, + "nodeType": "ParameterList", + "parameters": [], + "src": "58:2:1" + }, + "returnParameters": + { + "id": 6, + "nodeType": "ParameterList", + "parameters": [], + "src": "61:0:1" + }, + "scope": 28, + "src": "48:47:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 27, + "linearizedBaseContracts": + [ + 27 + ], + "name": "C", + "nameLocation": "105:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "canonicalName": "C.MyAddress", + "id": 18, + "name": "MyAddress", + "nameLocation": "118:9:1", + "nodeType": "UserDefinedValueTypeDefinition", + "src": "113:26:1", + "underlyingType": + { + "id": 17, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "131:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": + { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + }, + { + "canonicalName": "C.MyUInt", + "id": 20, + "name": "MyUInt", + "nameLocation": "149:6:1", + "nodeType": "UserDefinedValueTypeDefinition", + "src": "144:20:1", + "underlyingType": + { + "id": 19, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "159:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + { + "constant": false, + "functionSelector": "97682884", + "id": 26, + "mutability": "mutable", + "name": "m", + "nameLocation": "205:1:1", + "nodeType": "VariableDeclaration", + "scope": 27, + "src": "169:37:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_userDefinedValueType$_MyAddress_$18_$_t_userDefinedValueType$_MyUInt_$20_$", + "typeString": "mapping(C.MyAddress => C.MyUInt)" + }, + "typeName": + { + "id": 25, + "keyType": + { + "id": 22, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 21, + "name": "MyAddress", + "nameLocations": + [ + "177:9:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 18, + "src": "177:9:1" + }, + "referencedDeclaration": 18, + "src": "177:9:1", + "typeDescriptions": + { + "typeIdentifier": "t_userDefinedValueType$_MyAddress_$18", + "typeString": "C.MyAddress" + } + }, + "nodeType": "Mapping", + "src": "169:28:1", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_userDefinedValueType$_MyAddress_$18_$_t_userDefinedValueType$_MyUInt_$20_$", + "typeString": "mapping(C.MyAddress => C.MyUInt)" + }, + "valueType": + { + "id": 24, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 23, + "name": "MyUInt", + "nameLocations": + [ + "190:6:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 20, + "src": "190:6:1" + }, + "referencedDeclaration": 20, + "src": "190:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_userDefinedValueType$_MyUInt_$20", + "typeString": "C.MyUInt" + } + } + }, + "visibility": "public" + } + ], + "scope": 28, + "src": "96:113:1", + "usedErrors": [] + } + ], + "src": "0:210:1" +} diff --git a/ethers-solc/test-data/ast/using_for_directive.json b/ethers-solc/test-data/ast/using_for_directive.json new file mode 100644 index 00000000..57658134 --- /dev/null +++ b/ethers-solc/test-data/ast/using_for_directive.json @@ -0,0 +1,186 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 13 + ], + "L": + [ + 4 + ], + "f": + [ + 10 + ] + }, + "id": 14, + "nodeType": "SourceUnit", + "nodes": + [ + { + "functionList": + [ + { + "function": + { + "id": 1, + "name": "f", + "nameLocations": + [ + "7:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 10, + "src": "7:1:1" + } + } + ], + "global": false, + "id": 3, + "nodeType": "UsingForDirective", + "src": "0:19:1", + "typeName": + { + "id": 2, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "14:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "L", + "contractDependencies": [], + "contractKind": "library", + "fullyImplemented": true, + "id": 4, + "linearizedBaseContracts": + [ + 4 + ], + "name": "L", + "nameLocation": "28:1:1", + "nodeType": "ContractDefinition", + "nodes": [], + "scope": 14, + "src": "20:12:1", + "usedErrors": [] + }, + { + "body": + { + "id": 9, + "nodeType": "Block", + "src": "50:2:1", + "statements": [] + }, + "id": 10, + "implemented": true, + "kind": "freeFunction", + "modifiers": [], + "name": "f", + "nameLocation": "42:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 7, + "nodeType": "ParameterList", + "parameters": + [ + { + "constant": false, + "id": 6, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 10, + "src": "44:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 5, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "44:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "43:6:1" + }, + "returnParameters": + { + "id": 8, + "nodeType": "ParameterList", + "parameters": [], + "src": "50:0:1" + }, + "scope": 14, + "src": "33:19:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 13, + "linearizedBaseContracts": + [ + 13 + ], + "name": "C", + "nameLocation": "62:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "global": false, + "id": 12, + "libraryName": + { + "id": 11, + "name": "L", + "nameLocations": + [ + "72:1:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4, + "src": "72:1:1" + }, + "nodeType": "UsingForDirective", + "src": "66:14:1" + } + ], + "scope": 14, + "src": "53:29:1", + "usedErrors": [] + } + ], + "src": "0:83:1" +} diff --git a/ethers-solc/test-data/ast/var_access.json b/ethers-solc/test-data/ast/var_access.json new file mode 100644 index 00000000..bff9d9e8 --- /dev/null +++ b/ethers-solc/test-data/ast/var_access.json @@ -0,0 +1,162 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 9 + ] + }, + "id": 10, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 9, + "linearizedBaseContracts": + [ + 9 + ], + "name": "C", + "nameLocation": "9:1:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 7, + "nodeType": "Block", + "src": "42:51:1", + "statements": + [ + { + "assignments": + [ + 4 + ], + "declarations": + [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "x", + "nameLocation": "57:1:1", + "nodeType": "VariableDeclaration", + "scope": 7, + "src": "52:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 3, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "52:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5, + "nodeType": "VariableDeclarationStatement", + "src": "52:6:1" + }, + { + "AST": + { + "nodeType": "YulBlock", + "src": "77:10:1", + "statements": + [ + { + "nodeType": "YulAssignment", + "src": "79:6:1", + "value": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "84:1:1", + "type": "", + "value": "7" + }, + "variableNames": + [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "79:1:1" + } + ] + } + ] + }, + "evmVersion": "london", + "externalReferences": + [ + { + "declaration": 4, + "isOffset": false, + "isSlot": false, + "src": "79:1:1", + "valueSize": 1 + } + ], + "id": 6, + "nodeType": "InlineAssembly", + "src": "68:19:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 8, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "26:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "27:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "42:0:1" + }, + "scope": 9, + "src": "17:76:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + } + ], + "scope": 10, + "src": "0:95:1", + "usedErrors": [] + } + ], + "src": "0:96:1" +} diff --git a/ethers-solc/test-data/ast/yul_hex_literal.json b/ethers-solc/test-data/ast/yul_hex_literal.json new file mode 100644 index 00000000..832a95d8 --- /dev/null +++ b/ethers-solc/test-data/ast/yul_hex_literal.json @@ -0,0 +1,155 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "Sample": + [ + 6 + ] + }, + "id": 7, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Sample", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 6, + "linearizedBaseContracts": + [ + 6 + ], + "name": "Sample", + "nameLocation": "9:6:1", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 4, + "nodeType": "Block", + "src": "47:167:1", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "66:142:1", + "statements": + [ + { + "nodeType": "YulVariableDeclaration", + "src": "80:15:1", + "value": + { + "hexValue": "74657374", + "kind": "string", + "nodeType": "YulLiteral", + "src": "89:6:1", + "type": "", + "value": "test" + }, + "variables": + [ + { + "name": "a", + "nodeType": "YulTypedName", + "src": "84:1:1", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "108:54:1", + "value": + { + "hexValue": "112233445566778899aabbccddeeff6677889900", + "kind": "string", + "nodeType": "YulLiteral", + "src": "117:45:1", + "type": "" + }, + "variables": + [ + { + "name": "b", + "nodeType": "YulTypedName", + "src": "112:1:1", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "175:23:1", + "value": + { + "hexValue": "1234abcd", + "kind": "string", + "nodeType": "YulLiteral", + "src": "184:14:1", + "type": "" + }, + "variables": + [ + { + "name": "c", + "nodeType": "YulTypedName", + "src": "179:1:1", + "type": "" + } + ] + } + ] + }, + "evmVersion": "loop", + "externalReferences": [], + "id": 3, + "nodeType": "InlineAssembly", + "src": "57:151:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 5, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nameLocation": "31:1:1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "32:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "47:0:1" + }, + "scope": 6, + "src": "22:192:1", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + } + ], + "scope": 7, + "src": "0:216:1", + "usedErrors": [] + } + ], + "src": "0:217:1" +} diff --git a/ethers-solc/test-data/bytes.sol b/ethers-solc/test-data/bytes.sol new file mode 100644 index 00000000..e69de29b