From d5c43d5af5656891028a24c122de6260cb517102 Mon Sep 17 00:00:00 2001 From: Sean Billig Date: Mon, 28 Mar 2022 16:32:06 -0700 Subject: [PATCH] Swift-style argument labels (#666) --- .github/workflows/main.yml | 4 +- crates/abi/src/builder.rs | 12 +- crates/analyzer/src/db/queries/functions.rs | 49 +- crates/analyzer/src/namespace/types.rs | 17 + crates/analyzer/src/traversal/call_args.rs | 51 +- crates/analyzer/src/traversal/expressions.rs | 30 +- crates/analyzer/src/traversal/functions.rs | 3 +- .../analysis__abi_encoding_stress.snap | 24 +- .../analysis__address_bytes10_map.snap | 7 +- .../tests/snapshots/analysis__assert.snap | 10 +- .../snapshots/analysis__associated_fns.snap | 9 +- .../tests/snapshots/analysis__aug_assign.snap | 52 +- .../tests/snapshots/analysis__balances.snap | 7 +- .../tests/snapshots/analysis__base_tuple.snap | 4 +- .../snapshots/analysis__basic_ingot.snap | 13 +- .../analysis__call_statement_with_args.snap | 7 +- .../analysis__call_statement_with_args_2.snap | 7 +- .../analysis__checked_arithmetic.snap | 288 +- .../snapshots/analysis__create2_contract.snap | 3 +- .../snapshots/analysis__create_contract.snap | 3 +- .../analysis__data_copying_stress.snap | 53 +- .../snapshots/analysis__erc20_token.snap | 383 +-- .../tests/snapshots/analysis__events.snap | 17 +- .../analysis__external_contract.snap | 23 +- .../tests/snapshots/analysis__guest_book.snap | 7 +- .../snapshots/analysis__if_statement.snap | 3 +- .../snapshots/analysis__if_statement_2.snap | 3 +- .../tests/snapshots/analysis__keccak.snap | 9 +- .../tests/snapshots/analysis__math.snap | 7 +- .../analysis__module_level_events.snap | 5 +- .../snapshots/analysis__multi_param.snap | 5 +- .../tests/snapshots/analysis__nested_map.snap | 18 +- .../tests/snapshots/analysis__ownable.snap | 7 +- .../analysis__pure_fn_standalone.snap | 24 +- .../analysis__return_addition_i256.snap | 4 +- .../analysis__return_addition_u128.snap | 4 +- .../analysis__return_addition_u256.snap | 4 +- .../snapshots/analysis__return_array.snap | 3 +- .../analysis__return_bitwiseand_u128.snap | 4 +- .../analysis__return_bitwiseand_u256.snap | 4 +- .../analysis__return_bitwiseor_u256.snap | 4 +- .../analysis__return_bitwiseshl_u256.snap | 4 +- .../analysis__return_bitwiseshr_i256.snap | 4 +- .../analysis__return_bitwiseshr_u256.snap | 4 +- .../analysis__return_bitwisexor_u256.snap | 4 +- .../analysis__return_bool_inverted.snap | 3 +- .../analysis__return_bool_op_and.snap | 4 +- .../analysis__return_bool_op_or.snap | 4 +- .../analysis__return_builtin_attributes.snap | 27 +- .../analysis__return_division_i256.snap | 4 +- .../analysis__return_division_u256.snap | 4 +- .../snapshots/analysis__return_eq_u256.snap | 4 +- .../snapshots/analysis__return_gt_i256.snap | 4 +- .../snapshots/analysis__return_gt_u256.snap | 4 +- .../snapshots/analysis__return_gte_i256.snap | 4 +- .../snapshots/analysis__return_gte_u256.snap | 4 +- .../analysis__return_identity_u128.snap | 3 +- .../analysis__return_identity_u16.snap | 3 +- .../analysis__return_identity_u256.snap | 3 +- .../analysis__return_identity_u32.snap | 3 +- .../analysis__return_identity_u64.snap | 3 +- .../analysis__return_identity_u8.snap | 3 +- .../snapshots/analysis__return_lt_i256.snap | 4 +- .../snapshots/analysis__return_lt_u128.snap | 4 +- .../snapshots/analysis__return_lt_u256.snap | 4 +- .../snapshots/analysis__return_lte_i256.snap | 4 +- .../snapshots/analysis__return_lte_u256.snap | 4 +- .../snapshots/analysis__return_mod_i256.snap | 4 +- .../snapshots/analysis__return_mod_u256.snap | 4 +- .../snapshots/analysis__return_msg_sig.snap | 3 +- .../analysis__return_multiplication_i256.snap | 4 +- .../analysis__return_multiplication_u256.snap | 4 +- .../analysis__return_noteq_u256.snap | 4 +- .../snapshots/analysis__return_pow_i256.snap | 4 +- .../snapshots/analysis__return_pow_u256.snap | 4 +- .../analysis__return_subtraction_i256.snap | 4 +- .../analysis__return_subtraction_u256.snap | 4 +- ..._return_u256_from_called_fn_with_args.snap | 59 +- .../tests/snapshots/analysis__revert.snap | 25 +- .../snapshots/analysis__self_address.snap | 3 +- .../tests/snapshots/analysis__send_value.snap | 5 +- .../analysis__sized_vals_in_sto.snap | 12 +- .../tests/snapshots/analysis__strings.snap | 4 +- .../tests/snapshots/analysis__struct_fns.snap | 40 +- .../tests/snapshots/analysis__structs.snap | 6 +- .../analysis__ternary_expression.snap | 3 +- .../snapshots/analysis__tuple_stress.snap | 31 +- .../snapshots/analysis__two_contracts.snap | 21 +- .../snapshots/analysis__type_aliases.snap | 10 +- .../snapshots/analysis__u128_u128_map.snap | 7 +- .../snapshots/analysis__u16_u16_map.snap | 7 +- .../snapshots/analysis__u256_u256_map.snap | 7 +- .../snapshots/analysis__u32_u32_map.snap | 7 +- .../snapshots/analysis__u64_u64_map.snap | 7 +- .../tests/snapshots/analysis__u8_u8_map.snap | 7 +- .../tests/snapshots/analysis__uniswap.snap | 2606 +++++++++-------- .../errors__call_balance_of_with_2_args.snap | 2 +- ...rors__call_balance_of_with_wrong_type.snap | 2 +- ...rs__call_balance_of_without_parameter.snap | 2 +- .../errors__call_send_value_with_1_arg.snap | 17 + .../errors__call_send_value_with_3_args.snap | 17 + ...rors__call_send_value_with_wrong_type.snap | 12 + ...ors__call_send_value_with_wrong_type2.snap | 12 + .../snapshots/errors__emit_bad_args.snap | 12 +- .../errors__external_call_type_error.snap | 2 +- ..._external_call_wrong_number_of_params.snap | 8 + ...n_call_to_fn_with_param_type_mismatch.snap | 2 +- .../errors__undefined_type_param.snap | 6 +- crates/library/std/src/context.fe | 10 +- crates/library/std/src/evm.fe | 150 +- crates/library/std/src/lib.fe | 2 - crates/lowering/src/mappers/functions.rs | 1 + crates/lowering/src/mappers/module.rs | 1 + .../tests/snapshots/lowering__and_or.snap | 19 +- .../snapshots/lowering__list_expressions.snap | 5 +- .../snapshots/lowering__module_const.snap | 3 +- .../tests/snapshots/lowering__module_fn.snap | 3 +- .../tests/snapshots/lowering__struct_fn.snap | 3 +- .../tests/snapshots/lowering__ternary.snap | 5 +- crates/parser/src/ast.rs | 7 +- crates/parser/src/grammar/functions.rs | 17 +- crates/parser/tests/cases/parse_ast.rs | 2 +- .../snapshots/cases__parse_ast__fn_def.snap | 99 +- .../cases__parse_ast__fn_def_pub.snap | 4 +- .../cases__parse_ast__fn_def_pub_unsafe.snap | 4 +- .../cases__parse_ast__fn_def_unsafe.snap | 4 +- .../cases__parse_ast__guest_book.snap | 2 + ...cases__parse_ast__module_level_events.snap | 3 + .../cases__parse_ast__module_stmts.snap | 3 +- .../external_call_type_error.fe | 2 +- .../external_call_wrong_number_of_params.fe | 2 +- ...urn_call_to_fn_with_param_type_mismatch.fe | 2 +- .../fixtures/compile_errors/self_misuse.fe | 4 +- .../compile_errors/undefined_type_param.fe | 2 +- .../test-files/fixtures/demos/erc20_token.fe | 26 +- crates/test-files/fixtures/demos/uniswap.fe | 62 +- .../features/call_statement_with_args.fe | 2 +- .../features/call_statement_with_args_2.fe | 2 +- .../fixtures/features/ctx_init_in_call.fe | 4 +- .../features/ctx_param_external_func_call.fe | 2 +- .../fixtures/features/pure_fn_standalone.fe | 6 +- .../features/return_sum_list_expression_2.fe | 2 +- .../return_u256_from_called_fn_with_args.fe | 4 +- crates/test-files/fixtures/features/revert.fe | 2 +- .../fixtures/features/struct_fns.fe | 6 +- .../fixtures/features/two_contracts.fe | 4 +- .../fixtures/ingots/basic_ingot/src/bing.fe | 2 +- .../ingots/pub_contract_ingot/src/foo.fe | 2 +- crates/test-files/fixtures/lowering/and_or.fe | 18 +- .../test-files/fixtures/lowering/struct_fn.fe | 2 +- .../test-files/fixtures/lowering/ternary.fe | 9 +- crates/test-files/fixtures/printing/defs.fe | 2 +- .../fixtures/printing/expr_parens.fe | 2 +- .../printing/guest_book_no_comments.fe | 2 +- .../fixtures/stress/data_copying_stress.fe | 4 +- docs/src/spec/expressions/call.md | 11 +- docs/src/spec/expressions/tuple.md | 4 +- docs/src/spec/items/functions.md | 91 +- newsfragments/397.feature.md | 50 + 159 files changed, 2915 insertions(+), 2076 deletions(-) create mode 100644 crates/analyzer/tests/snapshots/errors__call_send_value_with_1_arg.snap create mode 100644 crates/analyzer/tests/snapshots/errors__call_send_value_with_3_args.snap create mode 100644 crates/analyzer/tests/snapshots/errors__call_send_value_with_wrong_type.snap create mode 100644 crates/analyzer/tests/snapshots/errors__call_send_value_with_wrong_type2.snap create mode 100644 newsfragments/397.feature.md diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e067431a50..131af90254 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,8 +68,8 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: --workspace --all-targets --all-features -- -D warnings -A clippy::upper-case-acronyms -A clippy::large-enum-variant -W clippy::redundant_closure_for_method_calls - + args: --workspace --all-targets --all-features -- -D warnings -W clippy::redundant_closure_for_method_calls + book: runs-on: ubuntu-latest steps: diff --git a/crates/abi/src/builder.rs b/crates/abi/src/builder.rs index 5e5b956936..6ba24ba074 100644 --- a/crates/abi/src/builder.rs +++ b/crates/abi/src/builder.rs @@ -130,11 +130,12 @@ mod tests { use crate::builder; use fe_analyzer::namespace::items::ModuleId; use fe_analyzer::TestDb; + use fe_common::diagnostics::print_diagnostics; #[test] fn build_contract_abi() { let contract = r#" -pub fn add(x: u256, y: u256) -> u256: +pub fn add(_ x: u256, _ y: u256) -> u256: return x + y contract Foo: @@ -142,16 +143,19 @@ contract Foo: idx barge: u256 pub fn __init__(x: address): pass - fn baz(x: address) -> u256: + fn baz(_ x: address) -> u256: add(10, 20) revert - pub fn bar(x: u256) -> Array: + pub fn bar(_ x: u256) -> Array: revert"#; let mut db = TestDb::default(); let module = ModuleId::new_standalone(&mut db, "test_module", contract); - fe_analyzer::analyze_module(&db, module).expect("failed to analyze source"); + if !module.diagnostics(&db).is_empty() { + print_diagnostics(&db, &module.diagnostics(&db)); + panic!("failed to analyze source") + } let abis = builder::module(&db, module).expect("unable to build ABI"); if let Some(abi) = abis.get("Foo") { diff --git a/crates/analyzer/src/db/queries/functions.rs b/crates/analyzer/src/db/queries/functions.rs index 89b80fb8b7..bf6d22f8dd 100644 --- a/crates/analyzer/src/db/queries/functions.rs +++ b/crates/analyzer/src/db/queries/functions.rs @@ -41,6 +41,8 @@ pub fn function_signature( let mut self_decl = None; let mut ctx_decl = None; let mut names = HashMap::new(); + let mut labels = HashMap::new(); + let params = def .args .iter() @@ -65,15 +67,12 @@ pub fn function_signature( } None } - ast::FunctionArg::Regular(ast::RegularFunctionArg { - name, - typ: typ_node, - }) => { - let typ = type_desc(&mut scope, typ_node).and_then(|typ| match typ.try_into() { + ast::FunctionArg::Regular(reg) => { + let typ = type_desc(&mut scope, ®.typ).and_then(|typ| match typ.try_into() { Ok(typ) => Ok(typ), Err(_) => Err(TypeError::new(scope.error( "function parameter types must have fixed size", - typ_node.span, + reg.typ.span, "`Map` type can't be used as a function parameter", ))), }); @@ -110,30 +109,50 @@ pub fn function_signature( } } - if let Ok(Some(named_item)) = scope.resolve_name(&name.kind, name.span) { + if let Some(label) = ®.label { + if_chain! { + if label.kind != "_"; + if let Some(dup_idx) = labels.get(&label.kind); + then { + let dup_arg: &Node = &def.args[*dup_idx]; + scope.fancy_error( + &format!("duplicate parameter labels in function `{}`", def.name.kind), + vec![ + Label::primary(dup_arg.span, "the label `{}` was first used here"), + Label::primary(label.span, "label `{}` used again here"), + ], vec![]); + return None; + } else { + labels.insert(&label.kind, index); + } + } + } + + if let Ok(Some(named_item)) = scope.resolve_name(®.name.kind, reg.name.span) { scope.name_conflict_error( "function parameter", - &name.kind, + ®.name.kind, &named_item, named_item.name_span(db), - name.span, + reg.name.span, ); None - } else if let Some(dup_idx) = names.get(&name.kind) { + } else if let Some(dup_idx) = names.get(®.name.kind) { let dup_arg: &Node = &def.args[*dup_idx]; scope.duplicate_name_error( &format!("duplicate parameter names in function `{}`", def.name.kind), - &name.kind, + ®.name.kind, dup_arg.span, arg.span, ); None } else { - names.insert(&name.kind, index); - Some(types::FunctionParam { - name: name.kind.clone(), + names.insert(®.name.kind, index); + Some(types::FunctionParam::new( + reg.label.as_ref().map(|s| s.kind.as_str()), + ®.name.kind, typ, - }) + )) } } }) diff --git a/crates/analyzer/src/namespace/types.rs b/crates/analyzer/src/namespace/types.rs index 9e1d8ab0ca..4b5a4bb741 100644 --- a/crates/analyzer/src/namespace/types.rs +++ b/crates/analyzer/src/namespace/types.rs @@ -174,9 +174,26 @@ pub enum CtxDecl { #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct FunctionParam { + label: Option, pub name: SmolStr, pub typ: Result, } +impl FunctionParam { + pub fn new(label: Option<&str>, name: &str, typ: Result) -> Self { + Self { + label: label.map(SmolStr::new), + name: name.into(), + typ, + } + } + pub fn label(&self) -> Option<&str> { + match &self.label { + Some(label) if label == "_" => None, + Some(label) => Some(label), + None => Some(&self.name), + } + } +} #[derive( Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, EnumString, AsRefStr, EnumIter, diff --git a/crates/analyzer/src/traversal/call_args.rs b/crates/analyzer/src/traversal/call_args.rs index ec92199555..d4af67ef47 100644 --- a/crates/analyzer/src/traversal/call_args.rs +++ b/crates/analyzer/src/traversal/call_args.rs @@ -15,7 +15,7 @@ pub trait LabeledParameter { impl LabeledParameter for FunctionParam { fn label(&self) -> Option<&str> { - Some(&self.name) + self.label() } fn typ(&self) -> Result { self.typ.clone() @@ -40,20 +40,6 @@ impl LabeledParameter for (SmolStr, Result) { } } -pub fn validate_named_args( - context: &mut dyn AnalyzerContext, - name: &str, - name_span: Span, - args: &Node>>, - params: &[impl LabeledParameter], - label_policy: LabelPolicy, -) -> Result<(), FatalError> { - validate_arg_count(context, name, name_span, args, params.len(), "argument"); - validate_arg_labels(context, args, params, label_policy); - validate_arg_types(context, name, args, params)?; - Ok(()) -} - pub fn validate_arg_count( context: &mut dyn AnalyzerContext, name: &str, @@ -102,22 +88,18 @@ pub fn validate_arg_count( } } -pub enum LabelPolicy { - AllowAnyUnlabeled, - AllowUnlabeledIfNameEqual, -} - -pub fn validate_arg_labels( +// TODO: missing label error should suggest adding `_` to fn def +pub fn validate_named_args( context: &mut dyn AnalyzerContext, + name: &str, + name_span: Span, args: &Node>>, params: &[impl LabeledParameter], - label_policy: LabelPolicy, -) { - for (expected_label, arg) in params - .iter() - .map(LabeledParameter::label) - .zip(args.kind.iter()) - { +) -> Result<(), FatalError> { + validate_arg_count(context, name, name_span, args, params.len(), "argument"); + + for (index, (param, arg)) in params.iter().zip(args.kind.iter()).enumerate() { + let expected_label = param.label(); let arg_val = &arg.kind.value; match (expected_label, &arg.kind.label) { (Some(expected_label), Some(actual_label)) => { @@ -143,8 +125,7 @@ pub fn validate_arg_labels( (Some(expected_label), None) => match &arg_val.kind { fe::Expr::Name(var_name) if var_name == expected_label => {} _ => { - if let LabelPolicy::AllowUnlabeledIfNameEqual = label_policy { - context.fancy_error( + context.fancy_error( "missing argument label", vec![Label::primary( Span::new(arg_val.span.file_id, arg_val.span.start, arg_val.span.start), @@ -155,7 +136,6 @@ pub fn validate_arg_labels( expected_label )], ); - } } }, (None, Some(actual_label)) => { @@ -167,16 +147,7 @@ pub fn validate_arg_labels( } (None, None) => {} } - } -} -pub fn validate_arg_types( - context: &mut dyn AnalyzerContext, - name: &str, - args: &Node>>, - params: &[impl LabeledParameter], -) -> Result<(), FatalError> { - for (index, (param, arg)) in params.iter().zip(args.kind.iter()).enumerate() { let param_type = param.typ()?; let val_attrs = assignable_expr(context, &arg.kind.value, Some(¶m_type.clone().into()))?; diff --git a/crates/analyzer/src/traversal/expressions.rs b/crates/analyzer/src/traversal/expressions.rs index 2b2ed8f079..a1db737818 100644 --- a/crates/analyzer/src/traversal/expressions.rs +++ b/crates/analyzer/src/traversal/expressions.rs @@ -7,7 +7,7 @@ use crate::namespace::types::{ Array, Base, Contract, FeString, Integer, Struct, Tuple, Type, TypeDowncast, U256, }; use crate::operations; -use crate::traversal::call_args::{validate_arg_count, validate_named_args, LabelPolicy}; +use crate::traversal::call_args::{validate_arg_count, validate_named_args}; use crate::traversal::types::apply_generic_type_args; use crate::traversal::utils::{add_bin_operations_errors, types_to_fixed_sizes}; use fe_common::diagnostics::Label; @@ -1097,14 +1097,7 @@ fn expr_call_pure( let sig = function.signature(context.db()); let name_span = function.name_span(context.db()); - validate_named_args( - context, - &fn_name, - name_span, - args, - &sig.params, - LabelPolicy::AllowAnyUnlabeled, - )?; + validate_named_args(context, &fn_name, name_span, args, &sig.params)?; let return_type = sig.return_type.clone()?; let return_location = Location::assign_location(&return_type); @@ -1319,14 +1312,7 @@ fn expr_call_struct_constructor( .iter() .map(|(name, field)| (name.clone(), field.typ(db))) .collect::>(); - validate_named_args( - context, - name, - name_span, - args, - &fields, - LabelPolicy::AllowUnlabeledIfNameEqual, - )?; + validate_named_args(context, name, name_span, args, &fields)?; Ok(( ExpressionAttributes::new(Type::Struct(struct_.clone()), Location::Memory), @@ -1405,19 +1391,13 @@ fn expr_call_method( } let sig = method.signature(context.db()); + let params = if is_self { &sig.params } else { sig.external_params() }; - validate_named_args( - context, - &field.kind, - field.span, - args, - params, - LabelPolicy::AllowAnyUnlabeled, - )?; + validate_named_args(context, &field.kind, field.span, args, params)?; let calltype = match class { Class::Contract(contract) => { diff --git a/crates/analyzer/src/traversal/functions.rs b/crates/analyzer/src/traversal/functions.rs index 252cbe78ce..e3769f8580 100644 --- a/crates/analyzer/src/traversal/functions.rs +++ b/crates/analyzer/src/traversal/functions.rs @@ -3,7 +3,6 @@ use crate::errors::FatalError; use crate::namespace::items::Item; use crate::namespace::scopes::{BlockScope, BlockScopeType}; use crate::namespace::types::{Base, EventField, FixedSize, Type}; -use crate::traversal::call_args::LabelPolicy; use crate::traversal::{assignments, call_args, declarations, expressions}; use fe_common::diagnostics::Label; use fe_parser::ast as fe; @@ -165,6 +164,7 @@ fn emit(scope: &mut BlockScope, stmt: &Node) -> Result<(), FatalEr } Some(NamedThing::Item(Item::Event(event))) => { scope.root.add_emit(stmt, event); + // Check visibility of event. if !event.is_public(scope.db()) && event.module(scope.db()) != scope.module() { let module_name = event.module(scope.db()).name(scope.db()); @@ -203,7 +203,6 @@ fn emit(scope: &mut BlockScope, stmt: &Node) -> Result<(), FatalEr name.span, args, ¶ms_with_ctx, - LabelPolicy::AllowUnlabeledIfNameEqual, )?; } else { scope.fancy_error( diff --git a/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap b/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap index 33c6ec133b..7fd546442f 100644 --- a/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap @@ -52,7 +52,7 @@ note: │ 25 │ ╭ pub fn set_my_addrs(self, my_addrs: Array): 26 │ │ self.my_addrs = my_addrs - │ ╰────────────────────────────────^ attributes hash: 7225178954146834617 + │ ╰────────────────────────────────^ attributes hash: 8893819222299525150 │ = FunctionSignature { self_decl: Some( @@ -61,6 +61,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_addrs", typ: Ok( Array( @@ -139,7 +140,7 @@ note: │ 31 │ ╭ pub fn set_my_u128(self, my_u128: u128): 32 │ │ self.my_u128 = my_u128 - │ ╰──────────────────────────────^ attributes hash: 16833095980961190060 + │ ╰──────────────────────────────^ attributes hash: 15199964699853061770 │ = FunctionSignature { self_decl: Some( @@ -148,6 +149,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_u128", typ: Ok( Base( @@ -218,7 +220,7 @@ note: │ 37 │ ╭ pub fn set_my_string(self, my_string: String<10>): 38 │ │ self.my_string = my_string - │ ╰──────────────────────────────────^ attributes hash: 13678851319113960096 + │ ╰──────────────────────────────────^ attributes hash: 241116312146617781 │ = FunctionSignature { self_decl: Some( @@ -227,6 +229,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_string", typ: Ok( String( @@ -303,7 +306,7 @@ note: │ 43 │ ╭ pub fn set_my_u16s(self, my_u16s: Array): 44 │ │ self.my_u16s = my_u16s - │ ╰──────────────────────────────^ attributes hash: 9530217842745939939 + │ ╰──────────────────────────────^ attributes hash: 15015381430419725173 │ = FunctionSignature { self_decl: Some( @@ -312,6 +315,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_u16s", typ: Ok( Array( @@ -394,7 +398,7 @@ note: │ 49 │ ╭ pub fn set_my_bool(self, my_bool: bool): 50 │ │ self.my_bool = my_bool - │ ╰──────────────────────────────^ attributes hash: 10417435431418466528 + │ ╰──────────────────────────────^ attributes hash: 3845928701529339179 │ = FunctionSignature { self_decl: Some( @@ -403,6 +407,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_bool", typ: Ok( Base( @@ -469,7 +474,7 @@ note: │ 55 │ ╭ pub fn set_my_bytes(self, my_bytes: Array): 56 │ │ self.my_bytes = my_bytes - │ ╰────────────────────────────────^ attributes hash: 13662868865403802267 + │ ╰────────────────────────────────^ attributes hash: 11573101353594183790 │ = FunctionSignature { self_decl: Some( @@ -478,6 +483,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_bytes", typ: Ok( Array( @@ -626,13 +632,14 @@ note: 72 │ │ my_struct.my_bool = false 73 │ │ my_struct.my_addr = address(9999) 74 │ │ return my_struct - │ ╰────────────────────────^ attributes hash: 1420756747700131039 + │ ╰────────────────────────^ attributes hash: 11747697140833990696 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_struct", typ: Ok( Struct( @@ -722,7 +729,7 @@ note: · │ 84 │ │ my_bytes: self.my_bytes.to_mem() 85 │ │ ) - │ ╰─────────^ attributes hash: 5828909688388067108 + │ ╰─────────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -733,6 +740,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( diff --git a/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap b/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap index fe15e62797..ca8cd9645f 100644 --- a/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap @@ -14,7 +14,7 @@ note: │ 4 │ ╭ pub fn read_bar(self, key: address) -> Array: 5 │ │ return self.bar[key].to_mem() - │ ╰─────────────────────────────────────^ attributes hash: 10371061185540732837 + │ ╰─────────────────────────────────────^ attributes hash: 7365261960972751402 │ = FunctionSignature { self_decl: Some( @@ -23,6 +23,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -74,7 +75,7 @@ note: │ 7 │ ╭ pub fn write_bar(self, key: address, value: Array): 8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 5919689659161919529 + │ ╰─────────────────────────────^ attributes hash: 10331226497424577374 │ = FunctionSignature { self_decl: Some( @@ -83,6 +84,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -91,6 +93,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Array( diff --git a/crates/analyzer/tests/snapshots/analysis__assert.snap b/crates/analyzer/tests/snapshots/analysis__assert.snap index 4fd1e142d9..8697cf7847 100644 --- a/crates/analyzer/tests/snapshots/analysis__assert.snap +++ b/crates/analyzer/tests/snapshots/analysis__assert.snap @@ -16,13 +16,14 @@ note: │ 5 │ ╭ pub fn bar(baz: u256): 6 │ │ assert baz > 5 - │ ╰──────────────────────^ attributes hash: 1354114416662435681 + │ ╰──────────────────────^ attributes hash: 2614610269237134179 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "baz", typ: Ok( Base( @@ -59,13 +60,14 @@ note: │ 8 │ ╭ pub fn revert_with_static_string(baz: u256): 9 │ │ assert baz > 5, "Must be greater than five" - │ ╰───────────────────────────────────────────────────^ attributes hash: 1354114416662435681 + │ ╰───────────────────────────────────────────────────^ attributes hash: 2614610269237134179 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "baz", typ: Ok( Base( @@ -104,13 +106,14 @@ note: │ 11 │ ╭ pub fn revert_with(baz: u256, reason: String<1000>): 12 │ │ assert baz > 5, reason - │ ╰──────────────────────────────^ attributes hash: 10290486639185495177 + │ ╰──────────────────────────────^ attributes hash: 10044481770469626577 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "baz", typ: Ok( Base( @@ -121,6 +124,7 @@ note: ), }, FunctionParam { + label: None, name: "reason", typ: Ok( String( diff --git a/crates/analyzer/tests/snapshots/analysis__associated_fns.snap b/crates/analyzer/tests/snapshots/analysis__associated_fns.snap index bad04b552a..7b4cfea9b9 100644 --- a/crates/analyzer/tests/snapshots/analysis__associated_fns.snap +++ b/crates/analyzer/tests/snapshots/analysis__associated_fns.snap @@ -8,13 +8,14 @@ note: │ 3 │ ╭ pub fn square(x: u256) -> u256: 4 │ │ return x * x - │ ╰────────────────^ attributes hash: 15549141040406273197 + │ ╰────────────────^ attributes hash: 6622018637299644818 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -59,13 +60,14 @@ note: │ 8 │ ╭ pub fn new(x: u256) -> MyStruct: 9 │ │ return MyStruct(x) - │ ╰──────────────────────^ attributes hash: 11200806103849825396 + │ ╰──────────────────────^ attributes hash: 2145703897684373991 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -110,7 +112,7 @@ note: 14 │ ╭ pub fn bar(self, val: u256) -> u256: 15 │ │ self.my_struct = MyStruct.new(val) 16 │ │ return Lib.square(self.my_struct.x) - │ ╰───────────────────────────────────────^ attributes hash: 10309470657675388254 + │ ╰───────────────────────────────────────^ attributes hash: 2950430758151367369 │ = FunctionSignature { self_decl: Some( @@ -119,6 +121,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "val", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__aug_assign.snap b/crates/analyzer/tests/snapshots/analysis__aug_assign.snap index ed242c4b16..5361ebc923 100644 --- a/crates/analyzer/tests/snapshots/analysis__aug_assign.snap +++ b/crates/analyzer/tests/snapshots/analysis__aug_assign.snap @@ -15,13 +15,14 @@ note: 4 │ ╭ pub fn add(a: u256, b: u256) -> u256: 5 │ │ a += b 6 │ │ return a - │ ╰────────────────^ attributes hash: 13032309683484417823 + │ ╰────────────────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -32,6 +33,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -67,13 +69,14 @@ note: 8 │ ╭ pub fn sub(a: u256, b: u256) -> u256: 9 │ │ a -= b 10 │ │ return a - │ ╰────────────────^ attributes hash: 13032309683484417823 + │ ╰────────────────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -84,6 +87,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -119,13 +123,14 @@ note: 12 │ ╭ pub fn mul(a: u256, b: u256) -> u256: 13 │ │ a *= b 14 │ │ return a - │ ╰────────────────^ attributes hash: 13032309683484417823 + │ ╰────────────────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -136,6 +141,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -171,13 +177,14 @@ note: 16 │ ╭ pub fn div(a: u256, b: u256) -> u256: 17 │ │ a /= b 18 │ │ return a - │ ╰────────────────^ attributes hash: 13032309683484417823 + │ ╰────────────────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -188,6 +195,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -223,13 +231,14 @@ note: 20 │ ╭ pub fn mod(a: u256, b: u256) -> u256: 21 │ │ a %= b 22 │ │ return a - │ ╰────────────────^ attributes hash: 13032309683484417823 + │ ╰────────────────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -240,6 +249,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -275,13 +285,14 @@ note: 24 │ ╭ pub fn pow(a: u256, b: u256) -> u256: 25 │ │ a **= b 26 │ │ return a - │ ╰────────────────^ attributes hash: 13032309683484417823 + │ ╰────────────────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -292,6 +303,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -327,13 +339,14 @@ note: 28 │ ╭ pub fn lshift(a: u8, b: u8) -> u8: 29 │ │ a <<= b 30 │ │ return a - │ ╰────────────────^ attributes hash: 3730615017690041521 + │ ╰────────────────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -344,6 +357,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -379,13 +393,14 @@ note: 32 │ ╭ pub fn rshift(a: u8, b: u8) -> u8: 33 │ │ a >>= b 34 │ │ return a - │ ╰────────────────^ attributes hash: 3730615017690041521 + │ ╰────────────────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -396,6 +411,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -431,13 +447,14 @@ note: 36 │ ╭ pub fn bit_or(a: u8, b: u8) -> u8: 37 │ │ a |= b 38 │ │ return a - │ ╰────────────────^ attributes hash: 3730615017690041521 + │ ╰────────────────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -448,6 +465,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -483,13 +501,14 @@ note: 40 │ ╭ pub fn bit_xor(a: u8, b: u8) -> u8: 41 │ │ a ^= b 42 │ │ return a - │ ╰────────────────^ attributes hash: 3730615017690041521 + │ ╰────────────────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -500,6 +519,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -535,13 +555,14 @@ note: 44 │ ╭ pub fn bit_and(a: u8, b: u8) -> u8: 45 │ │ a &= b 46 │ │ return a - │ ╰────────────────^ attributes hash: 3730615017690041521 + │ ╰────────────────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -552,6 +573,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -588,7 +610,7 @@ note: 49 │ │ self.my_num = a 50 │ │ self.my_num += b 51 │ │ return self.my_num - │ ╰──────────────────────────^ attributes hash: 1093272556881112321 + │ ╰──────────────────────────^ attributes hash: 3506345928150766050 │ = FunctionSignature { self_decl: Some( @@ -597,6 +619,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -607,6 +630,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -666,13 +690,14 @@ note: 55 │ │ my_array[7] = a 56 │ │ my_array[7] += b 57 │ │ return my_array[7] - │ ╰──────────────────────────^ attributes hash: 13032309683484417823 + │ ╰──────────────────────────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -683,6 +708,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__balances.snap b/crates/analyzer/tests/snapshots/analysis__balances.snap index 66f032dfa6..db25123286 100644 --- a/crates/analyzer/tests/snapshots/analysis__balances.snap +++ b/crates/analyzer/tests/snapshots/analysis__balances.snap @@ -8,7 +8,7 @@ note: │ 5 │ ╭ pub fn my_balance(self, ctx: Context) -> u256: 6 │ │ return ctx.self_balance() - │ ╰─────────────────────────────────^ attributes hash: 15791625094174035122 + │ ╰─────────────────────────────────^ attributes hash: 3247318976601732237 │ = FunctionSignature { self_decl: Some( @@ -19,6 +19,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -56,7 +57,7 @@ note: │ 8 │ ╭ pub fn other_balance(self, ctx: Context, someone: address) -> u256: 9 │ │ return ctx.balance_of(someone) - │ ╰──────────────────────────────────────^ attributes hash: 9663953415600931481 + │ ╰──────────────────────────────────────^ attributes hash: 7590750053308816492 │ = FunctionSignature { self_decl: Some( @@ -67,6 +68,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -78,6 +80,7 @@ note: ), }, FunctionParam { + label: None, name: "someone", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__base_tuple.snap b/crates/analyzer/tests/snapshots/analysis__base_tuple.snap index b4816d2f10..6f1e7390b7 100644 --- a/crates/analyzer/tests/snapshots/analysis__base_tuple.snap +++ b/crates/analyzer/tests/snapshots/analysis__base_tuple.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(my_num: u256, my_bool: bool) -> (u256, bool): 3 │ │ return (my_num, my_bool) - │ ╰────────────────────────────────^ attributes hash: 6474071346316096232 + │ ╰────────────────────────────────^ attributes hash: 10319049298189511667 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_num", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "my_bool", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap b/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap index 9964fbf5d5..632207963f 100644 --- a/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap +++ b/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap @@ -204,7 +204,7 @@ note: 30 │ ╭ pub fn create_bing_contract(ctx: Context) -> u256: 31 │ │ let bing_contract: BingContract = BingContract.create(ctx, 0) 32 │ │ return bing_contract.add(40, 50) - │ ╰────────────────────────────────────────^ attributes hash: 8461121747246443614 + │ ╰────────────────────────────────────────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -213,6 +213,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -333,15 +334,18 @@ note: note: ┌─ ingots/basic_ingot/src/bing.fe:10:4 │ -10 │ ╭ pub fn add(x: u256, y: u256) -> u256: +10 │ ╭ pub fn add(_ x: u256, _ y: u256) -> u256: 11 │ │ return x + y - │ ╰───────────────────^ attributes hash: 3620942230080591742 + │ ╰───────────────────^ attributes hash: 4448606202021980030 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "x", typ: Ok( Base( @@ -352,6 +356,9 @@ note: ), }, FunctionParam { + label: Some( + "_", + ), name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap index 803c612ec7..9c9b2ce6ae 100644 --- a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap +++ b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap @@ -12,9 +12,9 @@ note: note: ┌─ call_statement_with_args.fe:4:5 │ -4 │ ╭ fn assign(self, val: u256): +4 │ ╭ fn assign(self, _ val: u256): 5 │ │ self.baz[0] = val - │ ╰─────────────────────────^ attributes hash: 3042152959006775682 + │ ╰─────────────────────────^ attributes hash: 15254234582808678866 │ = FunctionSignature { self_decl: Some( @@ -23,6 +23,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "val", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args_2.snap b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args_2.snap index 2abb2881a0..e1c41eb08a 100644 --- a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args_2.snap +++ b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args_2.snap @@ -12,10 +12,10 @@ note: note: ┌─ call_statement_with_args_2.fe:4:5 │ -4 │ ╭ fn assign(self, val: u256) -> u256: +4 │ ╭ fn assign(self, _ val: u256) -> u256: 5 │ │ self.baz[0] = val 6 │ │ return val - │ ╰──────────────────^ attributes hash: 10309470657675388254 + │ ╰──────────────────^ attributes hash: 11102768331449211201 │ = FunctionSignature { self_decl: Some( @@ -24,6 +24,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "val", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap b/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap index fed7ab5ca9..1d14519585 100644 --- a/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap +++ b/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap @@ -8,13 +8,14 @@ note: │ 3 │ ╭ pub fn add_u256(left: u256, right: u256) -> u256: 4 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 1571521839932226598 + │ ╰───────────────────────────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -63,13 +65,14 @@ note: │ 6 │ ╭ pub fn add_u128(left: u128, right: u128) -> u128: 7 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 3531425834890134240 + │ ╰───────────────────────────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -80,6 +83,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -118,13 +122,14 @@ note: │ 9 │ ╭ pub fn add_u64(left: u64, right: u64) -> u64: 10 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 11716126062904084443 + │ ╰───────────────────────────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -135,6 +140,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -173,13 +179,14 @@ note: │ 12 │ ╭ pub fn add_u32(left: u32, right: u32) -> u32: 13 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 3620467348726730244 + │ ╰───────────────────────────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -190,6 +197,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -228,13 +236,14 @@ note: │ 15 │ ╭ pub fn add_u16(left: u16, right: u16) -> u16: 16 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 15001848039692401218 + │ ╰───────────────────────────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -245,6 +254,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -283,13 +293,14 @@ note: │ 18 │ ╭ pub fn add_u8(left: u8, right: u8) -> u8: 19 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 4734140432359520257 + │ ╰───────────────────────────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -300,6 +311,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -338,13 +350,14 @@ note: │ 21 │ ╭ pub fn add_i256(left: i256, right: i256) -> i256: 22 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 18339872031782207605 + │ ╰───────────────────────────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -355,6 +368,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -393,13 +407,14 @@ note: │ 24 │ ╭ pub fn add_i128(left: i128, right: i128) -> i128: 25 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 3942969085315792914 + │ ╰───────────────────────────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -410,6 +425,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -448,13 +464,14 @@ note: │ 27 │ ╭ pub fn add_i64(left: i64, right: i64) -> i64: 28 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 13399915764789102408 + │ ╰───────────────────────────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -465,6 +482,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -503,13 +521,14 @@ note: │ 30 │ ╭ pub fn add_i32(left: i32, right: i32) -> i32: 31 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 5833942383973337273 + │ ╰───────────────────────────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -520,6 +539,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -558,13 +578,14 @@ note: │ 33 │ ╭ pub fn add_i16(left: i16, right: i16) -> i16: 34 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 7895241901949654885 + │ ╰───────────────────────────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -575,6 +596,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -613,13 +635,14 @@ note: │ 36 │ ╭ pub fn add_i8(left: i8, right: i8) -> i8: 37 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 12905033493468118067 + │ ╰───────────────────────────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -630,6 +653,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -668,13 +692,14 @@ note: │ 39 │ ╭ pub fn sub_u256(left: u256, right: u256) -> u256: 40 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 1571521839932226598 + │ ╰───────────────────────────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -685,6 +710,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -723,13 +749,14 @@ note: │ 42 │ ╭ pub fn sub_u128(left: u128, right: u128) -> u128: 43 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 3531425834890134240 + │ ╰───────────────────────────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -740,6 +767,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -778,13 +806,14 @@ note: │ 45 │ ╭ pub fn sub_u64(left: u64, right: u64) -> u64: 46 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 11716126062904084443 + │ ╰───────────────────────────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -795,6 +824,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -833,13 +863,14 @@ note: │ 48 │ ╭ pub fn sub_u32(left: u32, right: u32) -> u32: 49 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 3620467348726730244 + │ ╰───────────────────────────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -850,6 +881,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -888,13 +920,14 @@ note: │ 51 │ ╭ pub fn sub_u16(left: u16, right: u16) -> u16: 52 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 15001848039692401218 + │ ╰───────────────────────────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -905,6 +938,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -943,13 +977,14 @@ note: │ 54 │ ╭ pub fn sub_u8(left: u8, right: u8) -> u8: 55 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 4734140432359520257 + │ ╰───────────────────────────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -960,6 +995,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -998,13 +1034,14 @@ note: │ 57 │ ╭ pub fn sub_i256(left: i256, right: i256) -> i256: 58 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 18339872031782207605 + │ ╰───────────────────────────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1015,6 +1052,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1053,13 +1091,14 @@ note: │ 60 │ ╭ pub fn sub_i128(left: i128, right: i128) -> i128: 61 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 3942969085315792914 + │ ╰───────────────────────────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1070,6 +1109,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1108,13 +1148,14 @@ note: │ 63 │ ╭ pub fn sub_i64(left: i64, right: i64) -> i64: 64 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 13399915764789102408 + │ ╰───────────────────────────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1125,6 +1166,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1163,13 +1205,14 @@ note: │ 66 │ ╭ pub fn sub_i32(left: i32, right: i32) -> i32: 67 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 5833942383973337273 + │ ╰───────────────────────────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1180,6 +1223,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1218,13 +1262,14 @@ note: │ 69 │ ╭ pub fn sub_i16(left: i16, right: i16) -> i16: 70 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 7895241901949654885 + │ ╰───────────────────────────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1235,6 +1280,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1273,13 +1319,14 @@ note: │ 72 │ ╭ pub fn sub_i8(left: i8, right: i8) -> i8: 73 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 12905033493468118067 + │ ╰───────────────────────────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1290,6 +1337,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1328,13 +1376,14 @@ note: │ 75 │ ╭ pub fn div_u256(left: u256, right: u256) -> u256: 76 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 1571521839932226598 + │ ╰───────────────────────────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1345,6 +1394,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1383,13 +1433,14 @@ note: │ 78 │ ╭ pub fn div_u128(left: u128, right: u128) -> u128: 79 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 3531425834890134240 + │ ╰───────────────────────────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1400,6 +1451,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1438,13 +1490,14 @@ note: │ 81 │ ╭ pub fn div_u64(left: u64, right: u64) -> u64: 82 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 11716126062904084443 + │ ╰───────────────────────────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1455,6 +1508,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1493,13 +1547,14 @@ note: │ 84 │ ╭ pub fn div_u32(left: u32, right: u32) -> u32: 85 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 3620467348726730244 + │ ╰───────────────────────────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1510,6 +1565,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1548,13 +1604,14 @@ note: │ 87 │ ╭ pub fn div_u16(left: u16, right: u16) -> u16: 88 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 15001848039692401218 + │ ╰───────────────────────────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1565,6 +1622,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1603,13 +1661,14 @@ note: │ 90 │ ╭ pub fn div_u8(left: u8, right: u8) -> u8: 91 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 4734140432359520257 + │ ╰───────────────────────────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1620,6 +1679,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1658,13 +1718,14 @@ note: │ 93 │ ╭ pub fn div_i256(left: i256, right: i256) -> i256: 94 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 18339872031782207605 + │ ╰───────────────────────────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1675,6 +1736,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1713,13 +1775,14 @@ note: │ 96 │ ╭ pub fn div_i128(left: i128, right: i128) -> i128: 97 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 3942969085315792914 + │ ╰───────────────────────────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1730,6 +1793,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1768,13 +1832,14 @@ note: │ 99 │ ╭ pub fn div_i64(left: i64, right: i64) -> i64: 100 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 13399915764789102408 + │ ╰───────────────────────────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1785,6 +1850,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1823,13 +1889,14 @@ note: │ 102 │ ╭ pub fn div_i32(left: i32, right: i32) -> i32: 103 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 5833942383973337273 + │ ╰───────────────────────────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1840,6 +1907,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1878,13 +1946,14 @@ note: │ 105 │ ╭ pub fn div_i16(left: i16, right: i16) -> i16: 106 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 7895241901949654885 + │ ╰───────────────────────────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1895,6 +1964,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1933,13 +2003,14 @@ note: │ 108 │ ╭ pub fn div_i8(left: i8, right: i8) -> i8: 109 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 12905033493468118067 + │ ╰───────────────────────────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -1950,6 +2021,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -1988,13 +2060,14 @@ note: │ 111 │ ╭ pub fn mul_u256(left: u256, right: u256) -> u256: 112 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 1571521839932226598 + │ ╰───────────────────────────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2005,6 +2078,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2043,13 +2117,14 @@ note: │ 114 │ ╭ pub fn mul_u128(left: u128, right: u128) -> u128: 115 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 3531425834890134240 + │ ╰───────────────────────────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2060,6 +2135,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2098,13 +2174,14 @@ note: │ 117 │ ╭ pub fn mul_u64(left: u64, right: u64) -> u64: 118 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 11716126062904084443 + │ ╰───────────────────────────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2115,6 +2192,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2153,13 +2231,14 @@ note: │ 120 │ ╭ pub fn mul_u32(left: u32, right: u32) -> u32: 121 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 3620467348726730244 + │ ╰───────────────────────────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2170,6 +2249,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2208,13 +2288,14 @@ note: │ 123 │ ╭ pub fn mul_u16(left: u16, right: u16) -> u16: 124 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 15001848039692401218 + │ ╰───────────────────────────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2225,6 +2306,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2263,13 +2345,14 @@ note: │ 126 │ ╭ pub fn mul_u8(left: u8, right: u8) -> u8: 127 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 4734140432359520257 + │ ╰───────────────────────────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2280,6 +2363,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2318,13 +2402,14 @@ note: │ 129 │ ╭ pub fn mul_i256(left: i256, right: i256) -> i256: 130 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 18339872031782207605 + │ ╰───────────────────────────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2335,6 +2420,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2373,13 +2459,14 @@ note: │ 132 │ ╭ pub fn mul_i128(left: i128, right: i128) -> i128: 133 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 3942969085315792914 + │ ╰───────────────────────────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2390,6 +2477,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2428,13 +2516,14 @@ note: │ 135 │ ╭ pub fn mul_i64(left: i64, right: i64) -> i64: 136 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 13399915764789102408 + │ ╰───────────────────────────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2445,6 +2534,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2483,13 +2573,14 @@ note: │ 138 │ ╭ pub fn mul_i32(left: i32, right: i32) -> i32: 139 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 5833942383973337273 + │ ╰───────────────────────────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2500,6 +2591,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2538,13 +2630,14 @@ note: │ 141 │ ╭ pub fn mul_i16(left: i16, right: i16) -> i16: 142 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 7895241901949654885 + │ ╰───────────────────────────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2555,6 +2648,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2593,13 +2687,14 @@ note: │ 144 │ ╭ pub fn mul_i8(left: i8, right: i8) -> i8: 145 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 12905033493468118067 + │ ╰───────────────────────────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2610,6 +2705,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2648,13 +2744,14 @@ note: │ 147 │ ╭ pub fn mod_u256(left: u256, right: u256) -> u256: 148 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 1571521839932226598 + │ ╰───────────────────────────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2665,6 +2762,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2703,13 +2801,14 @@ note: │ 150 │ ╭ pub fn mod_u128(left: u128, right: u128) -> u128: 151 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 3531425834890134240 + │ ╰───────────────────────────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2720,6 +2819,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2758,13 +2858,14 @@ note: │ 153 │ ╭ pub fn mod_u64(left: u64, right: u64) -> u64: 154 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 11716126062904084443 + │ ╰───────────────────────────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2775,6 +2876,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2813,13 +2915,14 @@ note: │ 156 │ ╭ pub fn mod_u32(left: u32, right: u32) -> u32: 157 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 3620467348726730244 + │ ╰───────────────────────────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2830,6 +2933,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2868,13 +2972,14 @@ note: │ 159 │ ╭ pub fn mod_u16(left: u16, right: u16) -> u16: 160 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 15001848039692401218 + │ ╰───────────────────────────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2885,6 +2990,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2923,13 +3029,14 @@ note: │ 162 │ ╭ pub fn mod_u8(left: u8, right: u8) -> u8: 163 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 4734140432359520257 + │ ╰───────────────────────────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2940,6 +3047,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -2978,13 +3086,14 @@ note: │ 165 │ ╭ pub fn mod_i256(left: i256, right: i256) -> i256: 166 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 18339872031782207605 + │ ╰───────────────────────────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -2995,6 +3104,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3033,13 +3143,14 @@ note: │ 168 │ ╭ pub fn mod_i128(left: i128, right: i128) -> i128: 169 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 3942969085315792914 + │ ╰───────────────────────────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3050,6 +3161,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3088,13 +3200,14 @@ note: │ 171 │ ╭ pub fn mod_i64(left: i64, right: i64) -> i64: 172 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 13399915764789102408 + │ ╰───────────────────────────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3105,6 +3218,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3143,13 +3257,14 @@ note: │ 174 │ ╭ pub fn mod_i32(left: i32, right: i32) -> i32: 175 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 5833942383973337273 + │ ╰───────────────────────────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3160,6 +3275,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3198,13 +3314,14 @@ note: │ 177 │ ╭ pub fn mod_i16(left: i16, right: i16) -> i16: 178 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 7895241901949654885 + │ ╰───────────────────────────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3215,6 +3332,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3253,13 +3371,14 @@ note: │ 180 │ ╭ pub fn mod_i8(left: i8, right: i8) -> i8: 181 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 12905033493468118067 + │ ╰───────────────────────────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3270,6 +3389,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3308,13 +3428,14 @@ note: │ 183 │ ╭ pub fn pow_u256(left: u256, right: u256) -> u256: 184 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 1571521839932226598 + │ ╰────────────────────────────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3325,6 +3446,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3363,13 +3485,14 @@ note: │ 186 │ ╭ pub fn pow_u128(left: u128, right: u128) -> u128: 187 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 3531425834890134240 + │ ╰────────────────────────────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3380,6 +3503,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3418,13 +3542,14 @@ note: │ 189 │ ╭ pub fn pow_u64(left: u64, right: u64) -> u64: 190 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 11716126062904084443 + │ ╰────────────────────────────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3435,6 +3560,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3473,13 +3599,14 @@ note: │ 192 │ ╭ pub fn pow_u32(left: u32, right: u32) -> u32: 193 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 3620467348726730244 + │ ╰────────────────────────────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3490,6 +3617,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3528,13 +3656,14 @@ note: │ 195 │ ╭ pub fn pow_u16(left: u16, right: u16) -> u16: 196 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 15001848039692401218 + │ ╰────────────────────────────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3545,6 +3674,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3583,13 +3713,14 @@ note: │ 198 │ ╭ pub fn pow_u8(left: u8, right: u8) -> u8: 199 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 4734140432359520257 + │ ╰────────────────────────────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3600,6 +3731,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3638,13 +3770,14 @@ note: │ 201 │ ╭ pub fn pow_i256(left: i256, right: u256) -> i256: 202 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 4844919038634511984 + │ ╰────────────────────────────^ attributes hash: 10218838230504849711 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3655,6 +3788,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3693,13 +3827,14 @@ note: │ 204 │ ╭ pub fn pow_i128(left: i128, right: u128) -> i128: 205 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 12051186483896108306 + │ ╰────────────────────────────^ attributes hash: 8492300797170107874 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3710,6 +3845,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3748,13 +3884,14 @@ note: │ 207 │ ╭ pub fn pow_i64(left: i64, right: u64) -> i64: 208 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 5778203209379448269 + │ ╰────────────────────────────^ attributes hash: 8175269888119534907 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3765,6 +3902,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3803,13 +3941,14 @@ note: │ 210 │ ╭ pub fn pow_i32(left: i32, right: u32) -> i32: 211 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 9911136167919602152 + │ ╰────────────────────────────^ attributes hash: 9388330002377862662 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3820,6 +3959,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3858,13 +3998,14 @@ note: │ 213 │ ╭ pub fn pow_i16(left: i16, right: u16) -> i16: 214 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 9423648357265378571 + │ ╰────────────────────────────^ attributes hash: 8172583117888506116 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3875,6 +4016,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( @@ -3913,13 +4055,14 @@ note: │ 216 │ ╭ pub fn pow_i8(left: i8, right: u8) -> i8: 217 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 10922259685425841007 + │ ╰────────────────────────────^ attributes hash: 783967907920544100 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "left", typ: Ok( Base( @@ -3930,6 +4073,7 @@ note: ), }, FunctionParam { + label: None, name: "right", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__create2_contract.snap b/crates/analyzer/tests/snapshots/analysis__create2_contract.snap index d8bdbe3cbb..16c82d9569 100644 --- a/crates/analyzer/tests/snapshots/analysis__create2_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__create2_contract.snap @@ -36,7 +36,7 @@ note: 9 │ │ # value and salt 10 │ │ let foo: Foo = Foo.create2(ctx, 0, 52) 11 │ │ return address(foo) - │ ╰───────────────────────────^ attributes hash: 17345910255563017853 + │ ╰───────────────────────────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -45,6 +45,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( diff --git a/crates/analyzer/tests/snapshots/analysis__create_contract.snap b/crates/analyzer/tests/snapshots/analysis__create_contract.snap index 05e2d0f014..5ab77847ae 100644 --- a/crates/analyzer/tests/snapshots/analysis__create_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__create_contract.snap @@ -35,7 +35,7 @@ note: 8 │ ╭ pub fn create_foo(ctx: Context) -> address: 9 │ │ let foo: Foo = Foo.create(ctx, 0) 10 │ │ return address(foo) - │ ╰───────────────────────────^ attributes hash: 17345910255563017853 + │ ╰───────────────────────────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -44,6 +44,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( diff --git a/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap b/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap index 13a7b0841e..924b089d46 100644 --- a/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap @@ -40,7 +40,7 @@ note: · │ 27 │ │ self.my_u256 = my_u256 28 │ │ self.my_other_u256 = my_other_u256 - │ ╰──────────────────────────────────────────^ attributes hash: 11551341132966247307 + │ ╰──────────────────────────────────────────^ attributes hash: 8414520425977761339 │ = FunctionSignature { self_decl: Some( @@ -49,6 +49,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_string", typ: Ok( String( @@ -59,6 +60,7 @@ note: ), }, FunctionParam { + label: None, name: "my_other_string", typ: Ok( String( @@ -69,6 +71,7 @@ note: ), }, FunctionParam { + label: None, name: "my_u256", typ: Ok( Base( @@ -79,6 +82,7 @@ note: ), }, FunctionParam { + label: None, name: "my_other_u256", typ: Ok( Base( @@ -207,13 +211,14 @@ note: · │ 46 │ │ assert my_2nd_array[3] == 50 47 │ │ assert my_3rd_array[3] == 50 - │ ╰────────────────────────────────────^ attributes hash: 17282394372613959387 + │ ╰────────────────────────────────────^ attributes hash: 16237067187800993503 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_array", typ: Ok( Array( @@ -408,13 +413,14 @@ note: 49 │ ╭ pub fn mutate_and_return(my_array: Array) -> Array: 50 │ │ my_array[3] = 5 51 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 6295138771567994061 + │ ╰───────────────────────^ attributes hash: 15461468619504661037 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_array", typ: Ok( Array( @@ -463,13 +469,14 @@ note: │ 53 │ ╭ pub fn clone_and_return(my_array: Array) -> Array: 54 │ │ return my_array.clone() - │ ╰───────────────────────────────^ attributes hash: 6295138771567994061 + │ ╰───────────────────────────────^ attributes hash: 15461468619504661037 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_array", typ: Ok( Array( @@ -513,13 +520,14 @@ note: 56 │ ╭ pub fn clone_mutate_and_return(my_array: Array) -> Array: 57 │ │ my_array.clone()[3] = 5 58 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 6295138771567994061 + │ ╰───────────────────────^ attributes hash: 15461468619504661037 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_array", typ: Ok( Array( @@ -726,7 +734,7 @@ note: 73 │ │ self.my_string.to_mem(), 74 │ │ self.my_u256.to_mem() 75 │ │ ) - │ ╰─────────^ attributes hash: 5828909688388067108 + │ ╰─────────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -737,6 +745,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -802,9 +811,9 @@ note: note: ┌─ data_copying_stress.fe:77:5 │ -77 │ ╭ fn emit_my_event_internal(ctx: Context, some_string: String<42>, some_u256: u256): -78 │ │ emit MyEvent(ctx, my_string: some_string, my_u256: some_u256) - │ ╰─────────────────────────────────────────────────────────────────────^ attributes hash: 7895343899207477871 +77 │ ╭ fn emit_my_event_internal(ctx: Context, _ my_string: String<42>, _ my_u256: u256): +78 │ │ emit MyEvent(ctx, my_string, my_u256) + │ ╰─────────────────────────────────────────────^ attributes hash: 15658342901286022244 │ = FunctionSignature { self_decl: None, @@ -813,6 +822,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -824,7 +834,10 @@ note: ), }, FunctionParam { - name: "some_string", + label: Some( + "_", + ), + name: "my_string", typ: Ok( String( FeString { @@ -834,7 +847,10 @@ note: ), }, FunctionParam { - name: "some_u256", + label: Some( + "_", + ), + name: "my_u256", typ: Ok( Base( Numeric( @@ -854,17 +870,17 @@ note: note: ┌─ data_copying_stress.fe:78:22 │ -78 │ emit MyEvent(ctx, my_string: some_string, my_u256: some_u256) - │ ^^^ ^^^^^^^^^^^ ^^^^^^^^^ u256: Value - │ │ │ - │ │ String<42>: Memory +78 │ emit MyEvent(ctx, my_string, my_u256) + │ ^^^ ^^^^^^^^^ ^^^^^^^ u256: Value + │ │ │ + │ │ String<42>: Memory │ Context: Memory note: ┌─ data_copying_stress.fe:78:9 │ -78 │ emit MyEvent(ctx, my_string: some_string, my_u256: some_u256) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 595206297963940250 +78 │ emit MyEvent(ctx, my_string, my_u256) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 595206297963940250 │ = Event { name: "MyEvent", @@ -899,7 +915,7 @@ note: │ 80 │ ╭ pub fn set_my_addrs(self, my_addrs: Array): 81 │ │ self.my_addrs = my_addrs - │ ╰────────────────────────────────^ attributes hash: 2361787292225081873 + │ ╰────────────────────────────────^ attributes hash: 1347763946351267085 │ = FunctionSignature { self_decl: Some( @@ -908,6 +924,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_addrs", typ: Ok( Array( diff --git a/crates/analyzer/tests/snapshots/analysis__erc20_token.snap b/crates/analyzer/tests/snapshots/analysis__erc20_token.snap index 6388c2b4fb..7021b3f67a 100644 --- a/crates/analyzer/tests/snapshots/analysis__erc20_token.snap +++ b/crates/analyzer/tests/snapshots/analysis__erc20_token.snap @@ -190,9 +190,9 @@ note: note: ┌─ erc20_token.fe:39:5 │ -39 │ ╭ pub fn balanceOf(self, account: address) -> u256: +39 │ ╭ pub fn balanceOf(self, _ account: address) -> u256: 40 │ │ return self._balances[account] - │ ╰──────────────────────────────────────^ attributes hash: 3934661437648326967 + │ ╰──────────────────────────────────────^ attributes hash: 5993653573135321647 │ = FunctionSignature { self_decl: Some( @@ -201,6 +201,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "account", typ: Ok( Base( @@ -242,9 +245,9 @@ note: ┌─ erc20_token.fe:42:5 │ 42 │ ╭ pub fn transfer(self, ctx: Context, recipient: address, value: u256) -> bool: -43 │ │ self._transfer(ctx, ctx.msg_sender(), recipient, value) +43 │ │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) 44 │ │ return true - │ ╰───────────────────^ attributes hash: 2819278576796158995 + │ ╰───────────────────^ attributes hash: 9700541873563816287 │ = FunctionSignature { self_decl: Some( @@ -255,6 +258,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -266,6 +270,7 @@ note: ), }, FunctionParam { + label: None, name: "recipient", typ: Ok( Base( @@ -274,6 +279,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -294,26 +300,26 @@ note: note: ┌─ erc20_token.fe:43:9 │ -43 │ self._transfer(ctx, ctx.msg_sender(), recipient, value) - │ ^^^^ ^^^ ^^^ Context: Memory - │ │ │ +43 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) + │ ^^^^ ^^^ ^^^ Context: Memory + │ │ │ │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:43:29 + ┌─ erc20_token.fe:43:37 │ -43 │ self._transfer(ctx, ctx.msg_sender(), recipient, value) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^ u256: Value - │ │ │ - │ │ address: Value - │ address: Value +43 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) + │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^ u256: Value + │ │ │ + │ │ address: Value + │ address: Value note: ┌─ erc20_token.fe:43:9 │ -43 │ self._transfer(ctx, ctx.msg_sender(), recipient, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +43 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 44 │ return true │ ^^^^ bool: Value @@ -322,7 +328,7 @@ note: │ 46 │ ╭ pub fn allowance(self, owner: address, spender: address) -> u256: 47 │ │ return self._allowances[owner][spender] - │ ╰───────────────────────────────────────────────^ attributes hash: 12331829167105298691 + │ ╰───────────────────────────────────────────────^ attributes hash: 3316599995530573429 │ = FunctionSignature { self_decl: Some( @@ -331,6 +337,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "owner", typ: Ok( Base( @@ -339,6 +346,7 @@ note: ), }, FunctionParam { + label: None, name: "spender", typ: Ok( Base( @@ -388,9 +396,9 @@ note: ┌─ erc20_token.fe:49:5 │ 49 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool: -50 │ │ self._approve(ctx, ctx.msg_sender(), spender, value) +50 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) 51 │ │ return true - │ ╰───────────────────^ attributes hash: 15274000982762670572 + │ ╰───────────────────^ attributes hash: 8309406699454253603 │ = FunctionSignature { self_decl: Some( @@ -401,6 +409,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -412,6 +421,7 @@ note: ), }, FunctionParam { + label: None, name: "spender", typ: Ok( Base( @@ -420,6 +430,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -440,26 +451,26 @@ note: note: ┌─ erc20_token.fe:50:9 │ -50 │ self._approve(ctx, ctx.msg_sender(), spender, value) - │ ^^^^ ^^^ ^^^ Context: Memory - │ │ │ +50 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) + │ ^^^^ ^^^ ^^^ Context: Memory + │ │ │ │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:50:28 + ┌─ erc20_token.fe:50:35 │ -50 │ self._approve(ctx, ctx.msg_sender(), spender, value) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value - │ │ │ - │ │ address: Value - │ address: Value +50 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) + │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value + │ │ │ + │ │ address: Value + │ address: Value note: ┌─ erc20_token.fe:50:9 │ -50 │ self._approve(ctx, ctx.msg_sender(), spender, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +50 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 51 │ return true │ ^^^^ bool: Value @@ -469,9 +480,9 @@ note: 53 │ ╭ pub fn transferFrom(self, ctx: Context, sender: address, recipient: address, value: u256) -> bool: 54 │ │ assert self._allowances[sender][ctx.msg_sender()] >= value 55 │ │ self._transfer(ctx, sender, recipient, value) -56 │ │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) +56 │ │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) 57 │ │ return true - │ ╰───────────────────^ attributes hash: 13813289729619831621 + │ ╰───────────────────^ attributes hash: 14464733394183378558 │ = FunctionSignature { self_decl: Some( @@ -482,6 +493,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -493,6 +505,7 @@ note: ), }, FunctionParam { + label: None, name: "sender", typ: Ok( Base( @@ -501,6 +514,7 @@ note: ), }, FunctionParam { + label: None, name: "recipient", typ: Ok( Base( @@ -509,6 +523,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -580,62 +595,62 @@ note: │ 55 │ self._transfer(ctx, sender, recipient, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -56 │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^ ^^^ ^^^^^^ ^^^ Context: Memory - │ │ │ │ - │ │ │ address: Value +56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + │ ^^^^ ^^^ ^^^^^^ ^^^ Context: Memory + │ │ │ │ + │ │ │ address: Value │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:56:36 + ┌─ erc20_token.fe:56:52 │ -56 │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value - │ │ - │ address: Value +56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + │ ^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value + │ │ + │ address: Value note: - ┌─ erc20_token.fe:56:54 + ┌─ erc20_token.fe:56:77 │ -56 │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^ ^^^^^^ address: Value - │ │ - │ Map>: Storage { nonce: Some(1) } +56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + │ ^^^^^^^^^^^^^^^^ ^^^^^^ address: Value + │ │ + │ Map>: Storage { nonce: Some(1) } note: - ┌─ erc20_token.fe:56:54 + ┌─ erc20_token.fe:56:77 │ -56 │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory - │ │ - │ Map: Storage { nonce: None } +56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory + │ │ + │ Map: Storage { nonce: None } note: - ┌─ erc20_token.fe:56:79 + ┌─ erc20_token.fe:56:102 │ -56 │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^ address: Value +56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:56:54 + ┌─ erc20_token.fe:56:77 │ -56 │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } => Value +56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:56:54 + ┌─ erc20_token.fe:56:77 │ -56 │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: ┌─ erc20_token.fe:56:9 │ -56 │ self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 57 │ return true │ ^^^^ bool: Value @@ -643,9 +658,9 @@ note: ┌─ erc20_token.fe:59:5 │ 59 │ ╭ pub fn increaseAllowance(self, ctx: Context, spender: address, addedValue: u256) -> bool: -60 │ │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) +60 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) 61 │ │ return true - │ ╰───────────────────^ attributes hash: 12213130191491072064 + │ ╰───────────────────^ attributes hash: 14606848714789380929 │ = FunctionSignature { self_decl: Some( @@ -656,6 +671,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -667,6 +683,7 @@ note: ), }, FunctionParam { + label: None, name: "spender", typ: Ok( Base( @@ -675,6 +692,7 @@ note: ), }, FunctionParam { + label: None, name: "addedValue", typ: Ok( Base( @@ -695,62 +713,62 @@ note: note: ┌─ erc20_token.fe:60:9 │ -60 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^ ^^^ ^^^ Context: Memory - │ │ │ +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + │ ^^^^ ^^^ ^^^ Context: Memory + │ │ │ │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:60:28 + ┌─ erc20_token.fe:60:35 │ -60 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ERC20: Value - │ │ │ - │ │ address: Value - │ address: Value +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ERC20: Value + │ │ │ + │ │ address: Value + │ address: Value note: - ┌─ erc20_token.fe:60:55 + ┌─ erc20_token.fe:60:69 │ -60 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^ ^^^ Context: Memory - │ │ - │ Map>: Storage { nonce: Some(1) } +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + │ ^^^^^^^^^^^^^^^^ ^^^ Context: Memory + │ │ + │ Map>: Storage { nonce: Some(1) } note: - ┌─ erc20_token.fe:60:72 + ┌─ erc20_token.fe:60:86 │ -60 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^ address: Value +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:60:55 + ┌─ erc20_token.fe:60:69 │ -60 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value - │ │ - │ Map: Storage { nonce: None } +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value + │ │ + │ Map: Storage { nonce: None } note: - ┌─ erc20_token.fe:60:55 + ┌─ erc20_token.fe:60:69 │ -60 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } => Value +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:60:55 + ┌─ erc20_token.fe:60:69 │ -60 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: ┌─ erc20_token.fe:60:9 │ -60 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 61 │ return true │ ^^^^ bool: Value @@ -758,9 +776,9 @@ note: ┌─ erc20_token.fe:63:5 │ 63 │ ╭ pub fn decreaseAllowance(self, ctx: Context, spender: address, subtractedValue: u256) -> bool: -64 │ │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) +64 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) 65 │ │ return true - │ ╰───────────────────^ attributes hash: 3246531694812819193 + │ ╰───────────────────^ attributes hash: 9154612140799800808 │ = FunctionSignature { self_decl: Some( @@ -771,6 +789,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -782,6 +801,7 @@ note: ), }, FunctionParam { + label: None, name: "spender", typ: Ok( Base( @@ -790,6 +810,7 @@ note: ), }, FunctionParam { + label: None, name: "subtractedValue", typ: Ok( Base( @@ -810,62 +831,62 @@ note: note: ┌─ erc20_token.fe:64:9 │ -64 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^ ^^^ ^^^ Context: Memory - │ │ │ +64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + │ ^^^^ ^^^ ^^^ Context: Memory + │ │ │ │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:64:28 + ┌─ erc20_token.fe:64:35 │ -64 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ERC20: Value - │ │ │ - │ │ address: Value - │ address: Value +64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ERC20: Value + │ │ │ + │ │ address: Value + │ address: Value note: - ┌─ erc20_token.fe:64:55 + ┌─ erc20_token.fe:64:69 │ -64 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^ ^^^ Context: Memory - │ │ - │ Map>: Storage { nonce: Some(1) } +64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + │ ^^^^^^^^^^^^^^^^ ^^^ Context: Memory + │ │ + │ Map>: Storage { nonce: Some(1) } note: - ┌─ erc20_token.fe:64:72 + ┌─ erc20_token.fe:64:86 │ -64 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^ address: Value +64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:64:55 + ┌─ erc20_token.fe:64:69 │ -64 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value - │ │ - │ Map: Storage { nonce: None } +64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value + │ │ + │ Map: Storage { nonce: None } note: - ┌─ erc20_token.fe:64:55 + ┌─ erc20_token.fe:64:69 │ -64 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } => Value +64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:64:55 + ┌─ erc20_token.fe:64:69 │ -64 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: ┌─ erc20_token.fe:64:9 │ -64 │ self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 65 │ return true │ ^^^^ bool: Value @@ -875,11 +896,11 @@ note: 67 │ ╭ fn _transfer(self, ctx: Context, sender: address, recipient: address, value: u256): 68 │ │ assert sender != address(0) 69 │ │ assert recipient != address(0) -70 │ │ _before_token_transfer(sender, recipient, value) +70 │ │ _before_token_transfer(from: sender, to: recipient, value) 71 │ │ self._balances[sender] = self._balances[sender] - value 72 │ │ self._balances[recipient] = self._balances[recipient] + value 73 │ │ emit Transfer(ctx, from: sender, to: recipient, value) - │ ╰──────────────────────────────────────────────────────────────^ attributes hash: 16619149998539230527 + │ ╰──────────────────────────────────────────────────────────────^ attributes hash: 10648262769466339085 │ = FunctionSignature { self_decl: Some( @@ -890,6 +911,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -901,6 +923,7 @@ note: ), }, FunctionParam { + label: None, name: "sender", typ: Ok( Base( @@ -909,6 +932,7 @@ note: ), }, FunctionParam { + label: None, name: "recipient", typ: Ok( Base( @@ -917,6 +941,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -969,17 +994,17 @@ note: │ 69 │ assert recipient != address(0) │ ^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -70 │ _before_token_transfer(sender, recipient, value) - │ ^^^^^^ ^^^^^^^^^ ^^^^^ u256: Value - │ │ │ - │ │ address: Value - │ address: Value +70 │ _before_token_transfer(from: sender, to: recipient, value) + │ ^^^^^^ ^^^^^^^^^ ^^^^^ u256: Value + │ │ │ + │ │ address: Value + │ address: Value note: ┌─ erc20_token.fe:70:9 │ -70 │ _before_token_transfer(sender, recipient, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +70 │ _before_token_transfer(from: sender, to: recipient, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 71 │ self._balances[sender] = self._balances[sender] - value │ ^^^^ ERC20: Value @@ -1113,11 +1138,11 @@ note: │ 75 │ ╭ fn _mint(self, ctx: Context, account: address, value: u256): 76 │ │ assert account != address(0) -77 │ │ _before_token_transfer(address(0), account, value) +77 │ │ _before_token_transfer(from: address(0), to: account, value) 78 │ │ self._total_supply = self._total_supply + value 79 │ │ self._balances[account] = self._balances[account] + value 80 │ │ emit Transfer(ctx, from: address(0), to: account, value) - │ ╰────────────────────────────────────────────────────────────────^ attributes hash: 8767370088938020905 + │ ╰────────────────────────────────────────────────────────────────^ attributes hash: 6502254374233415580 │ = FunctionSignature { self_decl: Some( @@ -1128,6 +1153,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -1139,6 +1165,7 @@ note: ), }, FunctionParam { + label: None, name: "account", typ: Ok( Base( @@ -1147,6 +1174,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -1183,23 +1211,23 @@ note: │ 76 │ assert account != address(0) │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -77 │ _before_token_transfer(address(0), account, value) - │ ^ u256: Value +77 │ _before_token_transfer(from: address(0), to: account, value) + │ ^ u256: Value note: - ┌─ erc20_token.fe:77:32 + ┌─ erc20_token.fe:77:38 │ -77 │ _before_token_transfer(address(0), account, value) - │ ^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value - │ │ │ - │ │ address: Value - │ address: Value +77 │ _before_token_transfer(from: address(0), to: account, value) + │ ^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value + │ │ │ + │ │ address: Value + │ address: Value note: ┌─ erc20_token.fe:77:9 │ -77 │ _before_token_transfer(address(0), account, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +77 │ _before_token_transfer(from: address(0), to: account, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 78 │ self._total_supply = self._total_supply + value │ ^^^^ ERC20: Value @@ -1324,11 +1352,11 @@ note: │ 82 │ ╭ fn _burn(self, ctx: Context, account: address, value: u256): 83 │ │ assert account != address(0) -84 │ │ _before_token_transfer(account, address(0), value) +84 │ │ _before_token_transfer(from: account, to: address(0), value) 85 │ │ self._balances[account] = self._balances[account] - value 86 │ │ self._total_supply = self._total_supply - value 87 │ │ emit Transfer(ctx, from: account, to: address(0), value) - │ ╰────────────────────────────────────────────────────────────────^ attributes hash: 8767370088938020905 + │ ╰────────────────────────────────────────────────────────────────^ attributes hash: 6502254374233415580 │ = FunctionSignature { self_decl: Some( @@ -1339,6 +1367,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -1350,6 +1379,7 @@ note: ), }, FunctionParam { + label: None, name: "account", typ: Ok( Base( @@ -1358,6 +1388,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -1394,24 +1425,24 @@ note: │ 83 │ assert account != address(0) │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -84 │ _before_token_transfer(account, address(0), value) - │ ^^^^^^^ ^ u256: Value - │ │ - │ address: Value +84 │ _before_token_transfer(from: account, to: address(0), value) + │ ^^^^^^^ ^ u256: Value + │ │ + │ address: Value note: - ┌─ erc20_token.fe:84:41 + ┌─ erc20_token.fe:84:51 │ -84 │ _before_token_transfer(account, address(0), value) - │ ^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ address: Value +84 │ _before_token_transfer(from: account, to: address(0), value) + │ ^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ address: Value note: ┌─ erc20_token.fe:84:9 │ -84 │ _before_token_transfer(account, address(0), value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +84 │ _before_token_transfer(from: account, to: address(0), value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 85 │ self._balances[account] = self._balances[account] - value │ ^^^^ ERC20: Value @@ -1539,7 +1570,7 @@ note: 91 │ │ assert spender != address(0) 92 │ │ self._allowances[owner][spender] = value 93 │ │ emit Approval(ctx, owner, spender, value) - │ ╰─────────────────────────────────────────────────^ attributes hash: 16582163020557730049 + │ ╰─────────────────────────────────────────────────^ attributes hash: 1630416716014819616 │ = FunctionSignature { self_decl: Some( @@ -1550,6 +1581,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -1561,6 +1593,7 @@ note: ), }, FunctionParam { + label: None, name: "owner", typ: Ok( Base( @@ -1569,6 +1602,7 @@ note: ), }, FunctionParam { + label: None, name: "spender", typ: Ok( Base( @@ -1577,6 +1611,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -1706,9 +1741,9 @@ note: note: ┌─ erc20_token.fe:95:5 │ -95 │ ╭ fn _setup_decimals(self, decimals_: u8): +95 │ ╭ fn _setup_decimals(self, _ decimals_: u8): 96 │ │ self._decimals = decimals_ - │ ╰──────────────────────────────────^ attributes hash: 8343414465215343884 + │ ╰──────────────────────────────────^ attributes hash: 2241116105643912660 │ = FunctionSignature { self_decl: Some( @@ -1717,6 +1752,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "decimals_", typ: Ok( Base( @@ -1751,15 +1789,16 @@ note: note: ┌─ erc20_token.fe:98:5 │ -98 │ ╭ fn _before_token_transfer(from: address, to: address, value: u256): +98 │ ╭ fn _before_token_transfer(from: address, to: address, _ value: u256): 99 │ │ pass - │ ╰────────────^ attributes hash: 5251049759615532223 + │ ╰────────────^ attributes hash: 10552855728897650120 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "from", typ: Ok( Base( @@ -1768,6 +1807,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -1776,6 +1816,9 @@ note: ), }, FunctionParam { + label: Some( + "_", + ), name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__events.snap b/crates/analyzer/tests/snapshots/analysis__events.snap index c5172afd5a..fc6dc41b1e 100644 --- a/crates/analyzer/tests/snapshots/analysis__events.snap +++ b/crates/analyzer/tests/snapshots/analysis__events.snap @@ -42,7 +42,7 @@ note: │ 21 │ ╭ pub fn emit_nums(ctx: Context): 22 │ │ emit Nums(ctx, num1: 26, num2: 42) - │ ╰──────────────────────────────────────────^ attributes hash: 11452088215302469574 + │ ╰──────────────────────────────────────────^ attributes hash: 5519676733853656531 │ = FunctionSignature { self_decl: None, @@ -51,6 +51,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -117,7 +118,7 @@ note: │ 24 │ ╭ pub fn emit_bases(ctx: Context, addr: address): 25 │ │ emit Bases(ctx, num: 26, addr) - │ ╰──────────────────────────────────────^ attributes hash: 991311692967983 + │ ╰──────────────────────────────────────^ attributes hash: 15383426943610850221 │ = FunctionSignature { self_decl: None, @@ -126,6 +127,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -137,6 +139,7 @@ note: ), }, FunctionParam { + label: None, name: "addr", typ: Ok( Base( @@ -198,7 +201,7 @@ note: │ 27 │ ╭ pub fn emit_mix(ctx: Context, addr: address, my_bytes: Array): 28 │ │ emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) - │ ╰─────────────────────────────────────────────────────────^ attributes hash: 15744261199202133709 + │ ╰─────────────────────────────────────────────────────────^ attributes hash: 9652612436637375041 │ = FunctionSignature { self_decl: None, @@ -207,6 +210,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -218,6 +222,7 @@ note: ), }, FunctionParam { + label: None, name: "addr", typ: Ok( Base( @@ -226,6 +231,7 @@ note: ), }, FunctionParam { + label: None, name: "my_bytes", typ: Ok( Array( @@ -322,7 +328,7 @@ note: 32 │ │ addrs[0] = addr1 33 │ │ addrs[1] = addr2 34 │ │ emit Addresses(ctx, addrs) - │ ╰──────────────────────────────────^ attributes hash: 6001294227515901672 + │ ╰──────────────────────────────────^ attributes hash: 18438233211486921531 │ = FunctionSignature { self_decl: None, @@ -331,6 +337,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -342,6 +349,7 @@ note: ), }, FunctionParam { + label: None, name: "addr1", typ: Ok( Base( @@ -350,6 +358,7 @@ note: ), }, FunctionParam { + label: None, name: "addr2", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__external_contract.snap b/crates/analyzer/tests/snapshots/analysis__external_contract.snap index 5745002817..49f62b9758 100644 --- a/crates/analyzer/tests/snapshots/analysis__external_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__external_contract.snap @@ -18,7 +18,7 @@ note: │ 9 │ ╭ pub fn emit_event(ctx: Context, my_num: u256, my_addrs: Array, my_string: String<11>): 10 │ │ emit MyEvent(ctx, my_num, my_addrs, my_string) - │ ╰──────────────────────────────────────────────────────^ attributes hash: 3451677617796919513 + │ ╰──────────────────────────────────────────────────────^ attributes hash: 14584319691445179306 │ = FunctionSignature { self_decl: None, @@ -27,6 +27,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -38,6 +39,7 @@ note: ), }, FunctionParam { + label: None, name: "my_num", typ: Ok( Base( @@ -48,6 +50,7 @@ note: ), }, FunctionParam { + label: None, name: "my_addrs", typ: Ok( Array( @@ -59,6 +62,7 @@ note: ), }, FunctionParam { + label: None, name: "my_string", typ: Ok( String( @@ -141,13 +145,14 @@ note: 15 │ │ my_array[1] = a * b 16 │ │ my_array[2] = b 17 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 3088089836276252510 + │ ╰───────────────────────^ attributes hash: 14276910879408601208 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -158,6 +163,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -245,7 +251,7 @@ note: · │ 27 │ │ let foo: Foo = Foo(ctx, foo_address) 28 │ │ foo.emit_event(my_num, my_addrs, my_string) - │ ╰───────────────────────────────────────────────────^ attributes hash: 14924385499184953581 + │ ╰───────────────────────────────────────────────────^ attributes hash: 11744736773867210426 │ = FunctionSignature { self_decl: None, @@ -254,6 +260,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -265,6 +272,7 @@ note: ), }, FunctionParam { + label: None, name: "foo_address", typ: Ok( Base( @@ -273,6 +281,7 @@ note: ), }, FunctionParam { + label: None, name: "my_num", typ: Ok( Base( @@ -283,6 +292,7 @@ note: ), }, FunctionParam { + label: None, name: "my_addrs", typ: Ok( Array( @@ -294,6 +304,7 @@ note: ), }, FunctionParam { + label: None, name: "my_string", typ: Ok( String( @@ -353,7 +364,7 @@ note: · │ 36 │ │ let foo: Foo = Foo(ctx, foo_address) 37 │ │ return foo.build_array(a, b) - │ ╰────────────────────────────────────^ attributes hash: 16451349032805053607 + │ ╰────────────────────────────────────^ attributes hash: 14801245347360386258 │ = FunctionSignature { self_decl: None, @@ -362,6 +373,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -373,6 +385,7 @@ note: ), }, FunctionParam { + label: None, name: "foo_address", typ: Ok( Base( @@ -381,6 +394,7 @@ note: ), }, FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -391,6 +405,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__guest_book.snap b/crates/analyzer/tests/snapshots/analysis__guest_book.snap index b8d67bcca2..d3f469144b 100644 --- a/crates/analyzer/tests/snapshots/analysis__guest_book.snap +++ b/crates/analyzer/tests/snapshots/analysis__guest_book.snap @@ -24,7 +24,7 @@ note: 16 │ │ 17 │ │ # Emit the `Signed` event 18 │ │ emit Signed(ctx, book_msg) - │ ╰──────────────────────────────────^ attributes hash: 2339837799335282240 + │ ╰──────────────────────────────────^ attributes hash: 12497999579229810685 │ = FunctionSignature { self_decl: Some( @@ -35,6 +35,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -46,6 +47,7 @@ note: ), }, FunctionParam { + label: None, name: "book_msg", typ: Ok( String( @@ -126,7 +128,7 @@ note: 21 │ │ # Copying data from storage to memory 22 │ │ # has to be done explicitly via `to_mem()` 23 │ │ return self.messages[addr].to_mem() - │ ╰───────────────────────────────────────────^ attributes hash: 8481751960582380743 + │ ╰───────────────────────────────────────────^ attributes hash: 3325224293767249368 │ = FunctionSignature { self_decl: Some( @@ -135,6 +137,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "addr", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__if_statement.snap b/crates/analyzer/tests/snapshots/analysis__if_statement.snap index d31088ad75..29a6a0cbad 100644 --- a/crates/analyzer/tests/snapshots/analysis__if_statement.snap +++ b/crates/analyzer/tests/snapshots/analysis__if_statement.snap @@ -11,13 +11,14 @@ note: 5 │ │ return 1 6 │ │ else: 7 │ │ return 0 - │ ╰────────────────────^ attributes hash: 9715528395521480793 + │ ╰────────────────────^ attributes hash: 10660199954095577886 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "input", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap b/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap index 5648a57776..325dfca1c3 100644 --- a/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap +++ b/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap @@ -13,13 +13,14 @@ note: 7 │ │ assert true 8 │ │ 9 │ │ return 0 - │ ╰────────────────^ attributes hash: 6692289661045278817 + │ ╰────────────────^ attributes hash: 12367727332255217641 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "val", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__keccak.snap b/crates/analyzer/tests/snapshots/analysis__keccak.snap index 778d1b1fa0..d51510ad62 100644 --- a/crates/analyzer/tests/snapshots/analysis__keccak.snap +++ b/crates/analyzer/tests/snapshots/analysis__keccak.snap @@ -8,13 +8,14 @@ note: │ 3 │ ╭ pub fn return_hash_from_u8(val: Array) -> u256: 4 │ │ return keccak256(val) - │ ╰─────────────────────────────^ attributes hash: 5400213147538721999 + │ ╰─────────────────────────────^ attributes hash: 6936681782057010951 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "val", typ: Ok( Array( @@ -54,13 +55,14 @@ note: │ 6 │ ╭ pub fn return_hash_from_foo(val: Array) -> u256: 7 │ │ return keccak256(val) - │ ╰─────────────────────────────^ attributes hash: 15040000206014415348 + │ ╰─────────────────────────────^ attributes hash: 10874278598381710302 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "val", typ: Ok( Array( @@ -100,13 +102,14 @@ note: │ 9 │ ╭ pub fn return_hash_from_u256(val: Array) -> u256: 10 │ │ return keccak256(val) - │ ╰─────────────────────────────^ attributes hash: 10518987052337912435 + │ ╰─────────────────────────────^ attributes hash: 1385099984461119772 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "val", typ: Ok( Array( diff --git a/crates/analyzer/tests/snapshots/analysis__math.snap b/crates/analyzer/tests/snapshots/analysis__math.snap index cc18fbd27e..7a5b23f73a 100644 --- a/crates/analyzer/tests/snapshots/analysis__math.snap +++ b/crates/analyzer/tests/snapshots/analysis__math.snap @@ -13,13 +13,14 @@ note: · │ 13 │ │ z = 1 14 │ │ return z - │ ╰────────────────^ attributes hash: 6692289661045278817 + │ ╰────────────────^ attributes hash: 12367727332255217641 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "val", typ: Ok( Base( @@ -146,13 +147,14 @@ note: │ 16 │ ╭ pub fn min(x: u256, y: u256) -> u256: 17 │ │ return x if x < y else y - │ ╰────────────────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -163,6 +165,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__module_level_events.snap b/crates/analyzer/tests/snapshots/analysis__module_level_events.snap index bb574df951..895ccdde7c 100644 --- a/crates/analyzer/tests/snapshots/analysis__module_level_events.snap +++ b/crates/analyzer/tests/snapshots/analysis__module_level_events.snap @@ -18,7 +18,7 @@ note: │ 9 │ ╭ fn transfer(ctx: Context, to : address, value : u256): 10 │ │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) - │ ╰─────────────────────────────────────────────────────────────────────────^ attributes hash: 6905847783095140889 + │ ╰─────────────────────────────────────────────────────────────────────────^ attributes hash: 10847004199357482546 │ = FunctionSignature { self_decl: None, @@ -27,6 +27,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -38,6 +39,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -46,6 +48,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__multi_param.snap b/crates/analyzer/tests/snapshots/analysis__multi_param.snap index 3164fceadd..40a6081d92 100644 --- a/crates/analyzer/tests/snapshots/analysis__multi_param.snap +++ b/crates/analyzer/tests/snapshots/analysis__multi_param.snap @@ -12,13 +12,14 @@ note: 5 │ │ my_array[1] = y 6 │ │ my_array[2] = z 7 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 8770278506365184608 + │ ╰───────────────────────^ attributes hash: 10778435134172267300 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -29,6 +30,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( @@ -39,6 +41,7 @@ note: ), }, FunctionParam { + label: None, name: "z", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__nested_map.snap b/crates/analyzer/tests/snapshots/analysis__nested_map.snap index 66c33e1470..306a6f5f19 100644 --- a/crates/analyzer/tests/snapshots/analysis__nested_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__nested_map.snap @@ -16,7 +16,7 @@ note: │ 5 │ ╭ pub fn read_bar(self, a: address, b: address) -> u256: 6 │ │ return self.bar[a][b] - │ ╰─────────────────────────────^ attributes hash: 17417949435712456140 + │ ╰─────────────────────────────^ attributes hash: 17216960098647945084 │ = FunctionSignature { self_decl: Some( @@ -25,6 +25,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -33,6 +34,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -83,7 +85,7 @@ note: │ 8 │ ╭ pub fn write_bar(self, a: address, b: address, value: u256): 9 │ │ self.bar[a][b] = value - │ ╰──────────────────────────────^ attributes hash: 1779063144971354227 + │ ╰──────────────────────────────^ attributes hash: 1717293224155577849 │ = FunctionSignature { self_decl: Some( @@ -92,6 +94,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -100,6 +103,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -108,6 +112,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -160,7 +165,7 @@ note: │ 11 │ ╭ pub fn read_baz(self, a: address, b: u256) -> bool: 12 │ │ return self.baz[a][b] - │ ╰─────────────────────────────^ attributes hash: 16759134235645813766 + │ ╰─────────────────────────────^ attributes hash: 13548986453815092160 │ = FunctionSignature { self_decl: Some( @@ -169,6 +174,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -177,6 +183,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -227,7 +234,7 @@ note: │ 14 │ ╭ pub fn write_baz(self, a: address, b: u256, value: bool): 15 │ │ self.baz[a][b] = value - │ ╰──────────────────────────────^ attributes hash: 2108296425256224856 + │ ╰──────────────────────────────^ attributes hash: 6442389777288668179 │ = FunctionSignature { self_decl: Some( @@ -236,6 +243,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "a", typ: Ok( Base( @@ -244,6 +252,7 @@ note: ), }, FunctionParam { + label: None, name: "b", typ: Ok( Base( @@ -254,6 +263,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__ownable.snap b/crates/analyzer/tests/snapshots/analysis__ownable.snap index ebcdda1d9a..16db4871b8 100644 --- a/crates/analyzer/tests/snapshots/analysis__ownable.snap +++ b/crates/analyzer/tests/snapshots/analysis__ownable.snap @@ -56,7 +56,7 @@ note: 17 │ │ assert ctx.msg_sender() == self._owner 18 │ │ self._owner = address(0) 19 │ │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) - │ ╰─────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 5828909688388067108 + │ ╰─────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -67,6 +67,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -183,7 +184,7 @@ note: 23 │ │ assert newOwner != address(0) 24 │ │ self._owner = newOwner 25 │ │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) - │ ╰─────────────────────────────────────────────────────────────────────────────^ attributes hash: 1868732709090605566 + │ ╰─────────────────────────────────────────────────────────────────────────────^ attributes hash: 5690910393288515862 │ = FunctionSignature { self_decl: Some( @@ -194,6 +195,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -205,6 +207,7 @@ note: ), }, FunctionParam { + label: None, name: "newOwner", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap b/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap index 3be16b1bc8..65447c8bd1 100644 --- a/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap +++ b/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap @@ -6,15 +6,18 @@ expression: "build_snapshot(&db, module)" note: ┌─ pure_fn_standalone.fe:2:1 │ -2 │ ╭ fn add_bonus(x: u256) -> u256: +2 │ ╭ fn add_bonus(_ x: u256) -> u256: 3 │ │ return x + 10 - │ ╰─────────────────^ attributes hash: 15549141040406273197 + │ ╰─────────────────^ attributes hash: 4402553917254279762 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "x", typ: Ok( Base( @@ -59,12 +62,12 @@ note: note: ┌─ pure_fn_standalone.fe:9:5 │ - 9 │ ╭ fn add_points(self, user: address, val: u256): + 9 │ ╭ fn add_points(self, _ user: address, _ val: u256): 10 │ │ if self.cool_users[user]: 11 │ │ self.points[user] += add_bonus(val) 12 │ │ else: 13 │ │ self.points[user] += val - │ ╰────────────────────────────────────^ attributes hash: 4921297709595178488 + │ ╰────────────────────────────────────^ attributes hash: 11016307003570025576 │ = FunctionSignature { self_decl: Some( @@ -73,6 +76,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "user", typ: Ok( Base( @@ -81,6 +87,9 @@ note: ), }, FunctionParam { + label: Some( + "_", + ), name: "val", typ: Ok( Base( @@ -164,13 +173,13 @@ note: note: ┌─ pure_fn_standalone.fe:15:5 │ -15 │ ╭ pub fn bar(self, x: u256) -> u256: +15 │ ╭ pub fn bar(self, _ x: u256) -> u256: 16 │ │ let a: address = address(x) 17 │ │ self.add_points(a, 100) 18 │ │ self.cool_users[a] = true 19 │ │ self.add_points(a, 100) 20 │ │ return self.points[a] - │ ╰─────────────────────────────^ attributes hash: 2559326962008592778 + │ ╰─────────────────────────────^ attributes hash: 15237606768598971644 │ = FunctionSignature { self_decl: Some( @@ -179,6 +188,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "x", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap index 2ef6dd4b40..caa43e4a8c 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: 3 │ │ return x + y - │ ╰────────────────────^ attributes hash: 17016008738113359182 + │ ╰────────────────────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap index eee9f27768..931b6131fd 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u128, y: u128) -> u128: 3 │ │ return x + y - │ ╰────────────────────^ attributes hash: 14453716664001869661 + │ ╰────────────────────^ attributes hash: 233274078014721184 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap index 1879a44c38..677863d0a9 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x + y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_array.snap b/crates/analyzer/tests/snapshots/analysis__return_array.snap index 6afda1126b..0ba625ef27 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_array.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_array.snap @@ -10,13 +10,14 @@ note: 3 │ │ let my_array: Array 4 │ │ my_array[3] = x 5 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 9827501578243669852 + │ ╰───────────────────────^ attributes hash: 5752237891839439208 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap index edcae9c13f..61ab4d7179 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u128, y: u128) -> u128: 3 │ │ return x & y - │ ╰────────────────────^ attributes hash: 14453716664001869661 + │ ╰────────────────────^ attributes hash: 233274078014721184 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap index 1314db92f2..496036ae09 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x & y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap index 0c8a44ffcf..24504f7376 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x | y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap index 24d6e32f60..99c184973e 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x << y - │ ╰─────────────────────^ attributes hash: 3620942230080591742 + │ ╰─────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap index 9bc432ee81..eee6feaa6f 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: u256) -> i256: 3 │ │ return x >> y - │ ╰─────────────────────^ attributes hash: 3296607912990484374 + │ ╰─────────────────────^ attributes hash: 12518870770702615859 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap index d9de65666f..39cac35ae8 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x >> y - │ ╰─────────────────────^ attributes hash: 3620942230080591742 + │ ╰─────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap index 0501a4e814..3572bbabcf 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x ^ y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap index e847fa7773..f35d2e1f2a 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(some_condition: bool) -> bool: 3 │ │ return not some_condition - │ ╰─────────────────────────────────^ attributes hash: 5815264722058007031 + │ ╰─────────────────────────────────^ attributes hash: 9793001524182520011 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "some_condition", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap index 96a1130bc9..7799556e72 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: bool, y: bool) -> bool: 3 │ │ return x and y - │ ╰──────────────────────^ attributes hash: 11693897585276220683 + │ ╰──────────────────────^ attributes hash: 3532809531490166398 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -23,6 +24,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap index e6d4fce4fe..99ec8939a3 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: bool, y: bool) -> bool: 3 │ │ return x or y - │ ╰─────────────────────^ attributes hash: 11693897585276220683 + │ ╰─────────────────────^ attributes hash: 3532809531490166398 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -23,6 +24,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap b/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap index 78f711e727..af0cfe9118 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap @@ -8,7 +8,7 @@ note: │ 4 │ ╭ pub fn coinbase(ctx: Context) -> address: 5 │ │ return ctx.block_coinbase() - │ ╰───────────────────────────────────^ attributes hash: 17345910255563017853 + │ ╰───────────────────────────────────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -17,6 +17,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -52,7 +53,7 @@ note: │ 7 │ ╭ pub fn difficulty(ctx: Context) -> u256: 8 │ │ return ctx.block_difficulty() - │ ╰─────────────────────────────────────^ attributes hash: 8461121747246443614 + │ ╰─────────────────────────────────────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -61,6 +62,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -98,7 +100,7 @@ note: │ 10 │ ╭ pub fn number(ctx: Context) -> u256: 11 │ │ return ctx.block_number() - │ ╰─────────────────────────────────^ attributes hash: 8461121747246443614 + │ ╰─────────────────────────────────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -107,6 +109,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -144,7 +147,7 @@ note: │ 13 │ ╭ pub fn timestamp(ctx: Context) -> u256: 14 │ │ return ctx.block_timestamp() - │ ╰────────────────────────────────────^ attributes hash: 8461121747246443614 + │ ╰────────────────────────────────────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -153,6 +156,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -190,7 +194,7 @@ note: │ 16 │ ╭ pub fn chainid(ctx: Context) -> u256: 17 │ │ return ctx.chain_id() - │ ╰─────────────────────────────^ attributes hash: 8461121747246443614 + │ ╰─────────────────────────────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -199,6 +203,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -236,7 +241,7 @@ note: │ 19 │ ╭ pub fn sender(ctx: Context) -> address: 20 │ │ return ctx.msg_sender() - │ ╰───────────────────────────────^ attributes hash: 17345910255563017853 + │ ╰───────────────────────────────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -245,6 +250,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -280,7 +286,7 @@ note: │ 22 │ ╭ pub fn value(ctx: Context) -> u256: 23 │ │ return ctx.msg_value() - │ ╰──────────────────────────────^ attributes hash: 8461121747246443614 + │ ╰──────────────────────────────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -289,6 +295,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -326,7 +333,7 @@ note: │ 25 │ ╭ pub fn origin(ctx: Context) -> address: 26 │ │ return ctx.tx_origin() - │ ╰──────────────────────────────^ attributes hash: 17345910255563017853 + │ ╰──────────────────────────────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -335,6 +342,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -370,7 +378,7 @@ note: │ 28 │ ╭ pub fn gas_price(ctx: Context) -> u256: 29 │ │ return ctx.tx_gas_price() - │ ╰─────────────────────────────────^ attributes hash: 8461121747246443614 + │ ╰─────────────────────────────────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -379,6 +387,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( diff --git a/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap index 1f96e34d01..9eaf889600 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: 3 │ │ return x / y - │ ╰────────────────────^ attributes hash: 17016008738113359182 + │ ╰────────────────────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap index aa582b866c..e12004a300 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x / y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap index d068389a87..d42dabb586 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: 3 │ │ return x == y - │ ╰─────────────────────^ attributes hash: 10271937858551117190 + │ ╰─────────────────────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap index fa1d61e27f..056d0ca01c 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> bool: 3 │ │ return x > y - │ ╰────────────────────^ attributes hash: 10766283907899063939 + │ ╰────────────────────^ attributes hash: 7978284628773169348 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap index c4763af0d0..bf7cae70fe 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: 3 │ │ return x > y - │ ╰────────────────────^ attributes hash: 10271937858551117190 + │ ╰────────────────────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap index 8fa10caef7..38550ab176 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> bool: 3 │ │ return x >= y - │ ╰─────────────────────^ attributes hash: 10766283907899063939 + │ ╰─────────────────────^ attributes hash: 7978284628773169348 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap index 0e9837a942..9c3b542dd6 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: 3 │ │ return x >= y - │ ╰─────────────────────^ attributes hash: 10271937858551117190 + │ ╰─────────────────────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap index 4d1ee696e9..245373e856 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u128) -> u128: 3 │ │ return x - │ ╰────────────────^ attributes hash: 10669667050128298433 + │ ╰────────────────^ attributes hash: 8882570074302111953 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap index 8b405d6413..5f5818895a 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u16) -> u16: 3 │ │ return x - │ ╰────────────────^ attributes hash: 463773407042578243 + │ ╰────────────────^ attributes hash: 12880247899747575992 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap index 46ea37f4e2..0833b7041b 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256) -> u256: 3 │ │ return x - │ ╰────────────────^ attributes hash: 15549141040406273197 + │ ╰────────────────^ attributes hash: 6622018637299644818 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap index 2f2b2dc79a..2047c1edf1 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u32) -> u32: 3 │ │ return x - │ ╰────────────────^ attributes hash: 17965224511969901447 + │ ╰────────────────^ attributes hash: 3053189841811312763 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap index b922ec777d..1e637433c9 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u64) -> u64: 3 │ │ return x - │ ╰────────────────^ attributes hash: 9587363388275941446 + │ ╰────────────────^ attributes hash: 14360693544116809530 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap index 1b8c8a39f6..20d8b5765b 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u8) -> u8: 3 │ │ return x - │ ╰────────────────^ attributes hash: 12524532344014849575 + │ ╰────────────────^ attributes hash: 4472501580732693210 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap index e97a49b75c..9cae37e632 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> bool: 3 │ │ return x < y - │ ╰────────────────────^ attributes hash: 10766283907899063939 + │ ╰────────────────────^ attributes hash: 7978284628773169348 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap index 42350ec695..4a156f79f3 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u128, y: u128) -> bool: 3 │ │ return x < y - │ ╰────────────────────^ attributes hash: 7861716536042542890 + │ ╰────────────────────^ attributes hash: 4640755342958234471 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap index 7b85785b37..c4f15fcd3f 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: 3 │ │ return x < y - │ ╰────────────────────^ attributes hash: 10271937858551117190 + │ ╰────────────────────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap index 9b85ed7e09..7f6eb1b897 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> bool: 3 │ │ return x <= y - │ ╰─────────────────────^ attributes hash: 10766283907899063939 + │ ╰─────────────────────^ attributes hash: 7978284628773169348 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap index 7c386ea2de..c5ea29f2c8 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: 3 │ │ return x <= y - │ ╰─────────────────────^ attributes hash: 10271937858551117190 + │ ╰─────────────────────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap index a82c7b7fb9..7503f7dde5 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: 3 │ │ return x % y - │ ╰────────────────────^ attributes hash: 17016008738113359182 + │ ╰────────────────────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap index 586a356aff..d2273564d4 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x % y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap b/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap index c8ecd59923..2f80620711 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap @@ -8,7 +8,7 @@ note: │ 4 │ ╭ pub fn bar(ctx: Context) -> u256: 5 │ │ return ctx.msg_sig() - │ ╰────────────────────────────^ attributes hash: 8461121747246443614 + │ ╰────────────────────────────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -17,6 +17,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( diff --git a/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap index 2454d46c75..8ccb5dcc42 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: 3 │ │ return x * y - │ ╰────────────────────^ attributes hash: 17016008738113359182 + │ ╰────────────────────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap index 7b0fd60c4f..ba224bfcb8 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x * y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap index ddba796e9c..4e0fa94bdb 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: 3 │ │ return x != y - │ ╰─────────────────────^ attributes hash: 10271937858551117190 + │ ╰─────────────────────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap index abd8dd13fe..22c531e55d 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i8, y: u8) -> i8: 3 │ │ return x ** y - │ ╰─────────────────────^ attributes hash: 15827336257474978125 + │ ╰─────────────────────^ attributes hash: 14588309679488297104 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap index 09874962d8..8840ad7b1d 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x ** y - │ ╰─────────────────────^ attributes hash: 3620942230080591742 + │ ╰─────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap index 3804cbce22..25f8762ece 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: 3 │ │ return x - y - │ ╰────────────────────^ attributes hash: 17016008738113359182 + │ ╰────────────────────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap index bd96952e64..d2bacb4c69 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap @@ -8,13 +8,14 @@ note: │ 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: 3 │ │ return x - y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -25,6 +26,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn_with_args.snap b/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn_with_args.snap index dc35151296..1be0097720 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn_with_args.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn_with_args.snap @@ -12,16 +12,19 @@ note: note: ┌─ return_u256_from_called_fn_with_args.fe:3:5 │ -3 │ ╭ pub fn foo(val1: u256, val2: u256, val3: u256, val4: u256, val5: u256) -> u256: -4 │ │ return val1 + val2 + val3 + val4 + val5 - │ ╰───────────────────────────────────────────────^ attributes hash: 16545546616934674984 +3 │ ╭ pub fn foo(_ v1: u256, _ v2: u256, _ v3: u256, _ v4: u256, _ v5: u256) -> u256: +4 │ │ return v1 + v2 + v3 + v4 + v5 + │ ╰─────────────────────────────────────^ attributes hash: 1504347162142127509 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { - name: "val1", + label: Some( + "_", + ), + name: "v1", typ: Ok( Base( Numeric( @@ -31,7 +34,10 @@ note: ), }, FunctionParam { - name: "val2", + label: Some( + "_", + ), + name: "v2", typ: Ok( Base( Numeric( @@ -41,7 +47,10 @@ note: ), }, FunctionParam { - name: "val3", + label: Some( + "_", + ), + name: "v3", typ: Ok( Base( Numeric( @@ -51,7 +60,10 @@ note: ), }, FunctionParam { - name: "val4", + label: Some( + "_", + ), + name: "v4", typ: Ok( Base( Numeric( @@ -61,7 +73,10 @@ note: ), }, FunctionParam { - name: "val5", + label: Some( + "_", + ), + name: "v5", typ: Ok( Base( Numeric( @@ -83,40 +98,40 @@ note: note: ┌─ return_u256_from_called_fn_with_args.fe:4:16 │ -4 │ return val1 + val2 + val3 + val4 + val5 - │ ^^^^ ^^^^ u256: Value - │ │ +4 │ return v1 + v2 + v3 + v4 + v5 + │ ^^ ^^ u256: Value + │ │ │ u256: Value note: ┌─ return_u256_from_called_fn_with_args.fe:4:16 │ -4 │ return val1 + val2 + val3 + val4 + val5 - │ ^^^^^^^^^^^ ^^^^ u256: Value - │ │ +4 │ return v1 + v2 + v3 + v4 + v5 + │ ^^^^^^^ ^^ u256: Value + │ │ │ u256: Value note: ┌─ return_u256_from_called_fn_with_args.fe:4:16 │ -4 │ return val1 + val2 + val3 + val4 + val5 - │ ^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value - │ │ +4 │ return v1 + v2 + v3 + v4 + v5 + │ ^^^^^^^^^^^^ ^^ u256: Value + │ │ │ u256: Value note: ┌─ return_u256_from_called_fn_with_args.fe:4:16 │ -4 │ return val1 + val2 + val3 + val4 + val5 - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value - │ │ +4 │ return v1 + v2 + v3 + v4 + v5 + │ ^^^^^^^^^^^^^^^^^ ^^ u256: Value + │ │ │ u256: Value note: ┌─ return_u256_from_called_fn_with_args.fe:4:16 │ -4 │ return val1 + val2 + val3 + val4 + val5 - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +4 │ return v1 + v2 + v3 + v4 + v5 + │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: ┌─ return_u256_from_called_fn_with_args.fe:6:5 diff --git a/crates/analyzer/tests/snapshots/analysis__revert.snap b/crates/analyzer/tests/snapshots/analysis__revert.snap index b73cf0886b..5a3c52b381 100644 --- a/crates/analyzer/tests/snapshots/analysis__revert.snap +++ b/crates/analyzer/tests/snapshots/analysis__revert.snap @@ -41,8 +41,8 @@ note: ┌─ revert.fe:13:5 │ 13 │ ╭ pub fn revert_custom_error(ctx: Context): -14 │ │ ctx.send_value(address(0), 100) - │ ╰───────────────────────────────────────^ attributes hash: 11452088215302469574 +14 │ │ ctx.send_value(to: address(0), wei: 100) + │ ╰────────────────────────────────────────────────^ attributes hash: 5519676733853656531 │ = FunctionSignature { self_decl: None, @@ -51,6 +51,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -72,24 +73,24 @@ note: note: ┌─ revert.fe:14:9 │ -14 │ ctx.send_value(address(0), 100) - │ ^^^ ^ u256: Value - │ │ +14 │ ctx.send_value(to: address(0), wei: 100) + │ ^^^ ^ u256: Value + │ │ │ Context: Memory note: - ┌─ revert.fe:14:24 + ┌─ revert.fe:14:28 │ -14 │ ctx.send_value(address(0), 100) - │ ^^^^^^^^^^ ^^^ u256: Value - │ │ - │ address: Value +14 │ ctx.send_value(to: address(0), wei: 100) + │ ^^^^^^^^^^ ^^^ u256: Value + │ │ + │ address: Value note: ┌─ revert.fe:14:9 │ -14 │ ctx.send_value(address(0), 100) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +14 │ ctx.send_value(to: address(0), wei: 100) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value note: ┌─ revert.fe:16:5 diff --git a/crates/analyzer/tests/snapshots/analysis__self_address.snap b/crates/analyzer/tests/snapshots/analysis__self_address.snap index 9ff9a5c87a..b6fbafc821 100644 --- a/crates/analyzer/tests/snapshots/analysis__self_address.snap +++ b/crates/analyzer/tests/snapshots/analysis__self_address.snap @@ -8,7 +8,7 @@ note: │ 4 │ ╭ pub fn my_address(ctx: Context) -> address: 5 │ │ return ctx.self_address() - │ ╰─────────────────────────────────^ attributes hash: 17345910255563017853 + │ ╰─────────────────────────────────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -17,6 +17,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( diff --git a/crates/analyzer/tests/snapshots/analysis__send_value.snap b/crates/analyzer/tests/snapshots/analysis__send_value.snap index 9378816508..c9758ad977 100644 --- a/crates/analyzer/tests/snapshots/analysis__send_value.snap +++ b/crates/analyzer/tests/snapshots/analysis__send_value.snap @@ -8,7 +8,7 @@ note: │ 4 │ ╭ pub fn send_them_wei(ctx: Context, to: address, wei: u256): 5 │ │ ctx.send_value(to, wei) - │ ╰───────────────────────────────^ attributes hash: 3182874939886264923 + │ ╰───────────────────────────────^ attributes hash: 14069636423119281176 │ = FunctionSignature { self_decl: None, @@ -17,6 +17,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -28,6 +29,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -36,6 +38,7 @@ note: ), }, FunctionParam { + label: None, name: "wei", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap b/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap index eae4aa1beb..afafa383f8 100644 --- a/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap +++ b/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap @@ -28,7 +28,7 @@ note: │ 13 │ ╭ pub fn write_num(self, x: u256): 14 │ │ self.num = x - │ ╰────────────────────^ attributes hash: 13114605224717333419 + │ ╰────────────────────^ attributes hash: 4582507849783874218 │ = FunctionSignature { self_decl: Some( @@ -37,6 +37,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -107,7 +108,7 @@ note: │ 19 │ ╭ pub fn write_nums(self, x: Array): 20 │ │ self.nums = x - │ ╰─────────────────────^ attributes hash: 9901766097095470194 + │ ╰─────────────────────^ attributes hash: 15243923981938152137 │ = FunctionSignature { self_decl: Some( @@ -116,6 +117,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Array( @@ -198,7 +200,7 @@ note: │ 25 │ ╭ pub fn write_str(self, x: String<26>): 26 │ │ self.str = x - │ ╰────────────────────^ attributes hash: 9017792115505263739 + │ ╰────────────────────^ attributes hash: 3874088449945578306 │ = FunctionSignature { self_decl: Some( @@ -207,6 +209,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( String( @@ -288,7 +291,7 @@ note: 35 │ │ nums: self.nums.to_mem(), 36 │ │ str: self.str.to_mem() 37 │ │ ) - │ ╰─────────^ attributes hash: 5828909688388067108 + │ ╰─────────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -299,6 +302,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( diff --git a/crates/analyzer/tests/snapshots/analysis__strings.snap b/crates/analyzer/tests/snapshots/analysis__strings.snap index 57ce9f0d37..a4210929db 100644 --- a/crates/analyzer/tests/snapshots/analysis__strings.snap +++ b/crates/analyzer/tests/snapshots/analysis__strings.snap @@ -26,13 +26,14 @@ note: │ 16 │ ╭ pub fn bar(s1: String<100>, s2: String<100>) -> String<100>: 17 │ │ return s2 - │ ╰─────────────────^ attributes hash: 17275759829526043442 + │ ╰─────────────────^ attributes hash: 4992726103398710247 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "s1", typ: Ok( String( @@ -43,6 +44,7 @@ note: ), }, FunctionParam { + label: None, name: "s2", typ: Ok( String( diff --git a/crates/analyzer/tests/snapshots/analysis__struct_fns.snap b/crates/analyzer/tests/snapshots/analysis__struct_fns.snap index 7f8a0c8993..6a38d3e5a6 100644 --- a/crates/analyzer/tests/snapshots/analysis__struct_fns.snap +++ b/crates/analyzer/tests/snapshots/analysis__struct_fns.snap @@ -16,13 +16,14 @@ note: │ 5 │ ╭ pub fn new(x: u64, y: u64) -> Point: 6 │ │ return Point(x, y) - │ ╰──────────────────────^ attributes hash: 15722930327333552684 + │ ╰──────────────────────^ attributes hash: 16588628800633378656 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -33,6 +34,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( @@ -139,11 +141,11 @@ note: note: ┌─ struct_fns.fe:15:3 │ -15 │ ╭ pub fn set_x(self, x: u64) -> u64: +15 │ ╭ pub fn set_x(self, _ x: u64) -> u64: 16 │ │ let old: u64 = self.x 17 │ │ self.x = x 18 │ │ return old - │ ╰──────────────^ attributes hash: 2742220358163612616 + │ ╰──────────────^ attributes hash: 9776752757917359734 │ = FunctionSignature { self_decl: Some( @@ -152,6 +154,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "x", typ: Ok( Base( @@ -280,7 +285,7 @@ note: 27 │ ╭ pub fn translate(self, x: u64, y: u64): 28 │ │ self.x += x 29 │ │ self.y += y - │ ╰───────────────^ attributes hash: 13052419481389358350 + │ ╰───────────────^ attributes hash: 7723021135770029200 │ = FunctionSignature { self_decl: Some( @@ -289,6 +294,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -299,6 +305,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( @@ -343,11 +350,11 @@ note: note: ┌─ struct_fns.fe:31:3 │ -31 │ ╭ pub fn add(self, other: Point) -> Point: +31 │ ╭ pub fn add(self, _ other: Point) -> Point: 32 │ │ let x: u64 = self.x + other.x 33 │ │ let y: u64 = self.y + other.y 34 │ │ return Point(x, y) - │ ╰──────────────────────^ attributes hash: 3240940104805858179 + │ ╰──────────────────────^ attributes hash: 13368777112318344367 │ = FunctionSignature { self_decl: Some( @@ -356,6 +363,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "other", typ: Ok( Struct( @@ -448,7 +458,7 @@ note: │ 36 │ ╭ pub fn do_pointy_things(): 37 │ │ let p1: Point = Point.origin() -38 │ │ p1.translate(5, 10) +38 │ │ p1.translate(x: 5, y: 10) 39 │ │ · │ 42 │ │ @@ -482,17 +492,17 @@ note: │ 37 │ let p1: Point = Point.origin() │ ^^^^^^^^^^^^^^ Point: Memory -38 │ p1.translate(5, 10) - │ ^^ ^ ^^ u64: Value - │ │ │ - │ │ u64: Value +38 │ p1.translate(x: 5, y: 10) + │ ^^ ^ ^^ u64: Value + │ │ │ + │ │ u64: Value │ Point: Memory note: ┌─ struct_fns.fe:38:3 │ -38 │ p1.translate(5, 10) - │ ^^^^^^^^^^^^^^^^^^^ (): Value +38 │ p1.translate(x: 5, y: 10) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value 39 │ 40 │ let p2: Point = Point(x: 1, y: 2) │ ^ ^ u64: Value @@ -564,13 +574,14 @@ note: · │ 55 │ │ assert p.x() == y and p.y == 100 56 │ │ return p.y - │ ╰──────────────^ attributes hash: 16979873837687926622 + │ ╰──────────────^ attributes hash: 14881144643149919691 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "x", typ: Ok( Base( @@ -581,6 +592,7 @@ note: ), }, FunctionParam { + label: None, name: "y", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__structs.snap b/crates/analyzer/tests/snapshots/analysis__structs.snap index 0d1af7d185..b3a75bebbc 100644 --- a/crates/analyzer/tests/snapshots/analysis__structs.snap +++ b/crates/analyzer/tests/snapshots/analysis__structs.snap @@ -36,13 +36,14 @@ note: │ 15 │ ╭ pub fn new(val: u256) -> Mixed: 16 │ │ return Mixed(foo: val, bar: false) - │ ╰──────────────────────────────────────────^ attributes hash: 3521701349047213671 + │ ╰──────────────────────────────────────────^ attributes hash: 2524938698704972422 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "val", typ: Ok( Base( @@ -1773,7 +1774,7 @@ note: │ 141 │ ╭ pub fn set_house(self, data: House): 142 │ │ self.my_house = data - │ ╰────────────────────────────^ attributes hash: 4344434039965224039 + │ ╰────────────────────────────^ attributes hash: 571714015924720006 │ = FunctionSignature { self_decl: Some( @@ -1782,6 +1783,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "data", typ: Ok( Struct( diff --git a/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap b/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap index f350fd3e22..5fe012325b 100644 --- a/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap +++ b/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap @@ -8,13 +8,14 @@ note: │ 3 │ ╭ pub fn bar(input: u256) -> u256: 4 │ │ return 1 if input > 5 else 0 - │ ╰────────────────────────────────────^ attributes hash: 9715528395521480793 + │ ╰────────────────────────────────────^ attributes hash: 10660199954095577886 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "input", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap b/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap index 9179ec68b2..23d28b5748 100644 --- a/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap @@ -24,13 +24,14 @@ note: 12 │ │ my_address: address 13 │ │ ) -> (u256, bool, address): 14 │ │ return (my_num, my_bool, my_address) - │ ╰────────────────────────────────────────────^ attributes hash: 4437387623605149102 + │ ╰────────────────────────────────────────────^ attributes hash: 10223738621782129186 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_num", typ: Ok( Base( @@ -41,6 +42,7 @@ note: ), }, FunctionParam { + label: None, name: "my_bool", typ: Ok( Base( @@ -49,6 +51,7 @@ note: ), }, FunctionParam { + label: None, name: "my_address", typ: Ok( Base( @@ -98,13 +101,14 @@ note: │ 16 │ ╭ pub fn read_my_tuple_item0(my_tuple: (u256, bool, address)) -> u256: 17 │ │ return my_tuple.item0 - │ ╰─────────────────────────────^ attributes hash: 374081722650765571 + │ ╰─────────────────────────────^ attributes hash: 1005385906871296536 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_tuple", typ: Ok( Tuple( @@ -153,13 +157,14 @@ note: │ 19 │ ╭ pub fn read_my_tuple_item1(my_tuple: (u256, bool, address)) -> bool: 20 │ │ return my_tuple.item1 - │ ╰─────────────────────────────^ attributes hash: 9811602730257365589 + │ ╰─────────────────────────────^ attributes hash: 5615774585289781220 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_tuple", typ: Ok( Tuple( @@ -206,13 +211,14 @@ note: │ 22 │ ╭ pub fn read_my_tuple_item2(my_tuple: (u256, bool, address)) -> address: 23 │ │ return my_tuple.item2 - │ ╰─────────────────────────────^ attributes hash: 8496136767779128416 + │ ╰─────────────────────────────^ attributes hash: 13024428391414866682 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_tuple", typ: Ok( Tuple( @@ -259,13 +265,14 @@ note: │ 25 │ ╭ pub fn read_my_tuple_item10(my_tuple: (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address)) -> address: 26 │ │ return my_tuple.item10 - │ ╰──────────────────────────────^ attributes hash: 10640903536150521058 + │ ╰──────────────────────────────^ attributes hash: 11830390438544540912 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_tuple", typ: Ok( Tuple( @@ -354,7 +361,7 @@ note: │ 28 │ ╭ pub fn emit_my_event(ctx: Context, my_tuple: (u256, bool, address)): 29 │ │ emit MyEvent(ctx, my_tuple) - │ ╰───────────────────────────────────^ attributes hash: 8668761244029568427 + │ ╰───────────────────────────────────^ attributes hash: 10535390144430265813 │ = FunctionSignature { self_decl: None, @@ -363,6 +370,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -374,6 +382,7 @@ note: ), }, FunctionParam { + label: None, name: "my_tuple", typ: Ok( Tuple( @@ -452,7 +461,7 @@ note: 31 │ ╭ pub fn set_my_sto_tuple(self, my_u256: u256, my_i32: i32): 32 │ │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) 33 │ │ self.my_sto_tuple = (my_u256, my_i32) - │ ╰─────────────────────────────────────────────^ attributes hash: 11434807878539479894 + │ ╰─────────────────────────────────────────────^ attributes hash: 14404502892103280650 │ = FunctionSignature { self_decl: Some( @@ -461,6 +470,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_u256", typ: Ok( Base( @@ -471,6 +481,7 @@ note: ), }, FunctionParam { + label: None, name: "my_i32", typ: Ok( Base( @@ -632,7 +643,7 @@ note: · │ 44 │ │ ) 45 │ │ emit_my_event(ctx, my_tuple) - │ ╰────────────────────────────────────^ attributes hash: 5828909688388067108 + │ ╰────────────────────────────────────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -643,6 +654,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -746,13 +758,14 @@ note: │ 47 │ ╭ pub fn encode_my_tuple(my_tuple: (u256, bool, address)) -> Array: 48 │ │ return my_tuple.abi_encode() - │ ╰────────────────────────────────────^ attributes hash: 12982826473068515083 + │ ╰────────────────────────────────────^ attributes hash: 3539305055628398466 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: None, name: "my_tuple", typ: Ok( Tuple( diff --git a/crates/analyzer/tests/snapshots/analysis__two_contracts.snap b/crates/analyzer/tests/snapshots/analysis__two_contracts.snap index 0a52db5b9b..47d205afe3 100644 --- a/crates/analyzer/tests/snapshots/analysis__two_contracts.snap +++ b/crates/analyzer/tests/snapshots/analysis__two_contracts.snap @@ -15,7 +15,7 @@ note: 9 │ ╭ pub fn foo(self, ctx: Context) -> u256: 10 │ │ self.other.set_foo_addr(ctx.self_address()) 11 │ │ return self.other.answer() - │ ╰──────────────────────────────────^ attributes hash: 15791625094174035122 + │ ╰──────────────────────────────────^ attributes hash: 3247318976601732237 │ = FunctionSignature { self_decl: Some( @@ -26,6 +26,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -89,15 +90,18 @@ note: note: ┌─ two_contracts.fe:13:5 │ -13 │ ╭ pub fn add(x: u256, y: u256) -> u256: +13 │ ╭ pub fn add(_ x: u256, _ y: u256) -> u256: 14 │ │ return x + y - │ ╰────────────────────^ attributes hash: 3620942230080591742 + │ ╰────────────────────^ attributes hash: 4448606202021980030 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "x", typ: Ok( Base( @@ -108,6 +112,9 @@ note: ), }, FunctionParam { + label: Some( + "_", + ), name: "y", typ: Ok( Base( @@ -150,9 +157,9 @@ note: note: ┌─ two_contracts.fe:19:5 │ -19 │ ╭ pub fn set_foo_addr(self, ctx: Context, addr: address): +19 │ ╭ pub fn set_foo_addr(self, ctx: Context, _ addr: address): 20 │ │ self.other = Foo(ctx, addr) - │ ╰───────────────────────────────────^ attributes hash: 2501636549900236199 + │ ╰───────────────────────────────────^ attributes hash: 736575608159807992 │ = FunctionSignature { self_decl: Some( @@ -163,6 +170,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -174,6 +182,9 @@ note: ), }, FunctionParam { + label: Some( + "_", + ), name: "addr", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__type_aliases.snap b/crates/analyzer/tests/snapshots/analysis__type_aliases.snap index a5bd6751bb..9cc8423219 100644 --- a/crates/analyzer/tests/snapshots/analysis__type_aliases.snap +++ b/crates/analyzer/tests/snapshots/analysis__type_aliases.snap @@ -64,7 +64,7 @@ note: 20 │ │ self.posts[id] = body 21 │ │ self.authors[ctx.msg_sender()] 22 │ │ self.scoreboard[id] = 0 - │ ╰───────────────────────────────^ attributes hash: 16028139387423377736 + │ ╰───────────────────────────────^ attributes hash: 4649056442968527631 │ = FunctionSignature { self_decl: Some( @@ -75,6 +75,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -86,6 +87,7 @@ note: ), }, FunctionParam { + label: None, name: "body", typ: Ok( String( @@ -180,7 +182,7 @@ note: 25 │ │ let score: Score = self.scoreboard[id] + 1 26 │ │ self.scoreboard[id] = score 27 │ │ return score - │ ╰────────────────────^ attributes hash: 15818897980290454718 + │ ╰────────────────────^ attributes hash: 4383698668262923633 │ = FunctionSignature { self_decl: Some( @@ -189,6 +191,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "id", typ: Ok( Base( @@ -267,7 +270,7 @@ note: │ 29 │ ╭ pub fn get_post(self, id: PostId) -> PostBody: 30 │ │ return self.posts[id].to_mem() - │ ╰──────────────────────────────────────^ attributes hash: 9921789917420135973 + │ ╰──────────────────────────────────────^ attributes hash: 6772945894090223199 │ = FunctionSignature { self_decl: Some( @@ -276,6 +279,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "id", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap b/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap index a9d412f119..14cc193d04 100644 --- a/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap @@ -14,7 +14,7 @@ note: │ 4 │ ╭ pub fn read_bar(self, key: u128) -> u128: 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 1727403915407605005 + │ ╰────────────────────────────^ attributes hash: 1939765458140608268 │ = FunctionSignature { self_decl: Some( @@ -23,6 +23,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -67,7 +68,7 @@ note: │ 7 │ ╭ pub fn write_bar(self, key: u128, value: u128): 8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 6770942269102556094 + │ ╰─────────────────────────────^ attributes hash: 9126735252114279653 │ = FunctionSignature { self_decl: Some( @@ -76,6 +77,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -86,6 +88,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap b/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap index 27f3461d6e..e110cd6f23 100644 --- a/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap @@ -14,7 +14,7 @@ note: │ 4 │ ╭ pub fn read_bar(self, key: u16) -> u16: 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 3799284136953683722 + │ ╰────────────────────────────^ attributes hash: 18312053447303862075 │ = FunctionSignature { self_decl: Some( @@ -23,6 +23,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -67,7 +68,7 @@ note: │ 7 │ ╭ pub fn write_bar(self, key: u16, value: u16): 8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 2862224086297333864 + │ ╰─────────────────────────────^ attributes hash: 8088868709641766820 │ = FunctionSignature { self_decl: Some( @@ -76,6 +77,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -86,6 +88,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap b/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap index 348f44eec5..d418f7f77f 100644 --- a/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap @@ -14,7 +14,7 @@ note: │ 4 │ ╭ pub fn read_bar(self, key: u256) -> u256: 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 4111540032382247727 + │ ╰────────────────────────────^ attributes hash: 14897000516975740248 │ = FunctionSignature { self_decl: Some( @@ -23,6 +23,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -67,7 +68,7 @@ note: │ 7 │ ╭ pub fn write_bar(self, key: u256, value: u256): 8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 11519906425715717488 + │ ╰─────────────────────────────^ attributes hash: 17030413653610901743 │ = FunctionSignature { self_decl: Some( @@ -76,6 +77,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -86,6 +88,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap b/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap index f3c09cfd66..ba117283f7 100644 --- a/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap @@ -14,7 +14,7 @@ note: │ 4 │ ╭ pub fn read_bar(self, key: u32) -> u32: 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 2858021264889128184 + │ ╰────────────────────────────^ attributes hash: 17684751964541454304 │ = FunctionSignature { self_decl: Some( @@ -23,6 +23,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -67,7 +68,7 @@ note: │ 7 │ ╭ pub fn write_bar(self, key: u32, value: u32): 8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 11138198051302583642 + │ ╰─────────────────────────────^ attributes hash: 9068646997358780798 │ = FunctionSignature { self_decl: Some( @@ -76,6 +77,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -86,6 +88,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap b/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap index ac86c0d0e9..93d44e2ddf 100644 --- a/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap @@ -14,7 +14,7 @@ note: │ 4 │ ╭ pub fn read_bar(self, key: u64) -> u64: 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 6069675140256389255 + │ ╰────────────────────────────^ attributes hash: 5490397784598880129 │ = FunctionSignature { self_decl: Some( @@ -23,6 +23,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -67,7 +68,7 @@ note: │ 7 │ ╭ pub fn write_bar(self, key: u64, value: u64): 8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 5638608008920365969 + │ ╰─────────────────────────────^ attributes hash: 2182326649216136625 │ = FunctionSignature { self_decl: Some( @@ -76,6 +77,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -86,6 +88,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap b/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap index e82dae077d..09a887aab4 100644 --- a/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap @@ -14,7 +14,7 @@ note: │ 4 │ ╭ pub fn read_bar(self, key: u8) -> u8: 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 16723483272283987819 + │ ╰────────────────────────────^ attributes hash: 3828358868158950430 │ = FunctionSignature { self_decl: Some( @@ -23,6 +23,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -67,7 +68,7 @@ note: │ 7 │ ╭ pub fn write_bar(self, key: u8, value: u8): 8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 9442261219093018984 + │ ╰─────────────────────────────^ attributes hash: 1989504953336313430 │ = FunctionSignature { self_decl: Some( @@ -76,6 +77,7 @@ note: ctx_decl: None, params: [ FunctionParam { + label: None, name: "key", typ: Ok( Base( @@ -86,6 +88,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( diff --git a/crates/analyzer/tests/snapshots/analysis__uniswap.snap b/crates/analyzer/tests/snapshots/analysis__uniswap.snap index 1877beaa19..5b22432f23 100644 --- a/crates/analyzer/tests/snapshots/analysis__uniswap.snap +++ b/crates/analyzer/tests/snapshots/analysis__uniswap.snap @@ -6,15 +6,18 @@ expression: "build_snapshot(&db, module)" note: ┌─ uniswap.fe:4:5 │ -4 │ ╭ pub fn balanceOf(account: address) -> u256: +4 │ ╭ pub fn balanceOf(_ account: address) -> u256: 5 │ │ return 0 - │ ╰────────────────^ attributes hash: 2137329072726581226 + │ ╰────────────────^ attributes hash: 4709511530683498418 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "account", typ: Ok( Base( @@ -41,16 +44,17 @@ note: note: ┌─ uniswap.fe:7:5 │ -7 │ ╭ pub fn transfer(recipient: address, amount: u256) -> bool: +7 │ ╭ pub fn transfer(to: address, _ amount: u256) -> bool: 8 │ │ return false - │ ╰────────────────────^ attributes hash: 14278358233768701433 + │ ╰────────────────────^ attributes hash: 12261720285838819896 │ = FunctionSignature { self_decl: None, ctx_decl: None, params: [ FunctionParam { - name: "recipient", + label: None, + name: "to", typ: Ok( Base( Address, @@ -58,6 +62,9 @@ note: ), }, FunctionParam { + label: Some( + "_", + ), name: "amount", typ: Ok( Base( @@ -284,7 +291,7 @@ note: 78 │ │ self.total_supply = self.total_supply + value 79 │ │ self.balances[to] = self.balances[to] + value 80 │ │ emit Transfer(ctx, from: address(0), to, value) - │ ╰───────────────────────────────────────────────────────^ attributes hash: 8083461052236716587 + │ ╰───────────────────────────────────────────────────────^ attributes hash: 12650409809079895726 │ = FunctionSignature { self_decl: Some( @@ -295,6 +302,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -306,6 +314,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -314,6 +323,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -460,7 +470,7 @@ note: 83 │ │ self.balances[from] = self.balances[from] - value 84 │ │ self.total_supply = self.total_supply - value 85 │ │ emit Transfer(ctx, from, to: address(0), value) - │ ╰───────────────────────────────────────────────────────^ attributes hash: 5051284079043548081 + │ ╰───────────────────────────────────────────────────────^ attributes hash: 16245072311291560743 │ = FunctionSignature { self_decl: Some( @@ -471,6 +481,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -482,6 +493,7 @@ note: ), }, FunctionParam { + label: None, name: "from", typ: Ok( Base( @@ -490,6 +502,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -630,12 +643,12 @@ note: } note: - ┌─ uniswap.fe:87:5 + ┌─ uniswap.fe:88:5 │ -87 │ ╭ fn _approve(self, ctx: Context, owner: address, spender: address, value: u256): -88 │ │ self.allowances[owner][spender] = value -89 │ │ emit Approval(ctx, owner, spender, value) - │ ╰─────────────────────────────────────────────────^ attributes hash: 16582163020557730049 +88 │ ╭ fn _approve(self, ctx: Context, owner: address, spender: address, value: u256): +89 │ │ self.allowances[owner][spender] = value +90 │ │ emit Approval(ctx, owner, spender, value) + │ ╰─────────────────────────────────────────────────^ attributes hash: 1630416716014819616 │ = FunctionSignature { self_decl: Some( @@ -646,6 +659,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -657,6 +671,7 @@ note: ), }, FunctionParam { + label: None, name: "owner", typ: Ok( Base( @@ -665,6 +680,7 @@ note: ), }, FunctionParam { + label: None, name: "spender", typ: Ok( Base( @@ -673,6 +689,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -691,35 +708,35 @@ note: } note: - ┌─ uniswap.fe:88:9 + ┌─ uniswap.fe:89:9 │ -88 │ self.allowances[owner][spender] = value +89 │ self.allowances[owner][spender] = value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:88:9 + ┌─ uniswap.fe:89:9 │ -88 │ self.allowances[owner][spender] = value +89 │ self.allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^ ^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:88:9 + ┌─ uniswap.fe:89:9 │ -88 │ self.allowances[owner][spender] = value +89 │ self.allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:88:9 + ┌─ uniswap.fe:89:9 │ -88 │ self.allowances[owner][spender] = value +89 │ self.allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } -89 │ emit Approval(ctx, owner, spender, value) +90 │ emit Approval(ctx, owner, spender, value) │ ^^^ ^^^^^ ^^^^^^^ ^^^^^ u256: Value │ │ │ │ │ │ │ address: Value @@ -727,9 +744,9 @@ note: │ Context: Memory note: - ┌─ uniswap.fe:89:9 + ┌─ uniswap.fe:90:9 │ -89 │ emit Approval(ctx, owner, spender, value) +90 │ emit Approval(ctx, owner, spender, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 8893313742751514912 │ = Event { @@ -768,13 +785,13 @@ note: } note: - ┌─ uniswap.fe:91:5 + ┌─ uniswap.fe:93:5 │ -91 │ ╭ fn _transfer(self, ctx: Context, from: address, to: address, value: u256): -92 │ │ self.balances[from] = self.balances[from] - value -93 │ │ self.balances[to] = self.balances[to] + value -94 │ │ emit Transfer(ctx, from, to, value) - │ ╰───────────────────────────────────────────^ attributes hash: 10048024656457243946 +93 │ ╭ fn _transfer(self, ctx: Context, from: address, to: address, value: u256): +94 │ │ self.balances[from] = self.balances[from] - value +95 │ │ self.balances[to] = self.balances[to] + value +96 │ │ emit Transfer(ctx, from, to, value) + │ ╰───────────────────────────────────────────^ attributes hash: 1442617122763943794 │ = FunctionSignature { self_decl: Some( @@ -785,6 +802,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -796,6 +814,7 @@ note: ), }, FunctionParam { + label: None, name: "from", typ: Ok( Base( @@ -804,6 +823,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -812,6 +832,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -830,89 +851,89 @@ note: } note: - ┌─ uniswap.fe:92:9 + ┌─ uniswap.fe:94:9 │ -92 │ self.balances[from] = self.balances[from] - value +94 │ self.balances[from] = self.balances[from] - value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:92:9 + ┌─ uniswap.fe:94:9 │ -92 │ self.balances[from] = self.balances[from] - value +94 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:92:9 + ┌─ uniswap.fe:94:9 │ -92 │ self.balances[from] = self.balances[from] - value +94 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ uniswap.fe:92:31 + ┌─ uniswap.fe:94:31 │ -92 │ self.balances[from] = self.balances[from] - value +94 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:92:31 + ┌─ uniswap.fe:94:31 │ -92 │ self.balances[from] = self.balances[from] - value +94 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:92:31 + ┌─ uniswap.fe:94:31 │ -92 │ self.balances[from] = self.balances[from] - value +94 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -93 │ self.balances[to] = self.balances[to] + value +95 │ self.balances[to] = self.balances[to] + value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:93:9 + ┌─ uniswap.fe:95:9 │ -93 │ self.balances[to] = self.balances[to] + value +95 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^ ^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:93:9 + ┌─ uniswap.fe:95:9 │ -93 │ self.balances[to] = self.balances[to] + value +95 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ uniswap.fe:93:29 + ┌─ uniswap.fe:95:29 │ -93 │ self.balances[to] = self.balances[to] + value +95 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^ ^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:93:29 + ┌─ uniswap.fe:95:29 │ -93 │ self.balances[to] = self.balances[to] + value +95 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:93:29 + ┌─ uniswap.fe:95:29 │ -93 │ self.balances[to] = self.balances[to] + value +95 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -94 │ emit Transfer(ctx, from, to, value) +96 │ emit Transfer(ctx, from, to, value) │ ^^^ ^^^^ ^^ ^^^^^ u256: Value │ │ │ │ │ │ │ address: Value @@ -920,9 +941,9 @@ note: │ Context: Memory note: - ┌─ uniswap.fe:94:9 + ┌─ uniswap.fe:96:9 │ -94 │ emit Transfer(ctx, from, to, value) +96 │ emit Transfer(ctx, from, to, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 │ = Event { @@ -961,91 +982,94 @@ note: } note: - ┌─ uniswap.fe:96:5 - │ -96 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool: -97 │ │ self._approve(ctx, ctx.msg_sender(), spender, value) -98 │ │ return true - │ ╰───────────────────^ attributes hash: 15274000982762670572 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: Some( - Mutable, - ), - params: [ - FunctionParam { - name: "ctx", - typ: Ok( - Struct( - Struct { - name: "Context", - field_count: 0, - }, - ), - ), - }, - FunctionParam { - name: "spender", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Bool, - ), - ), - } + ┌─ uniswap.fe:98:5 + │ + 98 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool: + 99 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) +100 │ │ return true + │ ╰───────────────────^ attributes hash: 8309406699454253603 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: Some( + Mutable, + ), + params: [ + FunctionParam { + label: None, + name: "ctx", + typ: Ok( + Struct( + Struct { + name: "Context", + field_count: 0, + }, + ), + ), + }, + FunctionParam { + label: None, + name: "spender", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Bool, + ), + ), + } note: - ┌─ uniswap.fe:97:9 + ┌─ uniswap.fe:99:9 │ -97 │ self._approve(ctx, ctx.msg_sender(), spender, value) - │ ^^^^ ^^^ ^^^ Context: Memory - │ │ │ +99 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) + │ ^^^^ ^^^ ^^^ Context: Memory + │ │ │ │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:97:28 + ┌─ uniswap.fe:99:35 │ -97 │ self._approve(ctx, ctx.msg_sender(), spender, value) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value - │ │ │ - │ │ address: Value - │ address: Value +99 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) + │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value + │ │ │ + │ │ address: Value + │ address: Value note: - ┌─ uniswap.fe:97:9 - │ -97 │ self._approve(ctx, ctx.msg_sender(), spender, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -98 │ return true - │ ^^^^ bool: Value + ┌─ uniswap.fe:99:9 + │ + 99 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +100 │ return true + │ ^^^^ bool: Value note: - ┌─ uniswap.fe:100:5 + ┌─ uniswap.fe:102:5 │ -100 │ ╭ pub fn transfer(self, ctx: Context, to: address, value: u256) -> bool: -101 │ │ self._transfer(ctx, ctx.msg_sender(), to, value) -102 │ │ return true - │ ╰───────────────────^ attributes hash: 13199048387464312392 +102 │ ╭ pub fn transfer(self, ctx: Context, to: address, value: u256) -> bool: +103 │ │ self._transfer(ctx, from: ctx.msg_sender(), to, value) +104 │ │ return true + │ ╰───────────────────^ attributes hash: 14718526948940966913 │ = FunctionSignature { self_decl: Some( @@ -1056,6 +1080,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -1067,6 +1092,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -1075,6 +1101,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -1093,41 +1120,40 @@ note: } note: - ┌─ uniswap.fe:101:9 + ┌─ uniswap.fe:103:9 │ -101 │ self._transfer(ctx, ctx.msg_sender(), to, value) - │ ^^^^ ^^^ ^^^ Context: Memory - │ │ │ +103 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) + │ ^^^^ ^^^ ^^^ Context: Memory + │ │ │ │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:101:29 + ┌─ uniswap.fe:103:35 │ -101 │ self._transfer(ctx, ctx.msg_sender(), to, value) - │ ^^^^^^^^^^^^^^^^ ^^ ^^^^^ u256: Value - │ │ │ - │ │ address: Value - │ address: Value +103 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) + │ ^^^^^^^^^^^^^^^^ ^^ ^^^^^ u256: Value + │ │ │ + │ │ address: Value + │ address: Value note: - ┌─ uniswap.fe:101:9 + ┌─ uniswap.fe:103:9 │ -101 │ self._transfer(ctx, ctx.msg_sender(), to, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -102 │ return true +103 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +104 │ return true │ ^^^^ bool: Value note: - ┌─ uniswap.fe:104:5 + ┌─ uniswap.fe:106:5 │ -104 │ ╭ pub fn transferFrom(self, ctx: Context, from: address, to: address, value: u256) -> bool: -105 │ │ assert self.allowances[from][ctx.msg_sender()] >= value -106 │ │ -107 │ │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value -108 │ │ self._transfer(ctx, from, to, value) -109 │ │ return true - │ ╰───────────────────^ attributes hash: 5815730021641750571 +106 │ ╭ pub fn transferFrom(self, ctx: Context, from: address, to: address, value: u256) -> bool: +107 │ │ assert self.allowances[from][ctx.msg_sender()] >= value +108 │ │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +109 │ │ self._transfer(ctx, from, to, value) +110 │ │ return true + │ ╰───────────────────^ attributes hash: 3284161617958543499 │ = FunctionSignature { self_decl: Some( @@ -1138,6 +1164,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -1149,6 +1176,7 @@ note: ), }, FunctionParam { + label: None, name: "from", typ: Ok( Base( @@ -1157,6 +1185,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -1165,6 +1194,7 @@ note: ), }, FunctionParam { + label: None, name: "value", typ: Ok( Base( @@ -1183,116 +1213,115 @@ note: } note: - ┌─ uniswap.fe:105:16 + ┌─ uniswap.fe:107:16 │ -105 │ assert self.allowances[from][ctx.msg_sender()] >= value +107 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:105:16 + ┌─ uniswap.fe:107:16 │ -105 │ assert self.allowances[from][ctx.msg_sender()] >= value +107 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:105:16 + ┌─ uniswap.fe:107:16 │ -105 │ assert self.allowances[from][ctx.msg_sender()] >= value +107 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:105:38 + ┌─ uniswap.fe:107:38 │ -105 │ assert self.allowances[from][ctx.msg_sender()] >= value +107 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:105:16 + ┌─ uniswap.fe:107:16 │ -105 │ assert self.allowances[from][ctx.msg_sender()] >= value +107 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:105:16 + ┌─ uniswap.fe:107:16 │ -105 │ assert self.allowances[from][ctx.msg_sender()] >= value +107 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -106 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:107:9 + ┌─ uniswap.fe:108:9 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:107:9 + ┌─ uniswap.fe:108:9 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:107:31 + ┌─ uniswap.fe:108:31 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:107:9 + ┌─ uniswap.fe:108:9 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ uniswap.fe:107:51 + ┌─ uniswap.fe:108:51 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:107:51 + ┌─ uniswap.fe:108:51 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:107:73 + ┌─ uniswap.fe:108:73 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:107:51 + ┌─ uniswap.fe:108:51 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:107:51 + ┌─ uniswap.fe:108:51 │ -107 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -108 │ self._transfer(ctx, from, to, value) +109 │ self._transfer(ctx, from, to, value) │ ^^^^ ^^^ ^^^^ ^^ ^^^^^ u256: Value │ │ │ │ │ │ │ │ │ address: Value @@ -1301,19 +1330,19 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:108:9 + ┌─ uniswap.fe:109:9 │ -108 │ self._transfer(ctx, from, to, value) +109 │ self._transfer(ctx, from, to, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -109 │ return true +110 │ return true │ ^^^^ bool: Value note: - ┌─ uniswap.fe:111:5 + ┌─ uniswap.fe:112:5 │ -111 │ ╭ pub fn balanceOf(self, account: address) -> u256: -112 │ │ return self.balances[account] - │ ╰─────────────────────────────────────^ attributes hash: 3934661437648326967 +112 │ ╭ pub fn balanceOf(self, _ account: address) -> u256: +113 │ │ return self.balances[account] + │ ╰─────────────────────────────────────^ attributes hash: 5993653573135321647 │ = FunctionSignature { self_decl: Some( @@ -1322,6 +1351,9 @@ note: ctx_decl: None, params: [ FunctionParam { + label: Some( + "_", + ), name: "account", typ: Ok( Base( @@ -1340,30 +1372,30 @@ note: } note: - ┌─ uniswap.fe:112:16 + ┌─ uniswap.fe:113:16 │ -112 │ return self.balances[account] +113 │ return self.balances[account] │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:112:16 + ┌─ uniswap.fe:113:16 │ -112 │ return self.balances[account] +113 │ return self.balances[account] │ ^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:112:16 + ┌─ uniswap.fe:113:16 │ -112 │ return self.balances[account] +113 │ return self.balances[account] │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:114:5 + ┌─ uniswap.fe:115:5 │ -114 │ ╭ pub fn get_reserves(self) -> (u256, u256, u256): -115 │ │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +115 │ ╭ pub fn get_reserves(self) -> (u256, u256, u256): +116 │ │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ╰────────────────────────────────────────────────────────────────────────^ attributes hash: 3743538709625240197 │ = FunctionSignature { @@ -1398,47 +1430,47 @@ note: } note: - ┌─ uniswap.fe:115:17 + ┌─ uniswap.fe:116:17 │ -115 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:115:17 + ┌─ uniswap.fe:116:17 │ -115 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(7) } => Value note: - ┌─ uniswap.fe:115:32 + ┌─ uniswap.fe:116:32 │ -115 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:115:47 + ┌─ uniswap.fe:116:47 │ -115 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(9) } => Value note: - ┌─ uniswap.fe:115:16 + ┌─ uniswap.fe:116:16 │ -115 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (u256, u256, u256): Memory note: - ┌─ uniswap.fe:118:5 + ┌─ uniswap.fe:119:5 │ -118 │ ╭ pub fn initialize(self, ctx: Context, token0: address, token1: address): -119 │ │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" -120 │ │ self.token0 = token0 -121 │ │ self.token1 = token1 - │ ╰────────────────────────────^ attributes hash: 3314959592057453019 +119 │ ╭ pub fn initialize(self, ctx: Context, token0: address, token1: address): +120 │ │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +121 │ │ self.token0 = token0 +122 │ │ self.token1 = token1 + │ ╰────────────────────────────^ attributes hash: 10460756106041683522 │ = FunctionSignature { self_decl: Some( @@ -1449,6 +1481,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -1460,6 +1493,7 @@ note: ), }, FunctionParam { + label: None, name: "token0", typ: Ok( Base( @@ -1468,6 +1502,7 @@ note: ), }, FunctionParam { + label: None, name: "token1", typ: Ok( Base( @@ -1484,64 +1519,64 @@ note: } note: - ┌─ uniswap.fe:119:16 + ┌─ uniswap.fe:120:16 │ -119 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +120 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" │ ^^^ Context: Memory note: - ┌─ uniswap.fe:119:16 + ┌─ uniswap.fe:120:16 │ -119 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +120 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ address: Value note: - ┌─ uniswap.fe:119:36 + ┌─ uniswap.fe:120:36 │ -119 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +120 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^ address: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:119:16 + ┌─ uniswap.fe:120:16 │ -119 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +120 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ String<20>: Memory │ │ │ bool: Value -120 │ self.token0 = token0 +121 │ self.token0 = token0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:120:9 + ┌─ uniswap.fe:121:9 │ -120 │ self.token0 = token0 +121 │ self.token0 = token0 │ ^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ address: Storage { nonce: Some(5) } -121 │ self.token1 = token1 +122 │ self.token1 = token1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:121:9 + ┌─ uniswap.fe:122:9 │ -121 │ self.token1 = token1 +122 │ self.token1 = token1 │ ^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ address: Storage { nonce: Some(6) } note: - ┌─ uniswap.fe:124:5 + ┌─ uniswap.fe:125:5 │ -124 │ ╭ fn _update(self, ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256): -125 │ │ # changed from u32s -126 │ │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 -127 │ │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) +125 │ ╭ fn _update(self, ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256): +126 │ │ # changed from u32s +127 │ │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 +128 │ │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) · │ -136 │ │ self.block_timestamp_last = block_timestamp -137 │ │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) - │ ╰────────────────────────────────────────────────────────────────────────^ attributes hash: 17025925797500525970 +137 │ │ self.block_timestamp_last = block_timestamp +138 │ │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) + │ ╰────────────────────────────────────────────────────────────────────────^ attributes hash: 14441581101409065213 │ = FunctionSignature { self_decl: Some( @@ -1552,6 +1587,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -1563,6 +1599,7 @@ note: ), }, FunctionParam { + label: None, name: "balance0", typ: Ok( Base( @@ -1573,6 +1610,7 @@ note: ), }, FunctionParam { + label: None, name: "balance1", typ: Ok( Base( @@ -1583,6 +1621,7 @@ note: ), }, FunctionParam { + label: None, name: "reserve0", typ: Ok( Base( @@ -1593,6 +1632,7 @@ note: ), }, FunctionParam { + label: None, name: "reserve1", typ: Ok( Base( @@ -1611,230 +1651,230 @@ note: } note: - ┌─ uniswap.fe:126:30 + ┌─ uniswap.fe:127:30 │ -126 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 +127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 │ ^^^^ u256 -127 │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) -128 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired +128 │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) +129 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired │ ^^^^ u256 note: - ┌─ uniswap.fe:126:37 + ┌─ uniswap.fe:127:37 │ -126 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 +127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 │ ^^^ Context: Memory note: - ┌─ uniswap.fe:126:37 + ┌─ uniswap.fe:127:37 │ -126 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 +127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:126:61 + ┌─ uniswap.fe:127:61 │ -126 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 +127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 │ ^^^^^ u256: Value note: - ┌─ uniswap.fe:126:37 + ┌─ uniswap.fe:127:37 │ -126 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 +127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -127 │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) -128 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired +128 │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) +129 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired │ ^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:128:52 + ┌─ uniswap.fe:129:52 │ -128 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired +129 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(9) } => Value note: - ┌─ uniswap.fe:128:34 + ┌─ uniswap.fe:129:34 │ -128 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired +129 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -129 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:129:12 + ┌─ uniswap.fe:130:12 │ -129 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: │ ^^^^^^^^^^^^^^^^ ^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:129:33 + ┌─ uniswap.fe:130:33 │ -129 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: │ ^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:129:12 + ┌─ uniswap.fe:130:12 │ -129 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:129:51 + ┌─ uniswap.fe:130:51 │ -129 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: │ ^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:129:12 + ┌─ uniswap.fe:130:12 │ -129 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -130 │ # `*` never overflows, and + overflow is desired -131 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed +131 │ # `*` never overflows, and + overflow is desired +132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:131:13 + ┌─ uniswap.fe:132:13 │ -131 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed +132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(10) } note: - ┌─ uniswap.fe:131:43 + ┌─ uniswap.fe:132:43 │ -131 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed +132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Storage { nonce: Some(10) } => Value note: - ┌─ uniswap.fe:131:73 + ┌─ uniswap.fe:132:73 │ -131 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed +132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:131:73 + ┌─ uniswap.fe:132:73 │ -131 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed +132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:131:43 + ┌─ uniswap.fe:132:43 │ -131 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed +132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -132 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed +133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:132:13 + ┌─ uniswap.fe:133:13 │ -132 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed +133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(11) } note: - ┌─ uniswap.fe:132:43 + ┌─ uniswap.fe:133:43 │ -132 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed +133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Storage { nonce: Some(11) } => Value note: - ┌─ uniswap.fe:132:73 + ┌─ uniswap.fe:133:73 │ -132 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed +133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:132:73 + ┌─ uniswap.fe:133:73 │ -132 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed +133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:132:43 + ┌─ uniswap.fe:133:43 │ -132 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed +133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -133 │ -134 │ self.reserve0 = balance0 +134 │ +135 │ self.reserve0 = balance0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:134:9 + ┌─ uniswap.fe:135:9 │ -134 │ self.reserve0 = balance0 +135 │ self.reserve0 = balance0 │ ^^^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(7) } -135 │ self.reserve1 = balance1 +136 │ self.reserve1 = balance1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:135:9 + ┌─ uniswap.fe:136:9 │ -135 │ self.reserve1 = balance1 +136 │ self.reserve1 = balance1 │ ^^^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(8) } -136 │ self.block_timestamp_last = block_timestamp +137 │ self.block_timestamp_last = block_timestamp │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:136:9 + ┌─ uniswap.fe:137:9 │ -136 │ self.block_timestamp_last = block_timestamp +137 │ self.block_timestamp_last = block_timestamp │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(9) } -137 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +138 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:137:34 + ┌─ uniswap.fe:138:34 │ -137 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +138 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(7) } => Value note: - ┌─ uniswap.fe:137:59 + ┌─ uniswap.fe:138:59 │ -137 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +138 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:137:9 + ┌─ uniswap.fe:138:9 │ -137 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +138 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 11491202868117077488 │ = Event { @@ -1866,16 +1906,16 @@ note: } note: - ┌─ uniswap.fe:140:5 + ┌─ uniswap.fe:141:5 │ -140 │ ╭ fn _mint_fee(self, ctx: Context, reserve0: u256, reserve1: u256) -> bool: -141 │ │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() -142 │ │ let fee_on: bool = fee_to != address(0) -143 │ │ let k_last: u256 = self.k_last # gas savings +141 │ ╭ fn _mint_fee(self, ctx: Context, reserve0: u256, reserve1: u256) -> bool: +142 │ │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +143 │ │ let fee_on: bool = fee_to != address(0) +144 │ │ let k_last: u256 = self.k_last # gas savings · │ -156 │ │ -157 │ │ return fee_on - │ ╰─────────────────────^ attributes hash: 6168697520626235838 +157 │ │ +158 │ │ return fee_on + │ ╰─────────────────────^ attributes hash: 12335666382859496931 │ = FunctionSignature { self_decl: Some( @@ -1886,6 +1926,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -1897,6 +1938,7 @@ note: ), }, FunctionParam { + label: None, name: "reserve0", typ: Ok( Base( @@ -1907,6 +1949,7 @@ note: ), }, FunctionParam { + label: None, name: "reserve1", typ: Ok( Base( @@ -1925,231 +1968,231 @@ note: } note: - ┌─ uniswap.fe:141:21 + ┌─ uniswap.fe:142:21 │ -141 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^^^^^ address -142 │ let fee_on: bool = fee_to != address(0) +143 │ let fee_on: bool = fee_to != address(0) │ ^^^^ bool -143 │ let k_last: u256 = self.k_last # gas savings +144 │ let k_last: u256 = self.k_last # gas savings │ ^^^^ u256 · -146 │ let root_k: u256 = sqrt(reserve0 * reserve1) +147 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^ u256 -147 │ let root_k_last: u256 = sqrt(k_last) +148 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^ u256 -148 │ if root_k > root_k_last: -149 │ let numerator: u256 = self.total_supply * root_k - root_k_last +149 │ if root_k > root_k_last: +150 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^ u256 -150 │ let denominator: u256 = root_k * 5 + root_k_last +151 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^ u256 -151 │ let liquidity: u256 = numerator / denominator +152 │ let liquidity: u256 = numerator / denominator │ ^^^^ u256 note: - ┌─ uniswap.fe:141:48 + ┌─ uniswap.fe:142:48 │ -141 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:141:53 + ┌─ uniswap.fe:142:53 │ -141 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^^^^^^^^^^ address: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:141:31 + ┌─ uniswap.fe:142:31 │ -141 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:141:31 + ┌─ uniswap.fe:142:31 │ -141 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address: Value -142 │ let fee_on: bool = fee_to != address(0) +143 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^ ^ u256: Value │ │ │ address: Value note: - ┌─ uniswap.fe:142:38 + ┌─ uniswap.fe:143:38 │ -142 │ let fee_on: bool = fee_to != address(0) +143 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:142:28 + ┌─ uniswap.fe:143:28 │ -142 │ let fee_on: bool = fee_to != address(0) +143 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -143 │ let k_last: u256 = self.k_last # gas savings +144 │ let k_last: u256 = self.k_last # gas savings │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:143:28 + ┌─ uniswap.fe:144:28 │ -143 │ let k_last: u256 = self.k_last # gas savings +144 │ let k_last: u256 = self.k_last # gas savings │ ^^^^^^^^^^^ u256: Storage { nonce: Some(12) } => Value -144 │ if fee_on: +145 │ if fee_on: │ ^^^^^^ bool: Value -145 │ if k_last != 0: +146 │ if k_last != 0: │ ^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:145:16 + ┌─ uniswap.fe:146:16 │ -145 │ if k_last != 0: +146 │ if k_last != 0: │ ^^^^^^^^^^^ bool: Value -146 │ let root_k: u256 = sqrt(reserve0 * reserve1) +147 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:146:41 + ┌─ uniswap.fe:147:41 │ -146 │ let root_k: u256 = sqrt(reserve0 * reserve1) +147 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:146:36 + ┌─ uniswap.fe:147:36 │ -146 │ let root_k: u256 = sqrt(reserve0 * reserve1) +147 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -147 │ let root_k_last: u256 = sqrt(k_last) +148 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^^^ u256: Value note: - ┌─ uniswap.fe:147:41 + ┌─ uniswap.fe:148:41 │ -147 │ let root_k_last: u256 = sqrt(k_last) +148 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^^^^^^^^^ u256: Value -148 │ if root_k > root_k_last: +149 │ if root_k > root_k_last: │ ^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:148:20 + ┌─ uniswap.fe:149:20 │ -148 │ if root_k > root_k_last: +149 │ if root_k > root_k_last: │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -149 │ let numerator: u256 = self.total_supply * root_k - root_k_last +150 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:149:43 + ┌─ uniswap.fe:150:43 │ -149 │ let numerator: u256 = self.total_supply * root_k - root_k_last +150 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^ ^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(2) } => Value note: - ┌─ uniswap.fe:149:43 + ┌─ uniswap.fe:150:43 │ -149 │ let numerator: u256 = self.total_supply * root_k - root_k_last +150 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:149:43 + ┌─ uniswap.fe:150:43 │ -149 │ let numerator: u256 = self.total_supply * root_k - root_k_last +150 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -150 │ let denominator: u256 = root_k * 5 + root_k_last +151 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:150:45 + ┌─ uniswap.fe:151:45 │ -150 │ let denominator: u256 = root_k * 5 + root_k_last +151 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:150:45 + ┌─ uniswap.fe:151:45 │ -150 │ let denominator: u256 = root_k * 5 + root_k_last +151 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -151 │ let liquidity: u256 = numerator / denominator +152 │ let liquidity: u256 = numerator / denominator │ ^^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:151:43 + ┌─ uniswap.fe:152:43 │ -151 │ let liquidity: u256 = numerator / denominator +152 │ let liquidity: u256 = numerator / denominator │ ^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -152 │ if liquidity > 0: +153 │ if liquidity > 0: │ ^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:152:24 + ┌─ uniswap.fe:153:24 │ -152 │ if liquidity > 0: +153 │ if liquidity > 0: │ ^^^^^^^^^^^^^ bool: Value -153 │ self._mint(ctx, fee_to, liquidity) - │ ^^^^ ^^^ ^^^^^^ ^^^^^^^^^ u256: Value - │ │ │ │ - │ │ │ address: Value +154 │ self._mint(ctx, to: fee_to, value: liquidity) + │ ^^^^ ^^^ ^^^^^^ ^^^^^^^^^ u256: Value + │ │ │ │ + │ │ │ address: Value │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:153:25 + ┌─ uniswap.fe:154:25 │ -153 │ self._mint(ctx, fee_to, liquidity) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -154 │ elif k_last != 0: +154 │ self._mint(ctx, to: fee_to, value: liquidity) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +155 │ elif k_last != 0: │ ^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:154:14 + ┌─ uniswap.fe:155:14 │ -154 │ elif k_last != 0: +155 │ elif k_last != 0: │ ^^^^^^^^^^^ bool: Value -155 │ self.k_last = 0 +156 │ self.k_last = 0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:155:13 + ┌─ uniswap.fe:156:13 │ -155 │ self.k_last = 0 +156 │ self.k_last = 0 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(12) } -156 │ -157 │ return fee_on +157 │ +158 │ return fee_on │ ^^^^^^ bool: Value note: - ┌─ uniswap.fe:160:5 + ┌─ uniswap.fe:161:5 │ -160 │ ╭ pub fn mint(self, ctx: Context, to: address) -> u256: -161 │ │ let MINIMUM_LIQUIDITY: u256 = 1000 -162 │ │ let reserve0: u256 = self.reserve0 -163 │ │ let reserve1: u256 = self.reserve1 +161 │ ╭ pub fn mint(self, ctx: Context, to: address) -> u256: +162 │ │ let MINIMUM_LIQUIDITY: u256 = 1000 +163 │ │ let reserve0: u256 = self.reserve0 +164 │ │ let reserve1: u256 = self.reserve1 · │ -186 │ │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) -187 │ │ return liquidity - │ ╰────────────────────────^ attributes hash: 8211528275496689590 +187 │ │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) +188 │ │ return liquidity + │ ╰────────────────────────^ attributes hash: 11513995717553818344 │ = FunctionSignature { self_decl: Some( @@ -2160,6 +2203,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -2171,6 +2215,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -2189,145 +2234,145 @@ note: } note: - ┌─ uniswap.fe:161:32 + ┌─ uniswap.fe:162:32 │ -161 │ let MINIMUM_LIQUIDITY: u256 = 1000 +162 │ let MINIMUM_LIQUIDITY: u256 = 1000 │ ^^^^ u256 -162 │ let reserve0: u256 = self.reserve0 +163 │ let reserve0: u256 = self.reserve0 │ ^^^^ u256 -163 │ let reserve1: u256 = self.reserve1 +164 │ let reserve1: u256 = self.reserve1 │ ^^^^ u256 -164 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^ u256 -165 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^ u256 -166 │ let amount0: u256 = balance0 - self.reserve0 +167 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^ u256 -167 │ let amount1: u256 = balance1 - self.reserve1 +168 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^ u256 -168 │ -169 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +169 │ +170 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ bool -170 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee +171 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee │ ^^^^ u256 -171 │ let liquidity: u256 = 0 +172 │ let liquidity: u256 = 0 │ ^^^^ u256 note: - ┌─ uniswap.fe:161:39 + ┌─ uniswap.fe:162:39 │ -161 │ let MINIMUM_LIQUIDITY: u256 = 1000 +162 │ let MINIMUM_LIQUIDITY: u256 = 1000 │ ^^^^ u256: Value -162 │ let reserve0: u256 = self.reserve0 +163 │ let reserve0: u256 = self.reserve0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:162:30 + ┌─ uniswap.fe:163:30 │ -162 │ let reserve0: u256 = self.reserve0 +163 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value -163 │ let reserve1: u256 = self.reserve1 +164 │ let reserve1: u256 = self.reserve1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:163:30 + ┌─ uniswap.fe:164:30 │ -163 │ let reserve1: u256 = self.reserve1 +164 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value -164 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:164:41 + ┌─ uniswap.fe:165:41 │ -164 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:164:30 + ┌─ uniswap.fe:165:30 │ -164 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:164:64 + ┌─ uniswap.fe:165:64 │ -164 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:164:30 + ┌─ uniswap.fe:165:30 │ -164 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -165 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:165:41 + ┌─ uniswap.fe:166:41 │ -165 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:165:30 + ┌─ uniswap.fe:166:30 │ -165 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:165:64 + ┌─ uniswap.fe:166:64 │ -165 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:165:30 + ┌─ uniswap.fe:166:30 │ -165 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -166 │ let amount0: u256 = balance0 - self.reserve0 +167 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:166:40 + ┌─ uniswap.fe:167:40 │ -166 │ let amount0: u256 = balance0 - self.reserve0 +167 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value note: - ┌─ uniswap.fe:166:29 + ┌─ uniswap.fe:167:29 │ -166 │ let amount0: u256 = balance0 - self.reserve0 +167 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -167 │ let amount1: u256 = balance1 - self.reserve1 +168 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:167:40 + ┌─ uniswap.fe:168:40 │ -167 │ let amount1: u256 = balance1 - self.reserve1 +168 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:167:29 + ┌─ uniswap.fe:168:29 │ -167 │ let amount1: u256 = balance1 - self.reserve1 +168 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -168 │ -169 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +169 │ +170 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ u256: Value @@ -2335,144 +2380,144 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:169:28 + ┌─ uniswap.fe:170:28 │ -169 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +170 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -170 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee +171 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:170:34 + ┌─ uniswap.fe:171:34 │ -170 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee +171 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } => Value -171 │ let liquidity: u256 = 0 +172 │ let liquidity: u256 = 0 │ ^ u256: Value -172 │ if total_supply == 0: +173 │ if total_supply == 0: │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:172:12 + ┌─ uniswap.fe:173:12 │ -172 │ if total_supply == 0: +173 │ if total_supply == 0: │ ^^^^^^^^^^^^^^^^^ bool: Value -173 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +174 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^ ^^^^^^^ ^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:173:30 + ┌─ uniswap.fe:174:30 │ -173 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +174 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:173:25 + ┌─ uniswap.fe:174:25 │ -173 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +174 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:173:25 + ┌─ uniswap.fe:174:25 │ -173 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +174 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -174 │ self._mint(ctx, address(0), MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens - │ ^^^^ ^^^ ^ u256: Value - │ │ │ +175 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens + │ ^^^^ ^^^ ^ u256: Value + │ │ │ │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:174:29 + ┌─ uniswap.fe:175:33 │ -174 │ self._mint(ctx, address(0), MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens - │ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256: Value - │ │ - │ address: Value +175 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens + │ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256: Value + │ │ + │ address: Value note: - ┌─ uniswap.fe:174:13 + ┌─ uniswap.fe:175:13 │ -174 │ self._mint(ctx, address(0), MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -175 │ else: -176 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) +175 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +176 │ else: +177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) │ ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:176:29 + ┌─ uniswap.fe:177:29 │ -176 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) +177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:176:29 + ┌─ uniswap.fe:177:29 │ -176 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) +177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:176:66 + ┌─ uniswap.fe:177:66 │ -176 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) +177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:176:66 + ┌─ uniswap.fe:177:66 │ -176 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) +177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:176:25 + ┌─ uniswap.fe:177:25 │ -176 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) +177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -177 │ -178 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" +178 │ +179 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" │ ^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:178:16 + ┌─ uniswap.fe:179:16 │ -178 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" +179 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" │ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<40>: Memory │ │ │ bool: Value -179 │ -180 │ self._mint(ctx, to, liquidity) - │ ^^^^ ^^^ ^^ ^^^^^^^^^ u256: Value - │ │ │ │ +180 │ +181 │ self._mint(ctx, to, value: liquidity) + │ ^^^^ ^^^ ^^ ^^^^^^^^^ u256: Value + │ │ │ │ │ │ │ address: Value │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:180:9 + ┌─ uniswap.fe:181:9 │ -180 │ self._mint(ctx, to, liquidity) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -181 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +181 │ self._mint(ctx, to, value: liquidity) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +182 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ │ │ │ │ u256: Value @@ -2482,51 +2527,51 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:181:9 + ┌─ uniswap.fe:182:9 │ -181 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +182 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -182 │ -183 │ if fee_on: +183 │ +184 │ if fee_on: │ ^^^^^^ bool: Value -184 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +185 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:184:13 + ┌─ uniswap.fe:185:13 │ -184 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +185 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Storage { nonce: Some(12) } note: - ┌─ uniswap.fe:184:27 + ┌─ uniswap.fe:185:27 │ -184 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +185 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^^^^^^^^^^^^^^^^ u256: Value -185 │ -186 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) +186 │ +187 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) │ ^^^ ^^^ Context: Memory │ │ │ Context: Memory note: - ┌─ uniswap.fe:186:32 + ┌─ uniswap.fe:187:32 │ -186 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) +187 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ address: Value -187 │ return liquidity +188 │ return liquidity │ ^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:186:9 + ┌─ uniswap.fe:187:9 │ -186 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) +187 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 4243961805717991435 │ = Event { @@ -2567,16 +2612,16 @@ note: } note: - ┌─ uniswap.fe:190:5 + ┌─ uniswap.fe:191:5 │ -190 │ ╭ pub fn burn(self, ctx: Context, to: address) -> (u256, u256): -191 │ │ let reserve0: u256 = self.reserve0 -192 │ │ let reserve1: u256 = self.reserve1 -193 │ │ let token0: ERC20 = ERC20(ctx, self.token0) +191 │ ╭ pub fn burn(self, ctx: Context, to: address) -> (u256, u256): +192 │ │ let reserve0: u256 = self.reserve0 +193 │ │ let reserve1: u256 = self.reserve1 +194 │ │ let token0: ERC20 = ERC20(ctx, self.token0) · │ -215 │ │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) -216 │ │ return (amount0, amount1) - │ ╰─────────────────────────────────^ attributes hash: 6846356871376567296 +216 │ │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) +217 │ │ return (amount0, amount1) + │ ╰─────────────────────────────────^ attributes hash: 4652297158603848356 │ = FunctionSignature { self_decl: Some( @@ -2587,6 +2632,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -2598,6 +2644,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -2627,139 +2674,139 @@ note: } note: - ┌─ uniswap.fe:191:23 + ┌─ uniswap.fe:192:23 │ -191 │ let reserve0: u256 = self.reserve0 +192 │ let reserve0: u256 = self.reserve0 │ ^^^^ u256 -192 │ let reserve1: u256 = self.reserve1 +193 │ let reserve1: u256 = self.reserve1 │ ^^^^ u256 -193 │ let token0: ERC20 = ERC20(ctx, self.token0) +194 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^ ERC20 -194 │ let token1: ERC20 = ERC20(ctx, self.token1) +195 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^ ERC20 -195 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +196 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^ u256 -196 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +197 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^ u256 -197 │ let liquidity: u256 = self.balances[ctx.self_address()] +198 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^ u256 -198 │ -199 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +199 │ +200 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ bool -200 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee +201 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee │ ^^^^ u256 -201 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution +202 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution │ ^^^^ u256 -202 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution +203 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution │ ^^^^ u256 note: - ┌─ uniswap.fe:191:30 + ┌─ uniswap.fe:192:30 │ -191 │ let reserve0: u256 = self.reserve0 +192 │ let reserve0: u256 = self.reserve0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:191:30 + ┌─ uniswap.fe:192:30 │ -191 │ let reserve0: u256 = self.reserve0 +192 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value -192 │ let reserve1: u256 = self.reserve1 +193 │ let reserve1: u256 = self.reserve1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:192:30 + ┌─ uniswap.fe:193:30 │ -192 │ let reserve1: u256 = self.reserve1 +193 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value -193 │ let token0: ERC20 = ERC20(ctx, self.token0) +194 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:193:40 + ┌─ uniswap.fe:194:40 │ -193 │ let token0: ERC20 = ERC20(ctx, self.token0) +194 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:193:29 + ┌─ uniswap.fe:194:29 │ -193 │ let token0: ERC20 = ERC20(ctx, self.token0) +194 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -194 │ let token1: ERC20 = ERC20(ctx, self.token1) +195 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:194:40 + ┌─ uniswap.fe:195:40 │ -194 │ let token1: ERC20 = ERC20(ctx, self.token1) +195 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:194:29 + ┌─ uniswap.fe:195:29 │ -194 │ let token1: ERC20 = ERC20(ctx, self.token1) +195 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -195 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +196 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:195:47 + ┌─ uniswap.fe:196:47 │ -195 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +196 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:195:30 + ┌─ uniswap.fe:196:30 │ -195 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +196 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -196 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +197 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:196:47 + ┌─ uniswap.fe:197:47 │ -196 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +197 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:196:30 + ┌─ uniswap.fe:197:30 │ -196 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +197 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -197 │ let liquidity: u256 = self.balances[ctx.self_address()] +198 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:197:31 + ┌─ uniswap.fe:198:31 │ -197 │ let liquidity: u256 = self.balances[ctx.self_address()] +198 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:197:45 + ┌─ uniswap.fe:198:45 │ -197 │ let liquidity: u256 = self.balances[ctx.self_address()] +198 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:197:31 + ┌─ uniswap.fe:198:31 │ -197 │ let liquidity: u256 = self.balances[ctx.self_address()] +198 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value -198 │ -199 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +199 │ +200 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ u256: Value @@ -2767,158 +2814,158 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:199:28 + ┌─ uniswap.fe:200:28 │ -199 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +200 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -200 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee +201 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:200:34 + ┌─ uniswap.fe:201:34 │ -200 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee +201 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } => Value -201 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution +202 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:201:29 + ┌─ uniswap.fe:202:29 │ -201 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution +202 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:201:29 + ┌─ uniswap.fe:202:29 │ -201 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution +202 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -202 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution +203 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:202:29 + ┌─ uniswap.fe:203:29 │ -202 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution +203 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:202:29 + ┌─ uniswap.fe:203:29 │ -202 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution +203 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -203 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +204 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:203:16 + ┌─ uniswap.fe:204:16 │ -203 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +204 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^ ^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:203:32 + ┌─ uniswap.fe:204:32 │ -203 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +204 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:203:16 + ┌─ uniswap.fe:204:16 │ -203 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +204 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<40>: Memory │ │ │ bool: Value -204 │ self._burn(ctx, ctx.self_address(), liquidity) - │ ^^^^ ^^^ ^^^ Context: Memory - │ │ │ +205 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) + │ ^^^^ ^^^ ^^^ Context: Memory + │ │ │ │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:204:25 + ┌─ uniswap.fe:205:31 │ -204 │ self._burn(ctx, ctx.self_address(), liquidity) - │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ u256: Value - │ │ - │ address: Value +205 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) + │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ u256: Value + │ │ + │ address: Value note: - ┌─ uniswap.fe:204:9 + ┌─ uniswap.fe:205:9 │ -204 │ self._burn(ctx, ctx.self_address(), liquidity) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -205 │ token0.transfer(to, amount0) +205 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +206 │ token0.transfer(to, amount0) │ ^^^^^^ ^^ ^^^^^^^ u256: Value │ │ │ │ │ address: Value │ ERC20: Value note: - ┌─ uniswap.fe:205:9 + ┌─ uniswap.fe:206:9 │ -205 │ token0.transfer(to, amount0) +206 │ token0.transfer(to, amount0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -206 │ token1.transfer(to, amount1) +207 │ token1.transfer(to, amount1) │ ^^^^^^ ^^ ^^^^^^^ u256: Value │ │ │ │ │ address: Value │ ERC20: Value note: - ┌─ uniswap.fe:206:9 + ┌─ uniswap.fe:207:9 │ -206 │ token1.transfer(to, amount1) +207 │ token1.transfer(to, amount1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -207 │ balance0 = token0.balanceOf(ctx.self_address()) +208 │ balance0 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ ERC20: Value │ u256: Value note: - ┌─ uniswap.fe:207:37 + ┌─ uniswap.fe:208:37 │ -207 │ balance0 = token0.balanceOf(ctx.self_address()) +208 │ balance0 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:207:20 + ┌─ uniswap.fe:208:20 │ -207 │ balance0 = token0.balanceOf(ctx.self_address()) +208 │ balance0 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -208 │ balance1 = token1.balanceOf(ctx.self_address()) +209 │ balance1 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ ERC20: Value │ u256: Value note: - ┌─ uniswap.fe:208:37 + ┌─ uniswap.fe:209:37 │ -208 │ balance1 = token1.balanceOf(ctx.self_address()) +209 │ balance1 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:208:20 + ┌─ uniswap.fe:209:20 │ -208 │ balance1 = token1.balanceOf(ctx.self_address()) +209 │ balance1 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -209 │ -210 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +210 │ +211 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ │ │ │ │ u256: Value @@ -2928,60 +2975,60 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:210:9 + ┌─ uniswap.fe:211:9 │ -210 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +211 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -211 │ -212 │ if fee_on: +212 │ +213 │ if fee_on: │ ^^^^^^ bool: Value -213 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +214 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:213:13 + ┌─ uniswap.fe:214:13 │ -213 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +214 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Storage { nonce: Some(12) } note: - ┌─ uniswap.fe:213:27 + ┌─ uniswap.fe:214:27 │ -213 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +214 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^^^^^^^^^^^^^^^^ u256: Value -214 │ -215 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) +215 │ +216 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) │ ^^^ ^^^ Context: Memory │ │ │ Context: Memory note: - ┌─ uniswap.fe:215:32 + ┌─ uniswap.fe:216:32 │ -215 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) +216 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^ ^^ address: Value │ │ │ │ │ │ │ u256: Value │ │ u256: Value │ address: Value -216 │ return (amount0, amount1) +217 │ return (amount0, amount1) │ ^^^^^^^ ^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:216:16 + ┌─ uniswap.fe:217:16 │ -216 │ return (amount0, amount1) +217 │ return (amount0, amount1) │ ^^^^^^^^^^^^^^^^^^ (u256, u256): Memory note: - ┌─ uniswap.fe:215:9 + ┌─ uniswap.fe:216:9 │ -215 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) +216 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 10738919684795162003 │ = Event { @@ -3031,16 +3078,16 @@ note: } note: - ┌─ uniswap.fe:221:5 + ┌─ uniswap.fe:222:5 │ -221 │ ╭ pub fn swap(self, ctx: Context, amount0_out: u256, amount1_out: u256, to: address): -222 │ │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" -223 │ │ let reserve0: u256 = self.reserve0 -224 │ │ let reserve1: u256 = self.reserve1 +222 │ ╭ pub fn swap(self, ctx: Context, amount0_out: u256, amount1_out: u256, to: address): +223 │ │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +224 │ │ let reserve0: u256 = self.reserve0 +225 │ │ let reserve1: u256 = self.reserve1 · │ -254 │ │ self._update(ctx, balance0, balance1, reserve0, reserve1) -255 │ │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) - │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 8119592611084218706 +255 │ │ self._update(ctx, balance0, balance1, reserve0, reserve1) +256 │ │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) + │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 18411078236281700131 │ = FunctionSignature { self_decl: Some( @@ -3051,6 +3098,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -3062,6 +3110,7 @@ note: ), }, FunctionParam { + label: None, name: "amount0_out", typ: Ok( Base( @@ -3072,6 +3121,7 @@ note: ), }, FunctionParam { + label: None, name: "amount1_out", typ: Ok( Base( @@ -3082,6 +3132,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -3098,467 +3149,467 @@ note: } note: - ┌─ uniswap.fe:223:23 + ┌─ uniswap.fe:224:23 │ -223 │ let reserve0: u256 = self.reserve0 +224 │ let reserve0: u256 = self.reserve0 │ ^^^^ u256 -224 │ let reserve1: u256 = self.reserve1 +225 │ let reserve1: u256 = self.reserve1 │ ^^^^ u256 · -227 │ let token0: ERC20 = ERC20(ctx, self.token0) +228 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^ ERC20 -228 │ let token1: ERC20 = ERC20(ctx, self.token1) +229 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^ ERC20 · -241 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +242 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^ u256 -242 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +243 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^ u256 -243 │ -244 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +244 │ +245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^ u256 -245 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^ u256 · -249 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^ u256 -250 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^ u256 note: - ┌─ uniswap.fe:222:16 + ┌─ uniswap.fe:223:16 │ -222 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +223 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:222:16 + ┌─ uniswap.fe:223:16 │ -222 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +223 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:222:35 + ┌─ uniswap.fe:223:35 │ -222 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +223 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:222:16 + ┌─ uniswap.fe:223:16 │ -222 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +223 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<37>: Memory │ │ │ bool: Value -223 │ let reserve0: u256 = self.reserve0 +224 │ let reserve0: u256 = self.reserve0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:223:30 + ┌─ uniswap.fe:224:30 │ -223 │ let reserve0: u256 = self.reserve0 +224 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value -224 │ let reserve1: u256 = self.reserve1 +225 │ let reserve1: u256 = self.reserve1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:224:30 + ┌─ uniswap.fe:225:30 │ -224 │ let reserve1: u256 = self.reserve1 +225 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value -225 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +226 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:225:16 + ┌─ uniswap.fe:226:16 │ -225 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +226 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:225:43 + ┌─ uniswap.fe:226:43 │ -225 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +226 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:225:16 + ┌─ uniswap.fe:226:16 │ -225 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +226 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<33>: Memory │ │ │ bool: Value -226 │ -227 │ let token0: ERC20 = ERC20(ctx, self.token0) +227 │ +228 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:227:40 + ┌─ uniswap.fe:228:40 │ -227 │ let token0: ERC20 = ERC20(ctx, self.token0) +228 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:227:29 + ┌─ uniswap.fe:228:29 │ -227 │ let token0: ERC20 = ERC20(ctx, self.token0) +228 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -228 │ let token1: ERC20 = ERC20(ctx, self.token1) +229 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:228:40 + ┌─ uniswap.fe:229:40 │ -228 │ let token1: ERC20 = ERC20(ctx, self.token1) +229 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:228:29 + ┌─ uniswap.fe:229:29 │ -228 │ let token1: ERC20 = ERC20(ctx, self.token1) +229 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value · -231 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^ ^^^^^^ ERC20: Value │ │ │ address: Value note: - ┌─ uniswap.fe:231:22 + ┌─ uniswap.fe:232:22 │ -231 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:231:16 + ┌─ uniswap.fe:232:16 │ -231 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^ ERC20: Value │ │ │ │ │ address: Value │ bool: Value note: - ┌─ uniswap.fe:231:48 + ┌─ uniswap.fe:232:48 │ -231 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:231:42 + ┌─ uniswap.fe:232:42 │ -231 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:231:16 + ┌─ uniswap.fe:232:16 │ -231 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ String<21>: Memory │ │ │ bool: Value -232 │ -233 │ if amount0_out > 0: +233 │ +234 │ if amount0_out > 0: │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:233:12 + ┌─ uniswap.fe:234:12 │ -233 │ if amount0_out > 0: +234 │ if amount0_out > 0: │ ^^^^^^^^^^^^^^^ bool: Value -234 │ token0.transfer(to, amount0_out) # optimistically transfer tokens +235 │ token0.transfer(to, amount0_out) # optimistically transfer tokens │ ^^^^^^ ^^ ^^^^^^^^^^^ u256: Value │ │ │ │ │ address: Value │ ERC20: Value note: - ┌─ uniswap.fe:234:13 + ┌─ uniswap.fe:235:13 │ -234 │ token0.transfer(to, amount0_out) # optimistically transfer tokens +235 │ token0.transfer(to, amount0_out) # optimistically transfer tokens │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -235 │ if amount1_out > 0: +236 │ if amount1_out > 0: │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:235:12 + ┌─ uniswap.fe:236:12 │ -235 │ if amount1_out > 0: +236 │ if amount1_out > 0: │ ^^^^^^^^^^^^^^^ bool: Value -236 │ token1.transfer(to, amount1_out) # optimistically transfer tokens +237 │ token1.transfer(to, amount1_out) # optimistically transfer tokens │ ^^^^^^ ^^ ^^^^^^^^^^^ u256: Value │ │ │ │ │ address: Value │ ERC20: Value note: - ┌─ uniswap.fe:236:13 + ┌─ uniswap.fe:237:13 │ -236 │ token1.transfer(to, amount1_out) # optimistically transfer tokens +237 │ token1.transfer(to, amount1_out) # optimistically transfer tokens │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value · -241 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +242 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:241:47 + ┌─ uniswap.fe:242:47 │ -241 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +242 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:241:30 + ┌─ uniswap.fe:242:30 │ -241 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +242 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -242 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +243 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:242:47 + ┌─ uniswap.fe:243:47 │ -242 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +243 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:242:30 + ┌─ uniswap.fe:243:30 │ -242 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +243 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -243 │ -244 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +244 │ +245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:244:82 + ┌─ uniswap.fe:245:82 │ -244 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:244:32 + ┌─ uniswap.fe:245:32 │ -244 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:244:44 + ┌─ uniswap.fe:245:44 │ -244 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:244:43 + ┌─ uniswap.fe:245:43 │ -244 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:244:32 + ┌─ uniswap.fe:245:32 │ -244 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:244:32 + ┌─ uniswap.fe:245:32 │ -244 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -245 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:245:82 + ┌─ uniswap.fe:246:82 │ -245 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:245:32 + ┌─ uniswap.fe:246:32 │ -245 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:245:44 + ┌─ uniswap.fe:246:44 │ -245 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:245:43 + ┌─ uniswap.fe:246:43 │ -245 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:245:32 + ┌─ uniswap.fe:246:32 │ -245 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:245:32 + ┌─ uniswap.fe:246:32 │ -245 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -246 │ -247 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +247 │ +248 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:247:16 + ┌─ uniswap.fe:248:16 │ -247 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +248 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:247:34 + ┌─ uniswap.fe:248:34 │ -247 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +248 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:247:16 + ┌─ uniswap.fe:248:16 │ -247 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +248 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<36>: Memory │ │ │ bool: Value -248 │ -249 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +249 │ +250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:249:39 + ┌─ uniswap.fe:250:39 │ -249 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:249:57 + ┌─ uniswap.fe:250:57 │ -249 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:249:39 + ┌─ uniswap.fe:250:39 │ -249 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -250 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:250:39 + ┌─ uniswap.fe:251:39 │ -250 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:250:57 + ┌─ uniswap.fe:251:57 │ -250 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:250:39 + ┌─ uniswap.fe:251:39 │ -250 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -251 │ -252 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +252 │ +253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:252:16 + ┌─ uniswap.fe:253:16 │ -252 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:252:57 + ┌─ uniswap.fe:253:57 │ -252 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:252:57 + ┌─ uniswap.fe:253:57 │ -252 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:252:16 + ┌─ uniswap.fe:253:16 │ -252 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ String<12>: Memory │ │ │ bool: Value -253 │ -254 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +254 │ +255 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ │ │ │ │ u256: Value @@ -3568,19 +3619,19 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:254:9 + ┌─ uniswap.fe:255:9 │ -254 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +255 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -255 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +256 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) │ ^^^ ^^^ Context: Memory │ │ │ Context: Memory note: - ┌─ uniswap.fe:255:32 + ┌─ uniswap.fe:256:32 │ -255 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +256 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^ ^^ address: Value │ │ │ │ │ │ │ │ │ │ │ u256: Value @@ -3590,9 +3641,9 @@ note: │ address: Value note: - ┌─ uniswap.fe:255:9 + ┌─ uniswap.fe:256:9 │ -255 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +256 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 16055667627771619025 │ = Event { @@ -3664,15 +3715,15 @@ note: } note: - ┌─ uniswap.fe:258:5 + ┌─ uniswap.fe:259:5 │ -258 │ ╭ pub fn skim(self, ctx: Context, to: address): -259 │ │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings -260 │ │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings -261 │ │ -262 │ │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) -263 │ │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) - │ ╰─────────────────────────────────────────────────────────────────────────────────^ attributes hash: 15257920618683114493 +259 │ ╭ pub fn skim(self, ctx: Context, to: address): +260 │ │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +261 │ │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +262 │ │ +263 │ │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +264 │ │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) + │ ╰─────────────────────────────────────────────────────────────────────────────────^ attributes hash: 9469713119497359790 │ = FunctionSignature { self_decl: Some( @@ -3683,6 +3734,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -3694,6 +3746,7 @@ note: ), }, FunctionParam { + label: None, name: "to", typ: Ok( Base( @@ -3710,50 +3763,50 @@ note: } note: - ┌─ uniswap.fe:259:21 + ┌─ uniswap.fe:260:21 │ -259 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +260 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings │ ^^^^^ ERC20 -260 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +261 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings │ ^^^^^ ERC20 note: - ┌─ uniswap.fe:259:35 + ┌─ uniswap.fe:260:35 │ -259 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +260 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:259:40 + ┌─ uniswap.fe:260:40 │ -259 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +260 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:259:29 + ┌─ uniswap.fe:260:29 │ -259 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +260 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -260 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +261 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:260:40 + ┌─ uniswap.fe:261:40 │ -260 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +261 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:260:29 + ┌─ uniswap.fe:261:29 │ -260 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +261 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -261 │ -262 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +262 │ +263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^ ^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ │ │ ERC20: Value @@ -3761,37 +3814,37 @@ note: │ ERC20: Value note: - ┌─ uniswap.fe:262:46 + ┌─ uniswap.fe:263:46 │ -262 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:262:29 + ┌─ uniswap.fe:263:29 │ -262 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:262:68 + ┌─ uniswap.fe:263:68 │ -262 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value note: - ┌─ uniswap.fe:262:29 + ┌─ uniswap.fe:263:29 │ -262 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:262:9 + ┌─ uniswap.fe:263:9 │ -262 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -263 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^ ^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ │ │ ERC20: Value @@ -3799,45 +3852,48 @@ note: │ ERC20: Value note: - ┌─ uniswap.fe:263:46 + ┌─ uniswap.fe:264:46 │ -263 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:263:29 + ┌─ uniswap.fe:264:29 │ -263 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:263:68 + ┌─ uniswap.fe:264:68 │ -263 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:263:29 + ┌─ uniswap.fe:264:29 │ -263 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:263:9 + ┌─ uniswap.fe:264:9 │ -263 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:266:5 + ┌─ uniswap.fe:267:5 │ -266 │ ╭ pub fn sync(self, ctx: Context): -267 │ │ let token0: ERC20 = ERC20(ctx, self.token0) -268 │ │ let token1: ERC20 = ERC20(ctx, self.token1) -269 │ │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 5828909688388067108 +267 │ ╭ pub fn sync(self, ctx: Context): +268 │ │ let token0: ERC20 = ERC20(ctx, self.token0) +269 │ │ let token1: ERC20 = ERC20(ctx, self.token1) +270 │ │ self._update(ctx, + · │ +273 │ │ reserve0: self.reserve0, +274 │ │ reserve1: self.reserve1) + │ ╰─────────────────────────────────────────────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -3848,6 +3904,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -3867,339 +3924,144 @@ note: } note: - ┌─ uniswap.fe:267:21 + ┌─ uniswap.fe:268:21 │ -267 │ let token0: ERC20 = ERC20(ctx, self.token0) +268 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^ ERC20 -268 │ let token1: ERC20 = ERC20(ctx, self.token1) +269 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^ ERC20 note: - ┌─ uniswap.fe:267:35 + ┌─ uniswap.fe:268:35 │ -267 │ let token0: ERC20 = ERC20(ctx, self.token0) +268 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:267:40 + ┌─ uniswap.fe:268:40 │ -267 │ let token0: ERC20 = ERC20(ctx, self.token0) +268 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:267:29 + ┌─ uniswap.fe:268:29 │ -267 │ let token0: ERC20 = ERC20(ctx, self.token0) +268 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -268 │ let token1: ERC20 = ERC20(ctx, self.token1) +269 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:268:40 + ┌─ uniswap.fe:269:40 │ -268 │ let token1: ERC20 = ERC20(ctx, self.token1) +269 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:268:29 + ┌─ uniswap.fe:269:29 │ -268 │ let token1: ERC20 = ERC20(ctx, self.token1) +269 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -269 │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ^^^^ ^^^ ^^^^^^ ^^^ Context: Memory - │ │ │ │ - │ │ │ ERC20: Value - │ │ Context: Memory +270 │ self._update(ctx, + │ ^^^^ ^^^ Context: Memory + │ │ │ UniswapV2Pair: Value +271 │ balance0: token0.balanceOf(ctx.self_address()), + │ ^^^^^^ ^^^ Context: Memory + │ │ + │ ERC20: Value note: - ┌─ uniswap.fe:269:44 - │ -269 │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ^^^^^^^^^^^^^^^^^^ address: Value - -note: - ┌─ uniswap.fe:269:27 + ┌─ uniswap.fe:271:49 │ -269 │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^ Context: Memory - │ │ │ - │ │ ERC20: Value - │ u256: Value +271 │ balance0: token0.balanceOf(ctx.self_address()), + │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:269:82 + ┌─ uniswap.fe:271:32 │ -269 │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ^^^^^^^^^^^^^^^^^^ address: Value +271 │ balance0: token0.balanceOf(ctx.self_address()), + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +272 │ balance1: token1.balanceOf(ctx.self_address()), + │ ^^^^^^ ^^^ Context: Memory + │ │ + │ ERC20: Value note: - ┌─ uniswap.fe:269:65 + ┌─ uniswap.fe:272:49 │ -269 │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value - │ │ - │ u256: Value +272 │ balance1: token1.balanceOf(ctx.self_address()), + │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:269:103 + ┌─ uniswap.fe:272:32 │ -269 │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value - │ │ - │ u256: Storage { nonce: Some(7) } => Value +272 │ balance1: token1.balanceOf(ctx.self_address()), + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +273 │ reserve0: self.reserve0, + │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:269:118 + ┌─ uniswap.fe:273:32 │ -269 │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value +273 │ reserve0: self.reserve0, + │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value +274 │ reserve1: self.reserve1) + │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:269:9 + ┌─ uniswap.fe:274:32 │ -269 │ self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +274 │ reserve1: self.reserve1) + │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:271:5 + ┌─ uniswap.fe:270:9 │ -271 │ ╭ fn sqrt(val: u256) -> u256: -272 │ │ let z: u256 -273 │ │ if (val > 3): -274 │ │ z = val - · │ -280 │ │ z = 1 -281 │ │ return z - │ ╰────────────────^ attributes hash: 6692289661045278817 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - name: "val", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } - -note: - ┌─ uniswap.fe:272:16 - │ -272 │ let z: u256 - │ ^^^^ u256 - · -275 │ let x: u256 = val / 2 + 1 - │ ^^^^ u256 - -note: - ┌─ uniswap.fe:273:13 - │ -273 │ if (val > 3): - │ ^^^ ^ u256: Value - │ │ - │ u256: Value - -note: - ┌─ uniswap.fe:273:12 - │ -273 │ if (val > 3): - │ ^^^^^^^^^ bool: Value -274 │ z = val - │ ^ ^^^ u256: Value - │ │ - │ u256: Value -275 │ let x: u256 = val / 2 + 1 - │ ^^^ ^ u256: Value - │ │ - │ u256: Value - -note: - ┌─ uniswap.fe:275:27 - │ -275 │ let x: u256 = val / 2 + 1 - │ ^^^^^^^ ^ u256: Value - │ │ - │ u256: Value - -note: - ┌─ uniswap.fe:275:27 - │ -275 │ let x: u256 = val / 2 + 1 - │ ^^^^^^^^^^^ u256: Value -276 │ while (x < z): - │ ^ ^ u256: Value - │ │ - │ u256: Value - -note: - ┌─ uniswap.fe:276:19 - │ -276 │ while (x < z): - │ ^^^^^^^ bool: Value -277 │ z = x - │ ^ ^ u256: Value - │ │ - │ u256: Value -278 │ x = (val / x + x) / 2 - │ ^ ^^^ ^ u256: Value - │ │ │ - │ │ u256: Value - │ u256: Value - -note: - ┌─ uniswap.fe:278:22 - │ -278 │ x = (val / x + x) / 2 - │ ^^^^^^^ ^ u256: Value - │ │ - │ u256: Value - -note: - ┌─ uniswap.fe:278:21 - │ -278 │ x = (val / x + x) / 2 - │ ^^^^^^^^^^^^^ ^ u256: Value - │ │ - │ u256: Value - -note: - ┌─ uniswap.fe:278:21 - │ -278 │ x = (val / x + x) / 2 - │ ^^^^^^^^^^^^^^^^^ u256: Value -279 │ elif (val != 0): - │ ^^^ ^ u256: Value - │ │ - │ u256: Value - -note: - ┌─ uniswap.fe:279:14 - │ -279 │ elif (val != 0): - │ ^^^^^^^^^^ bool: Value -280 │ z = 1 - │ ^ ^ u256: Value - │ │ - │ u256: Value -281 │ return z - │ ^ u256: Value - -note: - ┌─ uniswap.fe:283:5 - │ -283 │ ╭ fn min(x: u256, y: u256) -> u256: -284 │ │ return x if x < y else y - │ ╰────────────────────────────────^ attributes hash: 3620942230080591742 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - name: "x", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - FunctionParam { - name: "y", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } +270 │ ╭ self._update(ctx, +271 │ │ balance0: token0.balanceOf(ctx.self_address()), +272 │ │ balance1: token1.balanceOf(ctx.self_address()), +273 │ │ reserve0: self.reserve0, +274 │ │ reserve1: self.reserve1) + │ ╰─────────────────────────────────────────────^ (): Value note: - ┌─ uniswap.fe:284:21 + ┌─ uniswap.fe:277:5 │ -284 │ return x if x < y else y - │ ^ ^ u256: Value - │ │ - │ u256: Value - -note: - ┌─ uniswap.fe:284:16 - │ -284 │ return x if x < y else y - │ ^ ^^^^^ ^ u256: Value - │ │ │ - │ │ bool: Value - │ u256: Value - -note: - ┌─ uniswap.fe:284:16 - │ -284 │ return x if x < y else y - │ ^^^^^^^^^^^^^^^^^ u256: Value - -note: - ┌─ uniswap.fe:287:5 - │ -287 │ fee_to: address +277 │ fee_to: address │ ^^^^^^^^^^^^^^^ address -288 │ fee_to_setter: address +278 │ fee_to_setter: address │ ^^^^^^^^^^^^^^^^^^^^^^ address -289 │ -290 │ pairs: Map> +279 │ +280 │ pairs: Map> │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map> -291 │ -292 │ all_pairs: Array +281 │ +282 │ all_pairs: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array -293 │ pair_counter: u256 +283 │ pair_counter: u256 │ ^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:296:9 + ┌─ uniswap.fe:286:9 │ -296 │ idx token0: address +286 │ idx token0: address │ ^^^^^^^^^^^^^^^^^^^ address -297 │ idx token1: address +287 │ idx token1: address │ ^^^^^^^^^^^^^^^^^^^ address -298 │ pair: address +288 │ pair: address │ ^^^^^^^^^^^^^ address -299 │ index: u256 +289 │ index: u256 │ ^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:304:5 + ┌─ uniswap.fe:294:5 │ -304 │ ╭ pub fn fee_to(self) -> address: -305 │ │ return self.fee_to +294 │ ╭ pub fn fee_to(self) -> address: +295 │ │ return self.fee_to │ ╰──────────────────────────^ attributes hash: 227275695522088782 │ = FunctionSignature { @@ -4216,22 +4078,22 @@ note: } note: - ┌─ uniswap.fe:305:16 + ┌─ uniswap.fe:295:16 │ -305 │ return self.fee_to +295 │ return self.fee_to │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:305:16 + ┌─ uniswap.fe:295:16 │ -305 │ return self.fee_to +295 │ return self.fee_to │ ^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value note: - ┌─ uniswap.fe:307:5 + ┌─ uniswap.fe:297:5 │ -307 │ ╭ pub fn fee_to_setter(self) -> address: -308 │ │ return self.fee_to_setter +297 │ ╭ pub fn fee_to_setter(self) -> address: +298 │ │ return self.fee_to_setter │ ╰─────────────────────────────────^ attributes hash: 227275695522088782 │ = FunctionSignature { @@ -4248,22 +4110,22 @@ note: } note: - ┌─ uniswap.fe:308:16 + ┌─ uniswap.fe:298:16 │ -308 │ return self.fee_to_setter +298 │ return self.fee_to_setter │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:308:16 + ┌─ uniswap.fe:298:16 │ -308 │ return self.fee_to_setter +298 │ return self.fee_to_setter │ ^^^^^^^^^^^^^^^^^^ address: Storage { nonce: Some(1) } => Value note: - ┌─ uniswap.fe:310:5 + ┌─ uniswap.fe:300:5 │ -310 │ ╭ pub fn all_pairs_length(self) -> u256: -311 │ │ return self.pair_counter +300 │ ╭ pub fn all_pairs_length(self) -> u256: +301 │ │ return self.pair_counter │ ╰────────────────────────────────^ attributes hash: 11773348765973600208 │ = FunctionSignature { @@ -4282,28 +4144,28 @@ note: } note: - ┌─ uniswap.fe:311:16 + ┌─ uniswap.fe:301:16 │ -311 │ return self.pair_counter +301 │ return self.pair_counter │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:311:16 + ┌─ uniswap.fe:301:16 │ -311 │ return self.pair_counter +301 │ return self.pair_counter │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:313:5 + ┌─ uniswap.fe:303:5 │ -313 │ ╭ pub fn create_pair(self, ctx: Context, token_a: address, token_b: address) -> address: -314 │ │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" -315 │ │ -316 │ │ let token0: address = token_a if token_a < token_b else token_b +303 │ ╭ pub fn create_pair(self, ctx: Context, _ token_a: address, _ token_b: address) -> address: +304 │ │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +305 │ │ +306 │ │ let token0: address = token_a if token_a < token_b else token_b · │ -330 │ │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) -331 │ │ return address(pair) - │ ╰────────────────────────────^ attributes hash: 4632903327058450706 +320 │ │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +321 │ │ return address(pair) + │ ╰────────────────────────────^ attributes hash: 8455575078477255668 │ = FunctionSignature { self_decl: Some( @@ -4314,6 +4176,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -4325,6 +4188,9 @@ note: ), }, FunctionParam { + label: Some( + "_", + ), name: "token_a", typ: Ok( Base( @@ -4333,6 +4199,9 @@ note: ), }, FunctionParam { + label: Some( + "_", + ), name: "token_b", typ: Ok( Base( @@ -4349,296 +4218,296 @@ note: } note: - ┌─ uniswap.fe:316:21 + ┌─ uniswap.fe:306:21 │ -316 │ let token0: address = token_a if token_a < token_b else token_b +306 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^ address -317 │ let token1: address = token_a if token_a > token_b else token_b +307 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^ address · -321 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^ u256 -322 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +312 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^^^^^^^^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:314:16 + ┌─ uniswap.fe:304:16 │ -314 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +304 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" │ ^^^^^^^ ^^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:314:16 + ┌─ uniswap.fe:304:16 │ -314 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +304 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<30>: Memory │ │ │ bool: Value -315 │ -316 │ let token0: address = token_a if token_a < token_b else token_b +305 │ +306 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^ ^^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:316:31 + ┌─ uniswap.fe:306:31 │ -316 │ let token0: address = token_a if token_a < token_b else token_b +306 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ │ │ bool: Value │ address: Value note: - ┌─ uniswap.fe:316:31 + ┌─ uniswap.fe:306:31 │ -316 │ let token0: address = token_a if token_a < token_b else token_b +306 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address: Value -317 │ let token1: address = token_a if token_a > token_b else token_b +307 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^ ^^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:317:31 + ┌─ uniswap.fe:307:31 │ -317 │ let token1: address = token_a if token_a > token_b else token_b +307 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ │ │ bool: Value │ address: Value note: - ┌─ uniswap.fe:317:31 + ┌─ uniswap.fe:307:31 │ -317 │ let token1: address = token_a if token_a > token_b else token_b +307 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address: Value -318 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +308 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^ ^ u256: Value │ │ │ address: Value note: - ┌─ uniswap.fe:318:26 + ┌─ uniswap.fe:308:26 │ -318 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +308 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:318:16 + ┌─ uniswap.fe:308:16 │ -318 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +308 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ String<23>: Memory │ │ │ bool: Value -319 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:319:16 + ┌─ uniswap.fe:309:16 │ -319 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(2) } note: - ┌─ uniswap.fe:319:16 + ┌─ uniswap.fe:309:16 │ -319 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:319:16 + ┌─ uniswap.fe:309:16 │ -319 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ address: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:319:46 + ┌─ uniswap.fe:309:46 │ -319 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:319:16 + ┌─ uniswap.fe:309:16 │ -319 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^ String<22>: Memory │ │ │ bool: Value -320 │ -321 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +310 │ +311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^ ^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:321:36 + ┌─ uniswap.fe:311:36 │ -321 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^ (address, address): Memory note: - ┌─ uniswap.fe:321:36 + ┌─ uniswap.fe:311:36 │ -321 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array: Memory note: - ┌─ uniswap.fe:321:26 + ┌─ uniswap.fe:311:26 │ -321 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -322 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +312 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^ ^ ^^^^ u256: Value │ │ │ │ │ u256: Value │ Context: Memory note: - ┌─ uniswap.fe:322:35 + ┌─ uniswap.fe:312:35 │ -322 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +312 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UniswapV2Pair: Value -323 │ pair.initialize(token0, token1) +313 │ pair.initialize(token0, token1) │ ^^^^ ^^^^^^ ^^^^^^ address: Value │ │ │ │ │ address: Value │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:323:9 + ┌─ uniswap.fe:313:9 │ -323 │ pair.initialize(token0, token1) +313 │ pair.initialize(token0, token1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -324 │ -325 │ self.pairs[token0][token1] = address(pair) +314 │ +315 │ self.pairs[token0][token1] = address(pair) │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:325:9 + ┌─ uniswap.fe:315:9 │ -325 │ self.pairs[token0][token1] = address(pair) +315 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(2) } note: - ┌─ uniswap.fe:325:9 + ┌─ uniswap.fe:315:9 │ -325 │ self.pairs[token0][token1] = address(pair) +315 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:325:9 + ┌─ uniswap.fe:315:9 │ -325 │ self.pairs[token0][token1] = address(pair) +315 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ address: Storage { nonce: None } note: - ┌─ uniswap.fe:325:38 + ┌─ uniswap.fe:315:38 │ -325 │ self.pairs[token0][token1] = address(pair) +315 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^ address: Value -326 │ self.pairs[token1][token0] = address(pair) +316 │ self.pairs[token1][token0] = address(pair) │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:326:9 + ┌─ uniswap.fe:316:9 │ -326 │ self.pairs[token1][token0] = address(pair) +316 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(2) } note: - ┌─ uniswap.fe:326:9 + ┌─ uniswap.fe:316:9 │ -326 │ self.pairs[token1][token0] = address(pair) +316 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:326:9 + ┌─ uniswap.fe:316:9 │ -326 │ self.pairs[token1][token0] = address(pair) +316 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ address: Storage { nonce: None } note: - ┌─ uniswap.fe:326:38 + ┌─ uniswap.fe:316:38 │ -326 │ self.pairs[token1][token0] = address(pair) +316 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^ address: Value -327 │ self.all_pairs[self.pair_counter] = address(pair) +317 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:327:9 + ┌─ uniswap.fe:317:9 │ -327 │ self.all_pairs[self.pair_counter] = address(pair) +317 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory: Value │ │ │ Array: Storage { nonce: Some(3) } note: - ┌─ uniswap.fe:327:24 + ┌─ uniswap.fe:317:24 │ -327 │ self.all_pairs[self.pair_counter] = address(pair) +317 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:327:9 + ┌─ uniswap.fe:317:9 │ -327 │ self.all_pairs[self.pair_counter] = address(pair) +317 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ address: Storage { nonce: None } note: - ┌─ uniswap.fe:327:45 + ┌─ uniswap.fe:317:45 │ -327 │ self.all_pairs[self.pair_counter] = address(pair) +317 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^ address: Value -328 │ self.pair_counter = self.pair_counter + 1 +318 │ self.pair_counter = self.pair_counter + 1 │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:328:9 + ┌─ uniswap.fe:318:9 │ -328 │ self.pair_counter = self.pair_counter + 1 +318 │ self.pair_counter = self.pair_counter + 1 │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory: Value │ │ │ u256: Storage { nonce: Some(4) } note: - ┌─ uniswap.fe:328:29 + ┌─ uniswap.fe:318:29 │ -328 │ self.pair_counter = self.pair_counter + 1 +318 │ self.pair_counter = self.pair_counter + 1 │ ^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:328:29 + ┌─ uniswap.fe:318:29 │ -328 │ self.pair_counter = self.pair_counter + 1 +318 │ self.pair_counter = self.pair_counter + 1 │ ^^^^^^^^^^^^^^^^^^^^^ u256: Value -329 │ -330 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +319 │ +320 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^ ^^^^^^ ^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ │ │ │ │ address: Value @@ -4646,31 +4515,31 @@ note: │ Context: Memory note: - ┌─ uniswap.fe:330:53 + ┌─ uniswap.fe:320:53 │ -330 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +320 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Factory: Value │ │ │ address: Value note: - ┌─ uniswap.fe:330:75 + ┌─ uniswap.fe:320:75 │ -330 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +320 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(4) } => Value -331 │ return address(pair) +321 │ return address(pair) │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:331:16 + ┌─ uniswap.fe:321:16 │ -331 │ return address(pair) +321 │ return address(pair) │ ^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:330:9 + ┌─ uniswap.fe:320:9 │ -330 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +320 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 13094055123344570742 │ = Event { @@ -4718,12 +4587,12 @@ note: } note: - ┌─ uniswap.fe:333:5 + ┌─ uniswap.fe:323:5 │ -333 │ ╭ pub fn set_fee_to(self, ctx: Context, fee_to: address): -334 │ │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" -335 │ │ self.fee_to = fee_to - │ ╰────────────────────────────^ attributes hash: 13077527319267994201 +323 │ ╭ pub fn set_fee_to(self, ctx: Context, fee_to: address): +324 │ │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +325 │ │ self.fee_to = fee_to + │ ╰────────────────────────────^ attributes hash: 9061125162615165722 │ = FunctionSignature { self_decl: Some( @@ -4734,6 +4603,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -4745,6 +4615,7 @@ note: ), }, FunctionParam { + label: None, name: "fee_to", typ: Ok( Base( @@ -4761,50 +4632,50 @@ note: } note: - ┌─ uniswap.fe:334:16 + ┌─ uniswap.fe:324:16 │ -334 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +324 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^ Context: Memory note: - ┌─ uniswap.fe:334:16 + ┌─ uniswap.fe:324:16 │ -334 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +324 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory: Value │ │ │ address: Value note: - ┌─ uniswap.fe:334:36 + ┌─ uniswap.fe:324:36 │ -334 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +324 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^ address: Storage { nonce: Some(1) } => Value note: - ┌─ uniswap.fe:334:16 + ┌─ uniswap.fe:324:16 │ -334 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +324 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ String<20>: Memory │ │ │ bool: Value -335 │ self.fee_to = fee_to +325 │ self.fee_to = fee_to │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:335:9 + ┌─ uniswap.fe:325:9 │ -335 │ self.fee_to = fee_to +325 │ self.fee_to = fee_to │ ^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ address: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:337:5 + ┌─ uniswap.fe:327:5 │ -337 │ ╭ pub fn set_fee_to_setter(self, ctx: Context, fee_to_setter: address): -338 │ │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" -339 │ │ self.fee_to_setter = fee_to_setter - │ ╰──────────────────────────────────────────^ attributes hash: 492104934844627339 +327 │ ╭ pub fn set_fee_to_setter(self, ctx: Context, fee_to_setter: address): +328 │ │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +329 │ │ self.fee_to_setter = fee_to_setter + │ ╰──────────────────────────────────────────^ attributes hash: 16865322734649050051 │ = FunctionSignature { self_decl: Some( @@ -4815,6 +4686,7 @@ note: ), params: [ FunctionParam { + label: None, name: "ctx", typ: Ok( Struct( @@ -4826,6 +4698,7 @@ note: ), }, FunctionParam { + label: None, name: "fee_to_setter", typ: Ok( Base( @@ -4842,35 +4715,246 @@ note: } note: - ┌─ uniswap.fe:338:16 + ┌─ uniswap.fe:328:16 │ -338 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +328 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^ Context: Memory note: - ┌─ uniswap.fe:338:16 + ┌─ uniswap.fe:328:16 │ -338 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +328 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:338:16 + ┌─ uniswap.fe:328:16 │ -338 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +328 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ String<20>: Memory │ │ │ bool: Value -339 │ self.fee_to_setter = fee_to_setter +329 │ self.fee_to_setter = fee_to_setter │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:339:9 + ┌─ uniswap.fe:329:9 │ -339 │ self.fee_to_setter = fee_to_setter +329 │ self.fee_to_setter = fee_to_setter │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ address: Value │ │ │ address: Storage { nonce: Some(1) } +note: + ┌─ uniswap.fe:332:1 + │ +332 │ ╭ fn sqrt(_ val: u256) -> u256: +333 │ │ let z: u256 +334 │ │ if (val > 3): +335 │ │ z = val + · │ +341 │ │ z = 1 +342 │ │ return z + │ ╰────────────^ attributes hash: 4892692935064256824 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: Some( + "_", + ), + name: "val", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } + +note: + ┌─ uniswap.fe:333:12 + │ +333 │ let z: u256 + │ ^^^^ u256 + · +336 │ let x: u256 = val / 2 + 1 + │ ^^^^ u256 + +note: + ┌─ uniswap.fe:334:9 + │ +334 │ if (val > 3): + │ ^^^ ^ u256: Value + │ │ + │ u256: Value + +note: + ┌─ uniswap.fe:334:8 + │ +334 │ if (val > 3): + │ ^^^^^^^^^ bool: Value +335 │ z = val + │ ^ ^^^ u256: Value + │ │ + │ u256: Value +336 │ let x: u256 = val / 2 + 1 + │ ^^^ ^ u256: Value + │ │ + │ u256: Value + +note: + ┌─ uniswap.fe:336:23 + │ +336 │ let x: u256 = val / 2 + 1 + │ ^^^^^^^ ^ u256: Value + │ │ + │ u256: Value + +note: + ┌─ uniswap.fe:336:23 + │ +336 │ let x: u256 = val / 2 + 1 + │ ^^^^^^^^^^^ u256: Value +337 │ while (x < z): + │ ^ ^ u256: Value + │ │ + │ u256: Value + +note: + ┌─ uniswap.fe:337:15 + │ +337 │ while (x < z): + │ ^^^^^^^ bool: Value +338 │ z = x + │ ^ ^ u256: Value + │ │ + │ u256: Value +339 │ x = (val / x + x) / 2 + │ ^ ^^^ ^ u256: Value + │ │ │ + │ │ u256: Value + │ u256: Value + +note: + ┌─ uniswap.fe:339:18 + │ +339 │ x = (val / x + x) / 2 + │ ^^^^^^^ ^ u256: Value + │ │ + │ u256: Value + +note: + ┌─ uniswap.fe:339:17 + │ +339 │ x = (val / x + x) / 2 + │ ^^^^^^^^^^^^^ ^ u256: Value + │ │ + │ u256: Value + +note: + ┌─ uniswap.fe:339:17 + │ +339 │ x = (val / x + x) / 2 + │ ^^^^^^^^^^^^^^^^^ u256: Value +340 │ elif (val != 0): + │ ^^^ ^ u256: Value + │ │ + │ u256: Value + +note: + ┌─ uniswap.fe:340:10 + │ +340 │ elif (val != 0): + │ ^^^^^^^^^^ bool: Value +341 │ z = 1 + │ ^ ^ u256: Value + │ │ + │ u256: Value +342 │ return z + │ ^ u256: Value + +note: + ┌─ uniswap.fe:344:1 + │ +344 │ ╭ fn min(_ x: u256, _ y: u256) -> u256: +345 │ │ return x if x < y else y + │ ╰────────────────────────────^ attributes hash: 4448606202021980030 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: Some( + "_", + ), + name: "x", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + FunctionParam { + label: Some( + "_", + ), + name: "y", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } + +note: + ┌─ uniswap.fe:345:17 + │ +345 │ return x if x < y else y + │ ^ ^ u256: Value + │ │ + │ u256: Value + +note: + ┌─ uniswap.fe:345:12 + │ +345 │ return x if x < y else y + │ ^ ^^^^^ ^ u256: Value + │ │ │ + │ │ bool: Value + │ u256: Value + +note: + ┌─ uniswap.fe:345:12 + │ +345 │ return x if x < y else y + │ ^^^^^^^^^^^^^^^^^ u256: Value + diff --git a/crates/analyzer/tests/snapshots/errors__call_balance_of_with_2_args.snap b/crates/analyzer/tests/snapshots/errors__call_balance_of_with_2_args.snap index 7025b64a03..97a17ce6f5 100644 --- a/crates/analyzer/tests/snapshots/errors__call_balance_of_with_2_args.snap +++ b/crates/analyzer/tests/snapshots/errors__call_balance_of_with_2_args.snap @@ -6,7 +6,7 @@ expression: "error_string(\"[snippet]\", &src)" error: `balance_of` expects 1 argument, but 2 were provided ┌─ src/evm.fe:38:15 │ -38 │ pub unsafe fn balance_of(addr: address) -> u256: +38 │ pub unsafe fn balance_of(_ addr: address) -> u256: │ ^^^^^^^^^^ expects 1 argument │ ┌─ [snippet]:4:26 diff --git a/crates/analyzer/tests/snapshots/errors__call_balance_of_with_wrong_type.snap b/crates/analyzer/tests/snapshots/errors__call_balance_of_with_wrong_type.snap index f6faad523a..ddd8ab137f 100644 --- a/crates/analyzer/tests/snapshots/errors__call_balance_of_with_wrong_type.snap +++ b/crates/analyzer/tests/snapshots/errors__call_balance_of_with_wrong_type.snap @@ -3,7 +3,7 @@ source: crates/analyzer/tests/errors.rs expression: "error_string(\"[snippet]\", &src)" --- -error: incorrect type for `balance_of` argument `addr` +error: incorrect type for `balance_of` argument at position 0 ┌─ [snippet]:4:26 │ 4 │ std::evm::balance_of(true) diff --git a/crates/analyzer/tests/snapshots/errors__call_balance_of_without_parameter.snap b/crates/analyzer/tests/snapshots/errors__call_balance_of_without_parameter.snap index 71933d0a25..4568a33546 100644 --- a/crates/analyzer/tests/snapshots/errors__call_balance_of_without_parameter.snap +++ b/crates/analyzer/tests/snapshots/errors__call_balance_of_without_parameter.snap @@ -6,7 +6,7 @@ expression: "error_string(\"[snippet]\", &src)" error: `balance_of` expects 1 argument, but 0 were provided ┌─ src/evm.fe:38:15 │ -38 │ pub unsafe fn balance_of(addr: address) -> u256: +38 │ pub unsafe fn balance_of(_ addr: address) -> u256: │ ^^^^^^^^^^ expects 1 argument │ ┌─ [snippet]:4:25 diff --git a/crates/analyzer/tests/snapshots/errors__call_send_value_with_1_arg.snap b/crates/analyzer/tests/snapshots/errors__call_send_value_with_1_arg.snap new file mode 100644 index 0000000000..6f8f510ca9 --- /dev/null +++ b/crates/analyzer/tests/snapshots/errors__call_send_value_with_1_arg.snap @@ -0,0 +1,17 @@ +--- +source: crates/analyzer/tests/errors.rs +expression: "error_string(\"[snippet]\", &src)" + +--- +error: `send_value` expects 2 arguments, but 1 was provided + ┌─ src/lib.fe:11:8 + │ +11 │ pub fn send_value(to: address, wei: u256): + │ ^^^^^^^^^^ expects 2 arguments + │ + ┌─ [snippet]:3:19 + │ + 3 │ std::send_value(to: address(0)) + │ -------------- supplied 1 argument + + diff --git a/crates/analyzer/tests/snapshots/errors__call_send_value_with_3_args.snap b/crates/analyzer/tests/snapshots/errors__call_send_value_with_3_args.snap new file mode 100644 index 0000000000..5dea3df59b --- /dev/null +++ b/crates/analyzer/tests/snapshots/errors__call_send_value_with_3_args.snap @@ -0,0 +1,17 @@ +--- +source: crates/analyzer/tests/errors.rs +expression: "error_string(\"[snippet]\", &src)" + +--- +error: `send_value` expects 2 arguments, but 3 were provided + ┌─ src/lib.fe:11:8 + │ +11 │ pub fn send_value(to: address, wei: u256): + │ ^^^^^^^^^^ expects 2 arguments + │ + ┌─ [snippet]:3:19 + │ + 3 │ std::send_value(to: address(0), wei: 0, 0) + │ -------------- ------ - supplied 3 arguments + + diff --git a/crates/analyzer/tests/snapshots/errors__call_send_value_with_wrong_type.snap b/crates/analyzer/tests/snapshots/errors__call_send_value_with_wrong_type.snap new file mode 100644 index 0000000000..d85b7943cb --- /dev/null +++ b/crates/analyzer/tests/snapshots/errors__call_send_value_with_wrong_type.snap @@ -0,0 +1,12 @@ +--- +source: crates/analyzer/tests/errors.rs +expression: "error_string(\"[snippet]\", &src)" + +--- +error: incorrect type for `send_value` argument `to` + ┌─ [snippet]:3:23 + │ +3 │ std::send_value(to: true, wei: 0) + │ ^^^^ this has type `bool`; expected type `address` + + diff --git a/crates/analyzer/tests/snapshots/errors__call_send_value_with_wrong_type2.snap b/crates/analyzer/tests/snapshots/errors__call_send_value_with_wrong_type2.snap new file mode 100644 index 0000000000..c07125be4d --- /dev/null +++ b/crates/analyzer/tests/snapshots/errors__call_send_value_with_wrong_type2.snap @@ -0,0 +1,12 @@ +--- +source: crates/analyzer/tests/errors.rs +expression: "error_string(\"[snippet]\", &src)" + +--- +error: incorrect type for `send_value` argument `wei` + ┌─ [snippet]:3:40 + │ +3 │ std::send_value(to: address(0), wei: true) + │ ^^^^ this has type `bool`; expected type `u256` + + diff --git a/crates/analyzer/tests/snapshots/errors__emit_bad_args.snap b/crates/analyzer/tests/snapshots/errors__emit_bad_args.snap index 899bf50f1a..7098b810ed 100644 --- a/crates/analyzer/tests/snapshots/errors__emit_bad_args.snap +++ b/crates/analyzer/tests/snapshots/errors__emit_bad_args.snap @@ -19,6 +19,12 @@ error: missing argument label │ = Note: this label is optional if the argument is a variable named `x`. +error: incorrect type for `Foo` argument `x` + ┌─ compile_errors/emit_bad_args.fe:10:19 + │ +10 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) + │ ^^^^^^ this has type `(u256, u256)`; expected type `address` + error: argument label mismatch ┌─ compile_errors/emit_bad_args.fe:10:27 │ @@ -35,10 +41,4 @@ error: argument label mismatch │ = Note: arguments must be provided in order. -error: incorrect type for `Foo` argument `x` - ┌─ compile_errors/emit_bad_args.fe:10:19 - │ -10 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) - │ ^^^^^^ this has type `(u256, u256)`; expected type `address` - diff --git a/crates/analyzer/tests/snapshots/errors__external_call_type_error.snap b/crates/analyzer/tests/snapshots/errors__external_call_type_error.snap index d8ed2ba8ab..9dcacfec6d 100644 --- a/crates/analyzer/tests/snapshots/errors__external_call_type_error.snap +++ b/crates/analyzer/tests/snapshots/errors__external_call_type_error.snap @@ -3,7 +3,7 @@ source: crates/analyzer/tests/errors.rs expression: "error_string(&path, test_files::fixture(path))" --- -error: incorrect type for `bar` argument `a` +error: incorrect type for `bar` argument at position 0 ┌─ compile_errors/external_call_type_error.fe:9:34 │ 9 │ Foo(ctx, address(0)).bar("hello world") diff --git a/crates/analyzer/tests/snapshots/errors__external_call_wrong_number_of_params.snap b/crates/analyzer/tests/snapshots/errors__external_call_wrong_number_of_params.snap index f042383002..bb99fd353a 100644 --- a/crates/analyzer/tests/snapshots/errors__external_call_wrong_number_of_params.snap +++ b/crates/analyzer/tests/snapshots/errors__external_call_wrong_number_of_params.snap @@ -11,4 +11,12 @@ error: `bar` expects 2 arguments, but 1 was provided │ │ │ expects 2 arguments +error: missing argument label + ┌─ compile_errors/external_call_wrong_number_of_params.fe:9:34 + │ +9 │ Foo(ctx, address(0)).bar(42) + │ ^ add `a:` here + │ + = Note: this label is optional if the argument is a variable named `a`. + diff --git a/crates/analyzer/tests/snapshots/errors__return_call_to_fn_with_param_type_mismatch.snap b/crates/analyzer/tests/snapshots/errors__return_call_to_fn_with_param_type_mismatch.snap index 204e5e700c..5bd5b88e9e 100644 --- a/crates/analyzer/tests/snapshots/errors__return_call_to_fn_with_param_type_mismatch.snap +++ b/crates/analyzer/tests/snapshots/errors__return_call_to_fn_with_param_type_mismatch.snap @@ -3,7 +3,7 @@ source: crates/analyzer/tests/errors.rs expression: "error_string(&path, test_files::fixture(path))" --- -error: incorrect type for `foo` argument `val` +error: incorrect type for `foo` argument at position 0 ┌─ compile_errors/return_call_to_fn_with_param_type_mismatch.fe:7:20 │ 7 │ return foo(100) diff --git a/crates/analyzer/tests/snapshots/errors__undefined_type_param.snap b/crates/analyzer/tests/snapshots/errors__undefined_type_param.snap index 2171205cbd..02da0a7cf6 100644 --- a/crates/analyzer/tests/snapshots/errors__undefined_type_param.snap +++ b/crates/analyzer/tests/snapshots/errors__undefined_type_param.snap @@ -10,9 +10,9 @@ error: undefined type │ ^^^^^^^^^^^ `MysteryType` has not been defined error: undefined type - ┌─ compile_errors/undefined_type_param.fe:8:19 + ┌─ compile_errors/undefined_type_param.fe:8:21 │ -8 │ pub fn a(val: DoesntExist): - │ ^^^^^^^^^^^ `DoesntExist` has not been defined +8 │ pub fn a(_ val: DoesntExist): + │ ^^^^^^^^^^^ `DoesntExist` has not been defined diff --git a/crates/library/std/src/context.fe b/crates/library/std/src/context.fe index 3ddfd8a2b6..81ff10535b 100644 --- a/crates/library/std/src/context.fe +++ b/crates/library/std/src/context.fe @@ -8,7 +8,7 @@ use ingot::error::{ pub struct Context: pub fn block_coinbase(self) -> address: unsafe: - return evm::coin_base() + return evm::coinbase() pub fn block_difficulty(self) -> u256: unsafe: @@ -44,9 +44,9 @@ pub struct Context: pub fn msg_sig(self) -> u256: unsafe: - return evm::shr(224, evm::call_data_load(0)) + return evm::shr(224, evm::call_data_load(offset: 0)) - pub fn balance_of(self, account: address) -> u256: + pub fn balance_of(self, _ account: address) -> u256: unsafe: return evm::balance_of(account) @@ -63,6 +63,8 @@ pub struct Context: if evm::balance() < wei: revert Error(code: ERROR_INSUFFICIENT_FUNDS_TO_SEND_VALUE) - let success: u256 = evm::call(evm::gas(), to, wei, 0, 0, 0, 0) + let success: u256 = evm::call(gas: evm::gas_remaining(), addr: to, value: wei, + input_offset: 0, input_len: 0, + output_offset: 0, output_len: 0) if success == 0: revert Error(code: ERROR_FAILED_SEND_VALUE) diff --git a/crates/library/std/src/evm.fe b/crates/library/std/src/evm.fe index 84fec885b7..55551fcf00 100644 --- a/crates/library/std/src/evm.fe +++ b/crates/library/std/src/evm.fe @@ -11,10 +11,16 @@ pub unsafe fn origin() -> address: pub unsafe fn gas_price() -> u256: return __gasprice() -pub unsafe fn block_hash(b: u256) -> u256: +pub unsafe fn gas_limit() -> u256: + return __gaslimit() + +pub unsafe fn gas_remaining() -> u256: + return __gas() + +pub unsafe fn block_hash(_ b: u256) -> u256: return __blockhash(b) -pub unsafe fn coin_base() -> address: +pub unsafe fn coinbase() -> address: return address(__coinbase()) pub unsafe fn timestamp() -> u256: @@ -26,16 +32,10 @@ pub unsafe fn block_number() -> u256: pub unsafe fn difficulty() -> u256: return __difficulty() -pub unsafe fn gas_limit() -> u256: - return __gaslimit() - -pub unsafe fn gas() -> u256: - return __gas() - pub unsafe fn self_address() -> address: return address(__address()) -pub unsafe fn balance_of(addr: address) -> u256: +pub unsafe fn balance_of(_ addr: address) -> u256: return __balance(u256(addr)) pub unsafe fn balance() -> u256: @@ -50,121 +50,120 @@ pub unsafe fn call_value() -> u256: # Overflowing math ops. Should these be unsafe or named # `overflowing_add`, etc? -pub fn add(x: u256, y: u256) -> u256: +pub fn add(_ x: u256, _ y: u256) -> u256: unsafe: return __add(x, y) -pub fn sub(x: u256, y: u256) -> u256: +pub fn sub(_ x: u256, _ y: u256) -> u256: unsafe: return __sub(x, y) -pub fn mul(x: u256, y: u256) -> u256: +pub fn mul(_ x: u256, _ y: u256) -> u256: unsafe: return __mul(x, y) -pub fn div(x: u256, y: u256) -> u256: +pub fn div(_ x: u256, _ y: u256) -> u256: unsafe: return __div(x, y) -pub fn sdiv(x: u256, y: u256) -> u256: +pub fn sdiv(_ x: u256, _ y: u256) -> u256: unsafe: return __sdiv(x, y) -pub fn mod(x: u256, y: u256) -> u256: +pub fn mod(_ x: u256, _ y: u256) -> u256: unsafe: return __mod(x, y) -pub fn smod(x: u256, y: u256) -> u256: +pub fn smod(_ x: u256, _ y: u256) -> u256: unsafe: return __smod(x, y) -pub fn exp(x: u256, y: u256) -> u256: +pub fn exp(_ x: u256, _ y: u256) -> u256: unsafe: return __exp(x, y) -pub fn addmod(x: u256, y: u256, m: u256) -> u256: +pub fn addmod(_ x: u256, _ y: u256, _ m: u256) -> u256: unsafe: return __addmod(x, y, m) -pub fn mulmod(x: u256, y: u256, m: u256) -> u256: +pub fn mulmod(_ x: u256, _ y: u256, _ m: u256) -> u256: unsafe: return __mulmod(x, y, m) -pub fn sign_extend(i: u256, x: u256) -> u256: +pub fn sign_extend(_ i: u256, _ x: u256) -> u256: unsafe: return __signextend(i, x) - # Comparison ops # TODO: return bool (see issue #653) -pub fn lt(x: u256, y: u256) -> u256: +pub fn lt(_ x: u256, _ y: u256) -> u256: unsafe: return __lt(x, y) -pub fn gt(x: u256, y: u256) -> u256: +pub fn gt(_ x: u256, _ y: u256) -> u256: unsafe: return __gt(x, y) -pub fn slt(x: u256, y: u256) -> u256: +pub fn slt(_ x: u256, _ y: u256) -> u256: unsafe: return __slt(x, y) -pub fn sgt(x: u256, y: u256) -> u256: +pub fn sgt(_ x: u256, _ y: u256) -> u256: unsafe: return __sgt(x, y) -pub fn eq(x: u256, y: u256) -> u256: +pub fn eq(_ x: u256, _ y: u256) -> u256: unsafe: return __eq(x, y) -pub fn is_zero(x: u256) -> u256: +pub fn is_zero(_ x: u256) -> u256: unsafe: return __iszero(x) # Bitwise ops -pub fn bitwise_and(x: u256, y: u256) -> u256: +pub fn bitwise_and(_ x: u256, _ y: u256) -> u256: unsafe: return __and(x, y) -pub fn bitwise_or(x: u256, y: u256) -> u256: +pub fn bitwise_or(_ x: u256, _ y: u256) -> u256: unsafe: return __or(x, y) -pub fn bitwise_not(x: u256) -> u256: +pub fn bitwise_not(_ x: u256) -> u256: unsafe: return __not(x) -pub fn xor(x: u256, y: u256) -> u256: +pub fn xor(_ x: u256, _ y: u256) -> u256: unsafe: return __xor(x, y) -pub fn byte(offset: u256, x: u256) -> u256: +pub fn byte(offset: u256, _ x: u256) -> u256: unsafe: return __byte(offset, x) -pub fn shl(x: u256, y: u256) -> u256: +pub fn shl(_ x: u256, _ y: u256) -> u256: unsafe: return __shl(x, y) -pub fn shr(x: u256, y: u256) -> u256: +pub fn shr(_ x: u256, _ y: u256) -> u256: unsafe: return __shr(x, y) -pub fn sar(x: u256, y: u256) -> u256: +pub fn sar(_ x: u256, _ y: u256) -> u256: unsafe: return __sar(x, y) # Evm state access and control -pub unsafe fn return_mem(location: u256, len: u256): - __return(location, len) +pub unsafe fn return_mem(offset: u256, len: u256): + __return(offset, len) -pub unsafe fn revert_mem(location: u256, len: u256): - __revert(location, len) +pub unsafe fn revert_mem(offset: u256, len: u256): + __revert(offset, len) -pub unsafe fn selfdestruct(addr: address): +pub unsafe fn selfdestruct(_ addr: address): __selfdestruct(u256(addr)) # Invalid opcode. Equivalent to revert(0, 0), @@ -180,96 +179,95 @@ pub unsafe fn pc() -> u256: return __pc() # TODO: dunno if we should enable this -# pub unsafe fn pop(x: u256): +# pub unsafe fn pop(_ x: u256): # return __pop(x) -pub unsafe fn mload(p: u256) -> u256: +pub unsafe fn mload(offset p: u256) -> u256: return __mload(p) -pub unsafe fn mstore(p: u256, v: u256): +pub unsafe fn mstore(offset p: u256, value v: u256): __mstore(p, v) -pub unsafe fn mstore8(p: u256, v: u256): +pub unsafe fn mstore8(offset p: u256, value v: u256): __mstore8(p, v) -pub unsafe fn sload(p: u256) -> u256: +pub unsafe fn sload(offset p: u256) -> u256: return __sload(p) -pub unsafe fn sstore(p: u256, v: u256): +pub unsafe fn sstore(offset p: u256, value v: u256): __sstore(p, v) pub unsafe fn msize() -> u256: return __msize() -pub unsafe fn call_data_load(p: u256) -> u256: +pub unsafe fn call_data_load(offset p: u256) -> u256: return __calldataload(p) pub unsafe fn call_data_size() -> u256: return __calldatasize() -pub unsafe fn call_data_copy(t: u256, f: u256, s: u256): - __calldatacopy(t, f, s) +pub unsafe fn call_data_copy(to_offset t: u256, from_offset f: u256, len: u256): + __calldatacopy(t, f, len) pub unsafe fn code_size() -> u256: return __codesize() -pub unsafe fn code_copy(t: u256, f: u256, s: u256): - __codecopy(t, f, s) +pub unsafe fn code_copy(to_offset t: u256, from_offset f: u256, len: u256): + __codecopy(t, f, len) pub unsafe fn return_data_size() -> u256: return __returndatasize() -pub unsafe fn return_data_copy(t: u256, f: u256, s: u256): - __returndatacopy(t, f, s) +pub unsafe fn return_data_copy(to_offset t: u256, from_offset f: u256, len: u256): + __returndatacopy(t, f, len) -pub unsafe fn extcodesize(addr: address) -> u256: +pub unsafe fn extcodesize(_ addr: address) -> u256: return __extcodesize(u256(addr)) -pub unsafe fn ext_code_copy(addr: address, t: u256, f: u256, s: u256): - __extcodecopy(u256(addr), t, f, s) +pub unsafe fn ext_code_copy(_ addr: address, to_offset t: u256, from_offset f: u256, len: u256): + __extcodecopy(u256(addr), t, f, len) -pub unsafe fn ext_code_hash(addr: address) -> u256: +pub unsafe fn ext_code_hash(_ addr: address) -> u256: return __extcodehash(u256(addr)) -pub unsafe fn keccak256_mem(location: u256, len: u256) -> u256: - return __keccak256(location, len) +pub unsafe fn keccak256_mem(offset: u256, len: u256) -> u256: + return __keccak256(offset, len) # Contract creation and calling -pub unsafe fn create(v: u256, p: u256, n: u256) -> address: +pub unsafe fn create(value v: u256, offset p: u256, len n: u256) -> address: return address(__create(v, p, n)) -pub unsafe fn create2(v: u256, p: u256, n: u256, s: u256) -> address: +pub unsafe fn create2(value v: u256, offset p: u256, len n: u256, salt s: u256) -> address: return address(__create2(v, p, n, s)) # TODO: return bool (success) -pub unsafe fn call(g: u256, addr: address, value: u256, in_: u256, insize: u256, out: u256, outsize: u256) -> u256: - return __call(g, u256(addr), value, in_, insize, out, outsize) - -pub unsafe fn call_code(g: u256, addr: address, value: u256, in_: u256, insize: u256, out: u256, outsize: u256) -> u256: - return __callcode(g, u256(addr), value, in_, insize, out, outsize) +pub unsafe fn call(gas: u256, addr: address, value: u256, input_offset: u256, input_len: u256, output_offset: u256, output_len: u256) -> u256: + return __call(gas, u256(addr), value, input_offset, input_len, output_offset, output_len) -pub unsafe fn delegate_call(g: u256, addr: address, in_: u256, insize: u256, out: u256, outsize: u256) -> u256: - return __delegatecall(g, u256(addr), in_, insize, out, outsize) +pub unsafe fn call_code(gas: u256, addr: address, value: u256, input_offset: u256, input_len: u256, output_offset: u256, output_len: u256) -> u256: + return __callcode(gas, u256(addr), value, input_offset, input_len, output_offset, output_len) -pub unsafe fn static_call(g: u256, addr: address, in_: u256, insize: u256, out: u256, outsize: u256) -> u256: - return __staticcall(g, u256(addr), in_, insize, out, outsize) +pub unsafe fn delegate_call(gas: u256, addr: address, value: u256, input_offset: u256, input_len: u256, output_offset: u256, output_len: u256) -> u256: + return __delegatecall(gas, u256(addr), input_offset, input_len, output_offset, output_len) +pub unsafe fn static_call(gas: u256, addr: address, input_offset: u256, input_len: u256, output_offset: u256, output_len: u256) -> u256: + return __staticcall(gas, u256(addr), input_offset, input_len, output_offset, output_len) # Logging functions -pub unsafe fn log0(p: u256, s: u256): +pub unsafe fn log0(offset p: u256, len s: u256): return __log0(p, s) -pub unsafe fn log1(p: u256, s: u256, t1: u256): +pub unsafe fn log1(offset p: u256, len s: u256, topic1 t1: u256): return __log1(p, s, t1) -pub unsafe fn log2(p: u256, s: u256, t1: u256, t2: u256): +pub unsafe fn log2(offset p: u256, len s: u256, topic1 t1: u256, topic2 t2: u256): return __log2(p, s, t1, t2) -pub unsafe fn log3(p: u256, s: u256, t1: u256, t2: u256, t3: u256): +pub unsafe fn log3(offset p: u256, len s: u256, topic1 t1: u256, topic2 t2: u256, topic3 t3: u256): return __log3(p, s, t1, t2, t3) -pub unsafe fn log4(p: u256, s: u256, t1: u256, t2: u256, t3: u256, t4: u256): - return __log4(p, s, t1, t2, t3, t4) +pub unsafe fn log4(offset p: u256, len s: u256, topic1 t1: u256, topic2 t2: u256, topic3 t3: u256, topic4 t4: u256): + return __log4(p, s, t1, t2, t3, t4) \ No newline at end of file diff --git a/crates/library/std/src/lib.fe b/crates/library/std/src/lib.fe index 9e00b0844f..bdf64a76ca 100644 --- a/crates/library/std/src/lib.fe +++ b/crates/library/std/src/lib.fe @@ -1,4 +1,2 @@ pub fn get_42() -> u256: return 42 - -# TODO: move these into some module of standard error codes diff --git a/crates/lowering/src/mappers/functions.rs b/crates/lowering/src/mappers/functions.rs index df474a8adb..048d9745c5 100644 --- a/crates/lowering/src/mappers/functions.rs +++ b/crates/lowering/src/mappers/functions.rs @@ -90,6 +90,7 @@ pub fn func_def(context: &mut ModuleContext, function: FunctionId) -> Node ast::Function { let args = (0..array.size) .map(|index| { ast::FunctionArg::Regular(ast::RegularFunctionArg { + label: Some(SmolStr::new("_").into_node()), name: SmolStr::new(format!("val{}", index)).into_node(), typ: names::fixed_size_type_desc(&FixedSize::Base(array.inner)).into_node(), }) diff --git a/crates/lowering/tests/snapshots/lowering__and_or.snap b/crates/lowering/tests/snapshots/lowering__and_or.snap index 27b55445d2..2e4e78082b 100644 --- a/crates/lowering/tests/snapshots/lowering__and_or.snap +++ b/crates/lowering/tests/snapshots/lowering__and_or.snap @@ -68,7 +68,7 @@ contract Foo: let z: $tuple_bool_bool_ = $tuple_bool_bool_(item0: $boolean_expr_result_1, item1: $boolean_expr_result_0) return () - pub fn short_or(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_or(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: let $boolean_expr_result_0: bool = true let $boolean_expr_result_1: bool = true let $boolean_expr_result_2: bool = true @@ -83,7 +83,7 @@ contract Foo: return $boolean_expr_result_0 - pub fn short_or2(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_or2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: let $boolean_expr_result_0: bool = true let $boolean_expr_result_1: bool = true if not first: @@ -98,7 +98,7 @@ contract Foo: return $boolean_expr_result_0 - pub fn short_or3(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_or3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: let $boolean_expr_result_0: bool = true let $boolean_expr_result_1: bool = true let $boolean_expr_result_2: bool = true @@ -113,7 +113,7 @@ contract Foo: return $boolean_expr_result_0 - pub fn short_and(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_and(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: let $boolean_expr_result_0: bool = false let $boolean_expr_result_1: bool = false let $boolean_expr_result_2: bool = false @@ -128,7 +128,7 @@ contract Foo: return $boolean_expr_result_0 - pub fn short_and2(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_and2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: let $boolean_expr_result_0: bool = false let $boolean_expr_result_1: bool = false if first: @@ -143,7 +143,7 @@ contract Foo: return $boolean_expr_result_0 - pub fn short_and3(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_and3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: let $boolean_expr_result_0: bool = false let $boolean_expr_result_1: bool = false let $boolean_expr_result_2: bool = false @@ -158,7 +158,7 @@ contract Foo: return $boolean_expr_result_0 - pub fn short_mixed(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_mixed(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: let $boolean_expr_result_0: bool = true let $boolean_expr_result_1: bool = false let $boolean_expr_result_2: bool = true @@ -173,9 +173,10 @@ contract Foo: return $boolean_expr_result_0 - pub fn baz(val: bool) -> bool: + pub fn baz(_ val: bool) -> bool: return val - pub fn double_baz(val: bool, val2: bool) -> (): + pub fn double_baz(_ val: bool, _ val2: bool) -> (): pass return () + diff --git a/crates/lowering/tests/snapshots/lowering__list_expressions.snap b/crates/lowering/tests/snapshots/lowering__list_expressions.snap index bdd4a355de..833f9db6ee 100644 --- a/crates/lowering/tests/snapshots/lowering__list_expressions.snap +++ b/crates/lowering/tests/snapshots/lowering__list_expressions.snap @@ -1,9 +1,9 @@ --- source: crates/lowering/tests/lowering.rs -expression: lowered_code +expression: lowered --- -fn list_expr_array_u256_3(val0: u256, val1: u256, val2: u256) -> Array: +fn list_expr_array_u256_3(_ val0: u256, _ val1: u256, _ val2: u256) -> Array: let generated_array: Array generated_array[0] = val0 generated_array[1] = val1 @@ -19,3 +19,4 @@ contract Foo: let x: Array = list_expr_array_u256_3(10, 20, 30) list_expr_array_unit_0() return () + diff --git a/crates/lowering/tests/snapshots/lowering__module_const.snap b/crates/lowering/tests/snapshots/lowering__module_const.snap index c2481c2ebe..73c1d94bfa 100644 --- a/crates/lowering/tests/snapshots/lowering__module_const.snap +++ b/crates/lowering/tests/snapshots/lowering__module_const.snap @@ -7,7 +7,7 @@ struct $tuple_u256_u256_: pub item0: u256 pub item1: u256 -fn list_expr_array_u256_2(val0: u256, val1: u256) -> Array: +fn list_expr_array_u256_2(_ val0: u256, _ val1: u256) -> Array: let generated_array: Array generated_array[0] = val0 generated_array[1] = val1 @@ -59,3 +59,4 @@ contract Foo: return self.table[3] + diff --git a/crates/lowering/tests/snapshots/lowering__module_fn.snap b/crates/lowering/tests/snapshots/lowering__module_fn.snap index 27f684a01e..1ac7d0bb87 100644 --- a/crates/lowering/tests/snapshots/lowering__module_fn.snap +++ b/crates/lowering/tests/snapshots/lowering__module_fn.snap @@ -11,7 +11,7 @@ struct $tuple_address_tuple_u256_u8__: pub item0: address pub item1: $tuple_u256_u8_ -fn list_expr_array_u8_3(val0: u8, val1: u8, val2: u8) -> Array: +fn list_expr_array_u8_3(_ val0: u8, _ val1: u8, _ val2: u8) -> Array: let generated_array: Array generated_array[0] = val0 generated_array[1] = val1 @@ -32,3 +32,4 @@ contract Foo: pub fn sum_things() -> u8: let x: Array = return_array() return x[0] + x[1] + x[2] + diff --git a/crates/lowering/tests/snapshots/lowering__struct_fn.snap b/crates/lowering/tests/snapshots/lowering__struct_fn.snap index 69fa39c4b0..a9258179d1 100644 --- a/crates/lowering/tests/snapshots/lowering__struct_fn.snap +++ b/crates/lowering/tests/snapshots/lowering__struct_fn.snap @@ -6,7 +6,7 @@ expression: lowered struct Foo: pub x: u256 - pub fn set_x(self, new: u256) -> u256: + pub fn set_x(self, _ new: u256) -> u256: let old: u256 = self.get_x() self.x = new return old @@ -19,3 +19,4 @@ fn main() -> (): foo.set_x(100) assert foo.get_x() == 100 return () + diff --git a/crates/lowering/tests/snapshots/lowering__ternary.snap b/crates/lowering/tests/snapshots/lowering__ternary.snap index 5607d67336..35f973296a 100644 --- a/crates/lowering/tests/snapshots/lowering__ternary.snap +++ b/crates/lowering/tests/snapshots/lowering__ternary.snap @@ -78,10 +78,11 @@ contract Foo: let z: $tuple_u256_u256_ = $tuple_u256_u256_(item0: $ternary_result_1, item1: $ternary_result_0) return () - pub fn baz(val: u256) -> (): + pub fn baz(_ val: u256) -> (): pass return () - pub fn double_baz(val1: u256, val2: u256) -> (): + pub fn double_baz(_ val1: u256, _ val2: u256) -> (): pass return () + diff --git a/crates/parser/src/ast.rs b/crates/parser/src/ast.rs index 02308491de..cc3af76dce 100644 --- a/crates/parser/src/ast.rs +++ b/crates/parser/src/ast.rs @@ -167,6 +167,7 @@ pub struct EventField { #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)] pub struct RegularFunctionArg { + pub label: Option>, pub name: Node, pub typ: Node, } @@ -179,7 +180,6 @@ pub enum FunctionArg { } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)] -#[allow(clippy::large_enum_variant)] pub enum FuncStmt { Return { value: Option>, @@ -428,7 +428,7 @@ impl Spanned for ContractStmt { impl fmt::Display for Module { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "{}", double_line_joined(&self.body)) + writeln!(f, "{}", double_line_joined(&self.body)) } } @@ -632,6 +632,9 @@ impl fmt::Display for EventField { impl fmt::Display for RegularFunctionArg { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + if let Some(label) = &self.label { + write!(f, "{} ", label.kind)?; + } write!(f, "{}: {}", self.name.kind, self.typ.kind) } } diff --git a/crates/parser/src/grammar/functions.rs b/crates/parser/src/grammar/functions.rs index aa3558e7d0..99ef6085b2 100644 --- a/crates/parser/src/grammar/functions.rs +++ b/crates/parser/src/grammar/functions.rs @@ -104,11 +104,19 @@ fn parse_fn_param_list(par: &mut Parser) -> ParseResult { - let name = par.next()?; + let ident = par.next()?; - if name.kind == TokenKind::SelfValue { - params.push(Node::new(FunctionArg::Self_, name.span)); + if ident.kind == TokenKind::SelfValue { + params.push(Node::new(FunctionArg::Self_, ident.span)); } else { + // Parameter can have an optional label specifier. Example: + // fn transfer(from sender: address, to recipient: address, _ val: u256) + // transfer(from: me, to: you, 100) + + let (label, name) = match par.optional(TokenKind::Name) { + Some(name) => (Some(ident), name), + None => (None, ident), + }; par.expect_with_notes( TokenKind::Colon, "failed to parse function parameter", @@ -124,7 +132,8 @@ fn parse_fn_param_list(par: &mut Parser) -> ParseResult)" } test_parse! { type_unit, types::parse_type_desc, "()" } -test_parse! { fn_def, try_parse_module, "fn foo21(x: bool, y: address,) -> bool:\n x"} +test_parse! { fn_def, try_parse_module, "fn transfer(from sender: address, to recip: address, _ val: u64) -> bool:\n false"} test_parse! { fn_def_pub, try_parse_module, "pub fn foo21(x: bool, y: address,) -> bool:\n x"} test_parse! { fn_def_unsafe, try_parse_module, "unsafe fn foo21(x: bool, y: address,) -> bool:\n x"} test_parse! { fn_def_pub_unsafe, try_parse_module, "pub unsafe fn foo21(x: bool, y: address,) -> bool:\n x"} diff --git a/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def.snap b/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def.snap index bc71c3cb94..ebed258f4b 100644 --- a/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def.snap +++ b/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def.snap @@ -1,6 +1,6 @@ --- source: crates/parser/tests/cases/parse_ast.rs -expression: "ast_string(stringify!(fn_def), module::parse_module,\n \"fn foo21(x: bool, y: address,) -> bool:\\n x\")" +expression: "ast_string(stringify!(fn_def), try_parse_module,\n \"fn transfer(from sender: address, to recip: address, _ val: u64) -> bool:\\n false\")" --- Node( @@ -11,44 +11,58 @@ Node( pub_: None, unsafe_: None, name: Node( - kind: "foo21", + kind: "transfer", span: Span( start: 3, - end: 8, + end: 11, ), ), args: [ Node( kind: Regular(RegularFunctionArg( + label: Some(Node( + kind: "from", + span: Span( + start: 12, + end: 16, + ), + )), name: Node( - kind: "x", + kind: "sender", span: Span( - start: 9, - end: 10, + start: 17, + end: 23, ), ), typ: Node( kind: Base( - base: "bool", + base: "address", ), span: Span( - start: 12, - end: 16, + start: 25, + end: 32, ), ), )), span: Span( - start: 9, - end: 16, + start: 17, + end: 32, ), ), Node( kind: Regular(RegularFunctionArg( + label: Some(Node( + kind: "to", + span: Span( + start: 34, + end: 36, + ), + )), name: Node( - kind: "y", + kind: "recip", span: Span( - start: 18, - end: 19, + start: 37, + end: 42, ), ), typ: Node( @@ -56,14 +70,45 @@ Node( base: "address", ), span: Span( - start: 21, - end: 28, + start: 44, + end: 51, ), ), )), span: Span( - start: 18, - end: 28, + start: 37, + end: 51, + ), + ), + Node( + kind: Regular(RegularFunctionArg( + label: Some(Node( + kind: "_", + span: Span( + start: 53, + end: 54, + ), + )), + name: Node( + kind: "val", + span: Span( + start: 55, + end: 58, + ), + ), + typ: Node( + kind: Base( + base: "u64", + ), + span: Span( + start: 60, + end: 63, + ), + ), + )), + span: Span( + start: 55, + end: 63, ), ), ], @@ -72,37 +117,37 @@ Node( base: "bool", ), span: Span( - start: 34, - end: 38, + start: 68, + end: 72, ), )), body: [ Node( kind: Expr( value: Node( - kind: Name("x"), + kind: Bool(false), span: Span( - start: 41, - end: 42, + start: 75, + end: 80, ), ), ), span: Span( - start: 41, - end: 42, + start: 75, + end: 80, ), ), ], ), span: Span( start: 0, - end: 42, + end: 80, ), )), ], ), span: Span( start: 0, - end: 42, + end: 80, ), ) diff --git a/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_pub.snap b/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_pub.snap index 35e49da113..1110f57e14 100644 --- a/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_pub.snap +++ b/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_pub.snap @@ -1,6 +1,6 @@ --- source: crates/parser/tests/cases/parse_ast.rs -expression: "ast_string(stringify!(fn_def_pub), module::parse_module,\n \"pub fn foo21(x: bool, y: address,) -> bool:\\n x\")" +expression: "ast_string(stringify!(fn_def_pub), try_parse_module,\n \"pub fn foo21(x: bool, y: address,) -> bool:\\n x\")" --- Node( @@ -23,6 +23,7 @@ Node( args: [ Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "x", span: Span( @@ -47,6 +48,7 @@ Node( ), Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "y", span: Span( diff --git a/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_pub_unsafe.snap b/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_pub_unsafe.snap index 49b4399056..4d3486bddf 100644 --- a/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_pub_unsafe.snap +++ b/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_pub_unsafe.snap @@ -1,6 +1,6 @@ --- source: crates/parser/tests/cases/parse_ast.rs -expression: "ast_string(stringify!(fn_def_pub_unsafe), module::parse_module,\n \"pub unsafe fn foo21(x: bool, y: address,) -> bool:\\n x\")" +expression: "ast_string(stringify!(fn_def_pub_unsafe), try_parse_module,\n \"pub unsafe fn foo21(x: bool, y: address,) -> bool:\\n x\")" --- Node( @@ -26,6 +26,7 @@ Node( args: [ Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "x", span: Span( @@ -50,6 +51,7 @@ Node( ), Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "y", span: Span( diff --git a/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_unsafe.snap b/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_unsafe.snap index 8c64f0c148..bad0eae436 100644 --- a/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_unsafe.snap +++ b/crates/parser/tests/cases/snapshots/cases__parse_ast__fn_def_unsafe.snap @@ -1,6 +1,6 @@ --- source: crates/parser/tests/cases/parse_ast.rs -expression: "ast_string(stringify!(fn_def_unsafe), module::parse_module,\n \"unsafe fn foo21(x: bool, y: address,) -> bool:\\n x\")" +expression: "ast_string(stringify!(fn_def_unsafe), try_parse_module,\n \"unsafe fn foo21(x: bool, y: address,) -> bool:\\n x\")" --- Node( @@ -23,6 +23,7 @@ Node( args: [ Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "x", span: Span( @@ -47,6 +48,7 @@ Node( ), Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "y", span: Span( diff --git a/crates/parser/tests/cases/snapshots/cases__parse_ast__guest_book.snap b/crates/parser/tests/cases/snapshots/cases__parse_ast__guest_book.snap index a3ced947f9..1e04087566 100644 --- a/crates/parser/tests/cases/snapshots/cases__parse_ast__guest_book.snap +++ b/crates/parser/tests/cases/snapshots/cases__parse_ast__guest_book.snap @@ -199,6 +199,7 @@ Node( ), Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "book_msg", span: Span( @@ -367,6 +368,7 @@ Node( ), Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "addr", span: Span( diff --git a/crates/parser/tests/cases/snapshots/cases__parse_ast__module_level_events.snap b/crates/parser/tests/cases/snapshots/cases__parse_ast__module_level_events.snap index 985e0414a7..09860e0522 100644 --- a/crates/parser/tests/cases/snapshots/cases__parse_ast__module_level_events.snap +++ b/crates/parser/tests/cases/snapshots/cases__parse_ast__module_level_events.snap @@ -166,6 +166,7 @@ Node( args: [ Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "ctx", span: Span( @@ -190,6 +191,7 @@ Node( ), Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "to", span: Span( @@ -214,6 +216,7 @@ Node( ), Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "value", span: Span( diff --git a/crates/parser/tests/cases/snapshots/cases__parse_ast__module_stmts.snap b/crates/parser/tests/cases/snapshots/cases__parse_ast__module_stmts.snap index dccc99cb0b..9481406c48 100644 --- a/crates/parser/tests/cases/snapshots/cases__parse_ast__module_stmts.snap +++ b/crates/parser/tests/cases/snapshots/cases__parse_ast__module_stmts.snap @@ -1,6 +1,6 @@ --- source: crates/parser/tests/cases/parse_ast.rs -expression: "ast_string(stringify!(module_stmts), module::parse_module,\n r#\"\npragma 0.5.0\n\nuse foo::bar::{\n bing as bong,\n food::*\n}\n\ntype X = Map\n\npub fn double(x: u8) -> u8:\n return x * 2\n\nfn secret() -> u8:\n return 0xBEEF\n\ncontract A:\n pub const x: u256 = 10\n\ncontract B:\n pub x: X\n\"#)" +expression: "ast_string(stringify!(module_stmts), try_parse_module,\n r#\"\npragma 0.5.0\n\nuse foo::bar::{\n bing as bong,\n food::*\n}\n\ntype X = Map\n\npub fn double(x: u8) -> u8:\n return x * 2\n\nfn secret() -> u8:\n return 0xBEEF\n\ncontract A:\n pub const x: u256 = 10\n\ncontract B:\n pub x: X\n\"#)" --- Node( @@ -176,6 +176,7 @@ Node( args: [ Node( kind: Regular(RegularFunctionArg( + label: None, name: Node( kind: "x", span: Span( diff --git a/crates/test-files/fixtures/compile_errors/external_call_type_error.fe b/crates/test-files/fixtures/compile_errors/external_call_type_error.fe index 06ceb0fb13..4c71c4a6be 100644 --- a/crates/test-files/fixtures/compile_errors/external_call_type_error.fe +++ b/crates/test-files/fixtures/compile_errors/external_call_type_error.fe @@ -1,7 +1,7 @@ use std::context::Context contract Foo: - pub fn bar(a: u256): + pub fn bar(_ a: u256): pass contract FooProxy: diff --git a/crates/test-files/fixtures/compile_errors/external_call_wrong_number_of_params.fe b/crates/test-files/fixtures/compile_errors/external_call_wrong_number_of_params.fe index 982512367f..a7958c29d9 100644 --- a/crates/test-files/fixtures/compile_errors/external_call_wrong_number_of_params.fe +++ b/crates/test-files/fixtures/compile_errors/external_call_wrong_number_of_params.fe @@ -6,4 +6,4 @@ contract Foo: contract FooProxy: pub fn baz(ctx: Context): - Foo(ctx, address(0)).bar(42) \ No newline at end of file + Foo(ctx, address(0)).bar(42) diff --git a/crates/test-files/fixtures/compile_errors/return_call_to_fn_with_param_type_mismatch.fe b/crates/test-files/fixtures/compile_errors/return_call_to_fn_with_param_type_mismatch.fe index e45b952907..e1899ce412 100644 --- a/crates/test-files/fixtures/compile_errors/return_call_to_fn_with_param_type_mismatch.fe +++ b/crates/test-files/fixtures/compile_errors/return_call_to_fn_with_param_type_mismatch.fe @@ -1,6 +1,6 @@ contract Foo: - pub fn foo(val: address) -> u256: + pub fn foo(_ val: address) -> u256: return 42 pub fn bar() -> u256: diff --git a/crates/test-files/fixtures/compile_errors/self_misuse.fe b/crates/test-files/fixtures/compile_errors/self_misuse.fe index b58b72cfe5..d48b9b1281 100644 --- a/crates/test-files/fixtures/compile_errors/self_misuse.fe +++ b/crates/test-files/fixtures/compile_errors/self_misuse.fe @@ -2,10 +2,10 @@ fn foo(): let self: u8 = 10 self = 5 -fn change_x(s: S): +fn change_x(_ s: S): s.x = 100 -fn bar(c: C): +fn bar(_ c: C): pass struct S: diff --git a/crates/test-files/fixtures/compile_errors/undefined_type_param.fe b/crates/test-files/fixtures/compile_errors/undefined_type_param.fe index 49053f07b1..0916484b66 100644 --- a/crates/test-files/fixtures/compile_errors/undefined_type_param.fe +++ b/crates/test-files/fixtures/compile_errors/undefined_type_param.fe @@ -5,7 +5,7 @@ struct BadField: contract Foo: # case 1: using arg with undefined type within the fn body - pub fn a(val: DoesntExist): + pub fn a(_ val: DoesntExist): val + 10 # case 2: calling a fn that has undefined-type arg diff --git a/crates/test-files/fixtures/demos/erc20_token.fe b/crates/test-files/fixtures/demos/erc20_token.fe index 0623c5cfb8..95252a5533 100644 --- a/crates/test-files/fixtures/demos/erc20_token.fe +++ b/crates/test-files/fixtures/demos/erc20_token.fe @@ -22,7 +22,7 @@ contract ERC20: self._name = name self._symbol = symbol self._decimals = u8(18) - self._mint(ctx, ctx.msg_sender(), 1000000000000000000000000) + self._mint(ctx, account: ctx.msg_sender(), value: 1000000000000000000000000) pub fn name(self) -> String<100>: return self._name.to_mem() @@ -36,52 +36,52 @@ contract ERC20: pub fn totalSupply(self) -> u256: return self._total_supply - pub fn balanceOf(self, account: address) -> u256: + pub fn balanceOf(self, _ account: address) -> u256: return self._balances[account] pub fn transfer(self, ctx: Context, recipient: address, value: u256) -> bool: - self._transfer(ctx, ctx.msg_sender(), recipient, value) + self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) return true pub fn allowance(self, owner: address, spender: address) -> u256: return self._allowances[owner][spender] pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool: - self._approve(ctx, ctx.msg_sender(), spender, value) + self._approve(ctx, owner: ctx.msg_sender(), spender, value) return true pub fn transferFrom(self, ctx: Context, sender: address, recipient: address, value: u256) -> bool: assert self._allowances[sender][ctx.msg_sender()] >= value self._transfer(ctx, sender, recipient, value) - self._approve(ctx, sender, ctx.msg_sender(), self._allowances[sender][ctx.msg_sender()] - value) + self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) return true pub fn increaseAllowance(self, ctx: Context, spender: address, addedValue: u256) -> bool: - self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] + addedValue) + self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) return true pub fn decreaseAllowance(self, ctx: Context, spender: address, subtractedValue: u256) -> bool: - self._approve(ctx, ctx.msg_sender(), spender, self._allowances[ctx.msg_sender()][spender] - subtractedValue) + self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) return true fn _transfer(self, ctx: Context, sender: address, recipient: address, value: u256): assert sender != address(0) assert recipient != address(0) - _before_token_transfer(sender, recipient, value) + _before_token_transfer(from: sender, to: recipient, value) self._balances[sender] = self._balances[sender] - value self._balances[recipient] = self._balances[recipient] + value emit Transfer(ctx, from: sender, to: recipient, value) fn _mint(self, ctx: Context, account: address, value: u256): assert account != address(0) - _before_token_transfer(address(0), account, value) + _before_token_transfer(from: address(0), to: account, value) self._total_supply = self._total_supply + value self._balances[account] = self._balances[account] + value emit Transfer(ctx, from: address(0), to: account, value) fn _burn(self, ctx: Context, account: address, value: u256): assert account != address(0) - _before_token_transfer(account, address(0), value) + _before_token_transfer(from: account, to: address(0), value) self._balances[account] = self._balances[account] - value self._total_supply = self._total_supply - value emit Transfer(ctx, from: account, to: address(0), value) @@ -92,8 +92,8 @@ contract ERC20: self._allowances[owner][spender] = value emit Approval(ctx, owner, spender, value) - fn _setup_decimals(self, decimals_: u8): + fn _setup_decimals(self, _ decimals_: u8): self._decimals = decimals_ - fn _before_token_transfer(from: address, to: address, value: u256): - pass \ No newline at end of file + fn _before_token_transfer(from: address, to: address, _ value: u256): + pass diff --git a/crates/test-files/fixtures/demos/uniswap.fe b/crates/test-files/fixtures/demos/uniswap.fe index 0a99df4aa4..a70c44de9c 100644 --- a/crates/test-files/fixtures/demos/uniswap.fe +++ b/crates/test-files/fixtures/demos/uniswap.fe @@ -1,10 +1,10 @@ use std::context::Context contract ERC20: - pub fn balanceOf(account: address) -> u256: + pub fn balanceOf(_ account: address) -> u256: return 0 - pub fn transfer(recipient: address, amount: u256) -> bool: + pub fn transfer(to: address, _ amount: u256) -> bool: return false contract UniswapV2Pair: @@ -84,31 +84,32 @@ contract UniswapV2Pair: self.total_supply = self.total_supply - value emit Transfer(ctx, from, to: address(0), value) + fn _approve(self, ctx: Context, owner: address, spender: address, value: u256): self.allowances[owner][spender] = value emit Approval(ctx, owner, spender, value) + fn _transfer(self, ctx: Context, from: address, to: address, value: u256): self.balances[from] = self.balances[from] - value self.balances[to] = self.balances[to] + value emit Transfer(ctx, from, to, value) pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool: - self._approve(ctx, ctx.msg_sender(), spender, value) + self._approve(ctx, owner: ctx.msg_sender(), spender, value) return true pub fn transfer(self, ctx: Context, to: address, value: u256) -> bool: - self._transfer(ctx, ctx.msg_sender(), to, value) + self._transfer(ctx, from: ctx.msg_sender(), to, value) return true pub fn transferFrom(self, ctx: Context, from: address, to: address, value: u256) -> bool: assert self.allowances[from][ctx.msg_sender()] >= value - self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value self._transfer(ctx, from, to, value) return true - pub fn balanceOf(self, account: address) -> u256: + pub fn balanceOf(self, _ account: address) -> u256: return self.balances[account] pub fn get_reserves(self) -> (u256, u256, u256): @@ -150,7 +151,7 @@ contract UniswapV2Pair: let denominator: u256 = root_k * 5 + root_k_last let liquidity: u256 = numerator / denominator if liquidity > 0: - self._mint(ctx, fee_to, liquidity) + self._mint(ctx, to: fee_to, value: liquidity) elif k_last != 0: self.k_last = 0 @@ -171,13 +172,13 @@ contract UniswapV2Pair: let liquidity: u256 = 0 if total_supply == 0: liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY - self._mint(ctx, address(0), MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens + self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens else: liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" - self._mint(ctx, to, liquidity) + self._mint(ctx, to, value: liquidity) self._update(ctx, balance0, balance1, reserve0, reserve1) if fee_on: @@ -201,7 +202,7 @@ contract UniswapV2Pair: let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" - self._burn(ctx, ctx.self_address(), liquidity) + self._burn(ctx, from: ctx.self_address(), value: liquidity) token0.transfer(to, amount0) token1.transfer(to, amount1) balance0 = token0.balanceOf(ctx.self_address()) @@ -266,22 +267,11 @@ contract UniswapV2Pair: pub fn sync(self, ctx: Context): let token0: ERC20 = ERC20(ctx, self.token0) let token1: ERC20 = ERC20(ctx, self.token1) - self._update(ctx, token0.balanceOf(ctx.self_address()), token1.balanceOf(ctx.self_address()), self.reserve0, self.reserve1) - - fn sqrt(val: u256) -> u256: - let z: u256 - if (val > 3): - z = val - let x: u256 = val / 2 + 1 - while (x < z): - z = x - x = (val / x + x) / 2 - elif (val != 0): - z = 1 - return z - - fn min(x: u256, y: u256) -> u256: - return x if x < y else y + self._update(ctx, + balance0: token0.balanceOf(ctx.self_address()), + balance1: token1.balanceOf(ctx.self_address()), + reserve0: self.reserve0, + reserve1: self.reserve1) contract UniswapV2Factory: fee_to: address @@ -298,7 +288,7 @@ contract UniswapV2Factory: pair: address index: u256 - pub fn __init__(self, fee_to_setter: address): + pub fn __init__(self, _ fee_to_setter: address): self.fee_to_setter = fee_to_setter pub fn fee_to(self) -> address: @@ -310,7 +300,7 @@ contract UniswapV2Factory: pub fn all_pairs_length(self) -> u256: return self.pair_counter - pub fn create_pair(self, ctx: Context, token_a: address, token_b: address) -> address: + pub fn create_pair(self, ctx: Context, _ token_a: address, _ token_b: address) -> address: assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" let token0: address = token_a if token_a < token_b else token_b @@ -337,3 +327,19 @@ contract UniswapV2Factory: pub fn set_fee_to_setter(self, ctx: Context, fee_to_setter: address): assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" self.fee_to_setter = fee_to_setter + + +fn sqrt(_ val: u256) -> u256: + let z: u256 + if (val > 3): + z = val + let x: u256 = val / 2 + 1 + while (x < z): + z = x + x = (val / x + x) / 2 + elif (val != 0): + z = 1 + return z + +fn min(_ x: u256, _ y: u256) -> u256: + return x if x < y else y diff --git a/crates/test-files/fixtures/features/call_statement_with_args.fe b/crates/test-files/fixtures/features/call_statement_with_args.fe index 95c8e65554..ff312cca2f 100644 --- a/crates/test-files/fixtures/features/call_statement_with_args.fe +++ b/crates/test-files/fixtures/features/call_statement_with_args.fe @@ -1,7 +1,7 @@ contract Foo: baz: Map - fn assign(self, val: u256): + fn assign(self, _ val: u256): self.baz[0] = val pub fn bar(self) -> u256: diff --git a/crates/test-files/fixtures/features/call_statement_with_args_2.fe b/crates/test-files/fixtures/features/call_statement_with_args_2.fe index 11a1d35375..44025abb30 100644 --- a/crates/test-files/fixtures/features/call_statement_with_args_2.fe +++ b/crates/test-files/fixtures/features/call_statement_with_args_2.fe @@ -1,7 +1,7 @@ contract Foo: baz: Map - fn assign(self, val: u256) -> u256: + fn assign(self, _ val: u256) -> u256: self.baz[0] = val return val diff --git a/crates/test-files/fixtures/features/ctx_init_in_call.fe b/crates/test-files/fixtures/features/ctx_init_in_call.fe index c6bcae2a76..69c5c52644 100644 --- a/crates/test-files/fixtures/features/ctx_init_in_call.fe +++ b/crates/test-files/fixtures/features/ctx_init_in_call.fe @@ -9,8 +9,8 @@ contract Foo: let value: u256 = u256(bar(ctx)) # return `value` - evm::mstore(0, value) - evm::return_mem(0, 32) + evm::mstore(offset: 0, value) + evm::return_mem(offset: 0, len: 32) fn bar(ctx: Context) -> address: return ctx.self_address() diff --git a/crates/test-files/fixtures/features/ctx_param_external_func_call.fe b/crates/test-files/fixtures/features/ctx_param_external_func_call.fe index 118d766f96..482cca6d32 100644 --- a/crates/test-files/fixtures/features/ctx_param_external_func_call.fe +++ b/crates/test-files/fixtures/features/ctx_param_external_func_call.fe @@ -6,7 +6,7 @@ contract Foo: pub fn baz(ctx: Context) -> u256: return ctx.block_number() - pub fn bing(self, new_num: u256) -> u256: + pub fn bing(self, _ new_num: u256) -> u256: self.my_num = new_num return self.my_num diff --git a/crates/test-files/fixtures/features/pure_fn_standalone.fe b/crates/test-files/fixtures/features/pure_fn_standalone.fe index a9a371c2dc..373f736e31 100644 --- a/crates/test-files/fixtures/features/pure_fn_standalone.fe +++ b/crates/test-files/fixtures/features/pure_fn_standalone.fe @@ -1,18 +1,18 @@ -fn add_bonus(x: u256) -> u256: +fn add_bonus(_ x: u256) -> u256: return x + 10 contract Foo: cool_users: Map points: Map - fn add_points(self, user: address, val: u256): + fn add_points(self, _ user: address, _ val: u256): if self.cool_users[user]: self.points[user] += add_bonus(val) else: self.points[user] += val - pub fn bar(self, x: u256) -> u256: + pub fn bar(self, _ x: u256) -> u256: let a: address = address(x) self.add_points(a, 100) self.cool_users[a] = true diff --git a/crates/test-files/fixtures/features/return_sum_list_expression_2.fe b/crates/test-files/fixtures/features/return_sum_list_expression_2.fe index b856e81ee5..bac099d8b5 100644 --- a/crates/test-files/fixtures/features/return_sum_list_expression_2.fe +++ b/crates/test-files/fixtures/features/return_sum_list_expression_2.fe @@ -3,7 +3,7 @@ contract Foo: pub fn bar(self) -> u256: return count([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) - fn count(values: Array) -> u256: + fn count(_ values: Array) -> u256: let sum: u256 = 0 for i in values: sum = sum + i diff --git a/crates/test-files/fixtures/features/return_u256_from_called_fn_with_args.fe b/crates/test-files/fixtures/features/return_u256_from_called_fn_with_args.fe index 30ee323457..330fd6a652 100644 --- a/crates/test-files/fixtures/features/return_u256_from_called_fn_with_args.fe +++ b/crates/test-files/fixtures/features/return_u256_from_called_fn_with_args.fe @@ -1,7 +1,7 @@ contract Foo: baz: Map - pub fn foo(val1: u256, val2: u256, val3: u256, val4: u256, val5: u256) -> u256: - return val1 + val2 + val3 + val4 + val5 + pub fn foo(_ v1: u256, _ v2: u256, _ v3: u256, _ v4: u256, _ v5: u256) -> u256: + return v1 + v2 + v3 + v4 + v5 pub fn cem() -> u256: return 100 diff --git a/crates/test-files/fixtures/features/revert.fe b/crates/test-files/fixtures/features/revert.fe index 5085bf82d0..e68e17eb27 100644 --- a/crates/test-files/fixtures/features/revert.fe +++ b/crates/test-files/fixtures/features/revert.fe @@ -11,7 +11,7 @@ contract Foo: revert pub fn revert_custom_error(ctx: Context): - ctx.send_value(address(0), 100) + ctx.send_value(to: address(0), wei: 100) pub fn revert_other_error(): revert OtherError(msg: 1, val: true) diff --git a/crates/test-files/fixtures/features/struct_fns.fe b/crates/test-files/fixtures/features/struct_fns.fe index 0f36a52018..c751f40d10 100644 --- a/crates/test-files/fixtures/features/struct_fns.fe +++ b/crates/test-files/fixtures/features/struct_fns.fe @@ -12,7 +12,7 @@ struct Point: pub fn x(self) -> u64: return self.x - pub fn set_x(self, x: u64) -> u64: + pub fn set_x(self, _ x: u64) -> u64: let old: u64 = self.x self.x = x return old @@ -28,14 +28,14 @@ struct Point: self.x += x self.y += y - pub fn add(self, other: Point) -> Point: + pub fn add(self, _ other: Point) -> Point: let x: u64 = self.x + other.x let y: u64 = self.y + other.y return Point(x, y) pub fn do_pointy_things(): let p1: Point = Point.origin() - p1.translate(5, 10) + p1.translate(x: 5, y: 10) let p2: Point = Point(x: 1, y: 2) let p3: Point = p1.add(p2) diff --git a/crates/test-files/fixtures/features/two_contracts.fe b/crates/test-files/fixtures/features/two_contracts.fe index 51f201c7ff..552c27fb4e 100644 --- a/crates/test-files/fixtures/features/two_contracts.fe +++ b/crates/test-files/fixtures/features/two_contracts.fe @@ -10,13 +10,13 @@ contract Foo: self.other.set_foo_addr(ctx.self_address()) return self.other.answer() - pub fn add(x: u256, y: u256) -> u256: + pub fn add(_ x: u256, _ y: u256) -> u256: return x + y contract Bar: other: Foo - pub fn set_foo_addr(self, ctx: Context, addr: address): + pub fn set_foo_addr(self, ctx: Context, _ addr: address): self.other = Foo(ctx, addr) pub fn answer(self) -> u256: diff --git a/crates/test-files/fixtures/ingots/basic_ingot/src/bing.fe b/crates/test-files/fixtures/ingots/basic_ingot/src/bing.fe index ce5491d1b7..e98cb7b3d3 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/bing.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/bing.fe @@ -7,5 +7,5 @@ pub fn get_42_backend() -> u256: return std::evm::add(21, 21) pub contract BingContract: - pub fn add(x: u256, y: u256) -> u256: + pub fn add(_ x: u256, _ y: u256) -> u256: return x + y diff --git a/crates/test-files/fixtures/ingots/pub_contract_ingot/src/foo.fe b/crates/test-files/fixtures/ingots/pub_contract_ingot/src/foo.fe index a61f77a941..a3e230c8dd 100644 --- a/crates/test-files/fixtures/ingots/pub_contract_ingot/src/foo.fe +++ b/crates/test-files/fixtures/ingots/pub_contract_ingot/src/foo.fe @@ -5,5 +5,5 @@ pub struct Bar: pub my_u256: u256 pub contract FooBar: - pub fn add(x: u256, y: u256) -> u256: + pub fn add(_ x: u256, _ y: u256) -> u256: return x + y \ No newline at end of file diff --git a/crates/test-files/fixtures/lowering/and_or.fe b/crates/test-files/fixtures/lowering/and_or.fe index f705820ab2..1ce17444e2 100644 --- a/crates/test-files/fixtures/lowering/and_or.fe +++ b/crates/test-files/fixtures/lowering/and_or.fe @@ -26,29 +26,29 @@ contract Foo: let z: (bool, bool) = (a and b, x or y) - pub fn short_or(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_or(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: return first or second or third or fourth - pub fn short_or2(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_or2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: return (first or second) or (third or fourth) - pub fn short_or3(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_or3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: return (first or second) or third or fourth - pub fn short_and(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_and(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: return first and second and third and fourth - pub fn short_and2(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_and2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: return (first and second) and (third and fourth) - pub fn short_and3(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_and3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: return (first and second) and third and fourth - pub fn short_mixed(first: bool, second: bool, third: bool, fourth: bool) -> bool: + pub fn short_mixed(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: return (first or second) and third or fourth - pub fn baz(val: bool) -> bool: + pub fn baz(_ val: bool) -> bool: return val - pub fn double_baz(val: bool, val2: bool): + pub fn double_baz(_ val: bool, _ val2: bool): pass diff --git a/crates/test-files/fixtures/lowering/struct_fn.fe b/crates/test-files/fixtures/lowering/struct_fn.fe index 4112bae621..318d7e130a 100644 --- a/crates/test-files/fixtures/lowering/struct_fn.fe +++ b/crates/test-files/fixtures/lowering/struct_fn.fe @@ -1,7 +1,7 @@ struct Foo: pub x: u256 - pub fn set_x(self, new: u256) -> u256: + pub fn set_x(self, _ new: u256) -> u256: let old: u256 = self.get_x() self.x = new return old diff --git a/crates/test-files/fixtures/lowering/ternary.fe b/crates/test-files/fixtures/lowering/ternary.fe index dd91317119..88db5a17c3 100644 --- a/crates/test-files/fixtures/lowering/ternary.fe +++ b/crates/test-files/fixtures/lowering/ternary.fe @@ -23,12 +23,11 @@ contract Foo: let b: u256 = 20 let x: u256 = 10 let y: u256 = 20 - - let z: (u256, u256) = (a if true else b, x if true else y) - pub fn baz(val: u256): - pass + let z: (u256, u256) = (a if true else b, x if true else y) - pub fn double_baz(val1: u256, val2: u256): + pub fn baz(_ val: u256): pass + pub fn double_baz(_ val1: u256, _ val2: u256): + pass diff --git a/crates/test-files/fixtures/printing/defs.fe b/crates/test-files/fixtures/printing/defs.fe index a6cfbc46a8..af0d5ebd09 100644 --- a/crates/test-files/fixtures/printing/defs.fe +++ b/crates/test-files/fixtures/printing/defs.fe @@ -38,4 +38,4 @@ contract Foo: contract Bar: pub fn __init__(): - pass \ No newline at end of file + pass diff --git a/crates/test-files/fixtures/printing/expr_parens.fe b/crates/test-files/fixtures/printing/expr_parens.fe index 79b57b6268..bd46f1c89f 100644 --- a/crates/test-files/fixtures/printing/expr_parens.fe +++ b/crates/test-files/fixtures/printing/expr_parens.fe @@ -17,4 +17,4 @@ contract Foo: let big: u256 = 3 * 4 / 5 let test: u256 = 3 ** 4 ** 5 let test2: u256 = (3 ** 4) ** 5 - return -4 * (26 + 52) \ No newline at end of file + return -4 * (26 + 52) diff --git a/crates/test-files/fixtures/printing/guest_book_no_comments.fe b/crates/test-files/fixtures/printing/guest_book_no_comments.fe index 99189d778f..d3136d9beb 100644 --- a/crates/test-files/fixtures/printing/guest_book_no_comments.fe +++ b/crates/test-files/fixtures/printing/guest_book_no_comments.fe @@ -9,4 +9,4 @@ contract GuestBook: emit Signed(book_msg) pub fn get_msg(self, addr: address) -> String<100>: - return self.messages[addr].to_mem() \ No newline at end of file + return self.messages[addr].to_mem() diff --git a/crates/test-files/fixtures/stress/data_copying_stress.fe b/crates/test-files/fixtures/stress/data_copying_stress.fe index a2b9c15393..9db0419e70 100644 --- a/crates/test-files/fixtures/stress/data_copying_stress.fe +++ b/crates/test-files/fixtures/stress/data_copying_stress.fe @@ -74,8 +74,8 @@ contract Foo: self.my_u256.to_mem() ) - fn emit_my_event_internal(ctx: Context, some_string: String<42>, some_u256: u256): - emit MyEvent(ctx, my_string: some_string, my_u256: some_u256) + fn emit_my_event_internal(ctx: Context, _ my_string: String<42>, _ my_u256: u256): + emit MyEvent(ctx, my_string, my_u256) pub fn set_my_addrs(self, my_addrs: Array): self.my_addrs = my_addrs diff --git a/docs/src/spec/expressions/call.md b/docs/src/spec/expressions/call.md index 6cdb907b94..769d6f1cf1 100644 --- a/docs/src/spec/expressions/call.md +++ b/docs/src/spec/expressions/call.md @@ -17,7 +17,7 @@ > _CallArgLabel_ :\ >    [IDENTIFIER]Label must correspond to the name of the called function argument at the given position. It can be omitted if parameter name and the name of the called function argument are equal. -A *call expression* calls a function. The syntax of a call expression is an [expression], followed by a parenthesized comma-separated list of call arguments. Call arguments are expressions which optionally may be labeled in which case the label must correspond to name of the function argument at the given position. Labels do **not allow** to change the order in which parameters can be applied to a function. If the function eventually returns, then the expression completes. +A *call expression* calls a function. The syntax of a call expression is an [expression], followed by a parenthesized comma-separated list of call arguments. Call arguments are expressions, and must be labeled and provided in the order specified in the [function definition]. If the function eventually returns, then the expression completes. Example: @@ -25,10 +25,12 @@ Example: ```python contract Foo: - pub fn baz(): - bar(100, val2: 300) + pub fn demo(self): + let ann: address = address(0xaa) + let bob: address = address(0xbb) + self.transfer(from: ann, to: bob, 25) - pub fn bar(val1: u256, val2: u256): + pub fn transfer(self, from: address, to: address, _ val: u256): pass ``` @@ -36,3 +38,4 @@ contract Foo: [expression]: ./index.md [IDENTIFIER]: ../lexical_structure/identifiers.md [INTEGER_LITERAL]: ../lexical_structure/tokens.md#integer-literals +[function definition]: ../items/functions.md diff --git a/docs/src/spec/expressions/tuple.md b/docs/src/spec/expressions/tuple.md index 86628e0c2d..123d0971af 100644 --- a/docs/src/spec/expressions/tuple.md +++ b/docs/src/spec/expressions/tuple.md @@ -40,7 +40,7 @@ contract Foo: let some_tuple: (u256, bool) = (1, false) # Accessing the first tuple field via the `item0` field - baz(some_tuple.item0) + baz(input: some_tuple.item0) pub fn baz(input: u256): pass @@ -50,4 +50,4 @@ contract Foo: [expression]: ./index.md [IDENTIFIER]: ../lexical_structure/identifiers.md [tuple values]: ../type_system/types/tuple.md -[attribute expression]: ./attribute.md \ No newline at end of file +[attribute expression]: ./attribute.md diff --git a/docs/src/spec/items/functions.md b/docs/src/spec/items/functions.md index a7358913af..ee5bfcfc98 100644 --- a/docs/src/spec/items/functions.md +++ b/docs/src/spec/items/functions.md @@ -33,7 +33,10 @@ >    `self`? | `self,`? _FunctionParam_ (`,` _FunctionParam_)\* `,`? > > _FunctionParam_ :\ ->    [IDENTIFIER] `:` [_Types_] +>    _FunctionParamLabel_? [IDENTIFIER] `:` [_Types_] +> +> _FunctionParamLabel_ :\ +>    _ | [IDENTIFIER] > > _FunctionReturnType_ :\ >    `->` [_Types_] @@ -41,7 +44,7 @@ A _function_ definition consists of name and code block along with an optional list of parameters and return value. Functions are declared with the -keyword `fn`. Functions may declare a set of *input* arguments, +keyword `fn`. Functions may declare a set of *input* parameters, through which the caller passes arguments into the function, and the *output* [*type*][_Types_] of the value the function will return to its caller on completion. @@ -55,26 +58,84 @@ A function header ends with a colon (`:`) after which the function body begins. For example, this is a simple function: ```python -fn answer_to_life_the_universe_and_everything() -> u256: - return 42 +fn add(x: u256, y: u256) -> u256: + return x + y ``` -A function may accept `self` as a parameter. This gives the function the ability -to read and mutate contract storage. +Functions can be defined inside of a contract, inside of a struct, or at the +"top level" of a module (that is, not nested within another item). Example: ```python -contract Foo: - my_stored_num: u256 - - pub fn my_pure_func(): - pass - - pub fn my_self_func(self): - self.my_stored_num = 26 +fn add(_ x: u256, _ y: u256) -> u256: + return x + y + +contract CoolCoin: + balance: Map + + fn transfer(self, from sender: address, to recipient: address, value: u256) -> bool: + if self.balance[sender] < value: + return false + self.balance[sender] -= value + self.balance[recipient] += value + return true + + pub fn demo(self): + let ann: address = address(0xaa) + let bob: address = address(0xbb) + self.balance[ann] = 100 + + let bonus: u256 = 2 + let value: u256 = add(10, bonus) + let ok: bool = self.transfer(from: ann, to: bob, value) +``` + +Function parameters have optional labels. When a function is called, the +arguments must be labeled and provided in the order specified in the +function definition. + +The label of a parameter defaults to the parameter name; a different label +can be specified by adding an explicit label prior to the parameter name. +For example: +``` +fn encrypt(msg cleartext: u256, key: u256) -> u256: + return cleartext ^ key + +fn demo(): + let out: u256 = encrypt(msg: 0xdecafbad, key: 0xfefefefe) ``` +Here, the first parameter of the `encrypt` function has the label `msg`, +which is used when calling the function, while the parameter name is +`cleartext`, which is used inside the function body. The parameter name +is an implementation detail of the function, and can be changed without +modifying any function calls, as long as the label remains the same. + +When calling a function, a label can be omitted when the argument is +a variable with a name that matches the parameter label. Example: +``` +let msg: u256 = 0xdecafbad +let cyf: u256 = encrypt(msg, key: 0x1234) +``` + +A parameter can also be specified to have no label, by using `_` in place of a +label in the function definition. In this case, when calling the function, the +corresponding argument must not be labeled. Example: +``` +fn add(_ x: u256, _ y: u256) -> u256: + return x + y + +fn demo(): + let sum: u256 = add(16, 32) +``` + +Functions defined inside of a contract or struct may take `self` as a +parameter. This gives the function the ability to read and write contract +storage or struct fields, respectively. If a function takes `self` +as a parameter, the function must be called via `self`. For example: +`let ok: bool = self.transfer(from, to, value)` + [NEWLINE]: ../lexical_structure/tokens.md#newline [INDENT]: ../lexical_structure/tokens.md#indent [DEDENT]: ../lexical_structure/tokens.md#dedent @@ -95,4 +156,4 @@ contract Foo: [_BreakStatement_]: ../statements/break.md [_ContinueStatement_]: ../statements/continue.md [_RevertStatement_]: ../statements/revert.md -[_Expression_]: ../expressions/index.md \ No newline at end of file +[_Expression_]: ../expressions/index.md diff --git a/newsfragments/397.feature.md b/newsfragments/397.feature.md new file mode 100644 index 0000000000..9ab16e359d --- /dev/null +++ b/newsfragments/397.feature.md @@ -0,0 +1,50 @@ +Labels are now required on function arguments. Labels can be omitted if the +argument is a variable with a name that matches the label, or if the function +definition specifies that an argument should have no label. Functions often take +several arguments of the same type; compiler-checked labels can help prevent +accidentally providing arguments in the wrong order. + +Example: +``` +contract CoolCoin: + balance: Map + loans: Map<(address, address), i256> + + pub fn demo(self, ann: address, bob: address): + let is_loan: bool = false + self.give(from: ann, to: bob, 100, is_loan) + + fn transfer(self, from sender: address, to recipient: address, _ val: u256, is_loan: bool): + self.cred[sender] -= val + self.cred[recipient] += val + if is_loan: + self.loans[(sender, recipient)] += val +``` + +Note that arguments must be provided in the order specified in the function +definition. + +A parameter's label defaults to the parameter name, but can be changed by +specifying a different label to the left of the parameter name. Labels should be +clear and convenient for the caller, while parameter names are only used in the +function body, and can thus be longer and more descriptive. +In the example above, we choose to use `sender` and `recipient` as identifiers +in the body of `fn transfer`, but use labels `from:` and `to:`. + +In cases where it's ideal to not have labels, e.g. if a function takes a single +argument, or if types are sufficient to differentiate between arguments, use `_` +to specify that a given parameter has no label. It's also fine to require labels +for some arguments, but not others. + +Example: +``` +fn add(_ x: u256, _ y: u256) -> u256: + return x + y + +contract Foo: + fn transfer(self, _ to: address, wei: u256): + pass + + pub fn demo(self): + transfer(address(0), wei: add(1000, 42)) +```