diff --git a/.github/workflows/master-push.yml b/.github/workflows/master-push.yml deleted file mode 100644 index 8fd35489f..000000000 --- a/.github/workflows/master-push.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: 'Master Push' -on: - push: - branches: - - master - -jobs: - - release: - name: 'Publish Release' - runs-on: ubuntu-latest - environment: production - steps: - - name: 'Check out code' - uses: actions/checkout@v3 - with: - ref: ${{ github.event.push.head.sha }} - fetch-depth: 0 - - name: 'Make release' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -x - VERSION=v$(cat package/version) - gh release create ${VERSION} --target ${{ github.sha }} - - name: 'Update dependents' - run: | - set -x - version="$(cat package/version)" - curl --fail \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.JENKINS_GITHUB_PAT }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/runtimeverification/devops/dispatches \ - -d '{"event_type":"on-demand-test","client_payload":{"repo":"runtimeverification/wasm-semantics","version":"'${version}'"}}' - - nix-cache: - name: 'Populate Nix Cache' - strategy: - matrix: - include: - - runner: normal - - runner: ARM64 - runs-on: ${{ matrix.runner }} - steps: - - name: 'Check out code' - uses: actions/checkout@v3 - with: - ref: ${{ github.event.push.head.sha }} - fetch-depth: 0 - - name: 'Upgrade bash' - if: ${{ contains(matrix.os, 'macos') }} - run: brew install bash - - name: 'Build and cache KWASM' - uses: workflow/nix-shell-action@v3.0.3 - env: - GC_DONT_GC: 1 - CACHIX_AUTH_TOKEN: '${{ secrets.CACHIX_PUBLIC_TOKEN }}' - with: - packages: jq - script: | - kwasm=$(nix build --extra-experimental-features 'nix-command flakes' .#kwasm --json | jq -r '.[].outputs | to_entries[].value') - drv=$(nix-store --query --deriver ${kwasm}) - nix-store --query --requisites --include-outputs ${drv} | cachix push k-framework diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 281a80a6a..77af7161d 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -1,6 +1,9 @@ name: 'Run Tests' on: pull_request: + push: + branches: + - 'master-update' workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -8,41 +11,14 @@ concurrency: jobs: - version-bump: - name: 'Version Bump' - runs-on: [self-hosted, linux, flyweight-ephemeral] - steps: - - name: 'Check out code' - uses: actions/checkout@v3 - with: - token: ${{ secrets.JENKINS_GITHUB_PAT }} - # fetch-depth 0 means deep clone the repo - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - name: 'Configure GitHub user' - run: | - git config user.name devops - git config user.email devops@runtimeverification.com - - name: 'Update version' - run: | - og_version=$(git show origin/${GITHUB_BASE_REF}:package/version) - ./package/version.sh bump ${og_version} - ./package/version.sh sub - new_version=$(cat package/version) - git add --update && git commit --message "Set Version: ${new_version}" || true - - name: 'Push updates' - run: git push origin HEAD:${GITHUB_HEAD_REF} - pykwasm-code-quality-checks: name: 'Code Quality Checks' runs-on: ubuntu-latest steps: - name: 'Check out code' - uses: actions/checkout@v3 - with: - submodules: recursive + uses: actions/checkout@v4 - name: 'Install Poetry' - uses: Gr1N/setup-poetry@v8 + uses: Gr1N/setup-poetry@v9 - name: 'Build pykwasm' run: poetry -C pykwasm install - name: 'Run code quality checks' @@ -82,52 +58,3 @@ jobs: if: always() run: | docker stop --time=0 kwasm-ci-conformance-${GITHUB_SHA} - - prove-tests: - name: 'Prover Tests' - needs: pykwasm-code-quality-checks - runs-on: [self-hosted, linux, normal] - timeout-minutes: 30 - steps: - - name: 'Check out code' - uses: actions/checkout@v3 - with: - submodules: recursive - - name: 'Set up Docker' - uses: ./.github/actions/with-docker - with: - container-name: kwasm-ci-prove-${{ github.sha }} - - name: 'Build pykwasm' - run: docker exec -u user kwasm-ci-prove-${GITHUB_SHA} poetry -C pykwasm install - - name: 'Build Haskell definitions' - run: docker exec -u user kwasm-ci-prove-${GITHUB_SHA} poetry -C pykwasm run kdist -v build wasm-semantics.{kwasm-lemmas,wrc20} -j2 - - name: 'Run prover tests' - run: docker exec -u user kwasm-ci-prove-${GITHUB_SHA} make -j6 test-prove - - name: 'Tear down Docker' - if: always() - run: | - docker stop --time=0 kwasm-ci-prove-${GITHUB_SHA} - - nix: - name: 'Nix' - strategy: - fail-fast: false - matrix: - include: - - runner: normal - - runner: ARM64 - needs: pykwasm-code-quality-checks - runs-on: ${{ matrix.runner }} - timeout-minutes: 60 - steps: - - name: 'Check out code' - uses: actions/checkout@v3 - with: - # Check out pull request HEAD instead of merge commit. - ref: ${{ github.event.pull_request.head.sha }} - - name: 'Build KWASM' - run: GC_DONT_GC=1 nix build .#kwasm --extra-experimental-features 'nix-command flakes' --print-build-logs - - name: 'Build KWASM-Pyk' - run: GC_DONT_GC=1 nix build .#kwasm-pyk --extra-experimental-features 'nix-command flakes' --print-build-logs - - name: 'Test KWASM' - run: GC_DONT_GC=1 nix build .#kwasm-test --extra-experimental-features 'nix-command flakes' --print-build-logs diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 566f84162..b1daeeec1 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: 'Check out code' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive token: ${{ secrets.JENKINS_GITHUB_PAT }} @@ -24,30 +24,11 @@ jobs: git config user.email devops@runtimeverification.com - name: 'Install Poetry' uses: Gr1N/setup-poetry@v8 - - name: 'Install Nix' - uses: cachix/install-nix-action@v22 - with: - install_url: https://releases.nixos.org/nix/nix-2.13.3/install - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - substituters = http://cache.nixos.org https://hydra.iohk.io - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= - - name: 'Install Cachix' - uses: cachix/cachix-action@v14 - with: - name: k-framework - authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}' - name: 'Update pyk release tag' run: | K_VERSION=$(cat deps/k_release) sed -i 's!kframework = "[v0-9\.]*"!kframework = "'${K_VERSION}'"!' pykwasm/pyproject.toml poetry -C pykwasm update git add pykwasm/ && git commit -m "pykwasm/: sync poetry files ${K_VERSION}" || true - - name: 'Update Nix flake inputs' - run: | - K_VERSION=v"$(cat deps/k_release)" - sed -i 's! k-framework.url = "github:runtimeverification/k/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+"! k-framework.url = "github:runtimeverification/k/'"${K_VERSION}"'"!' flake.nix - nix flake update - git add flake.nix flake.lock && git commit -m 'flake.{nix,lock}: update Nix derivations' || true - name: 'Push updates' run: git push diff --git a/pykwasm/src/pykwasm/kdist/plugin.py b/pykwasm/src/pykwasm/kdist/plugin.py index 97d1f9554..62d96f1fd 100644 --- a/pykwasm/src/pykwasm/kdist/plugin.py +++ b/pykwasm/src/pykwasm/kdist/plugin.py @@ -30,8 +30,16 @@ def __init__(self, kompile_args: Callable[[Path], Mapping[str, Any]]): self._kompile_args = kompile_args def build(self, output_dir: Path, deps: dict[str, Path], args: dict[str, Any], verbose: bool) -> None: + llvm_proof_hint_debugging = bool(args.get('llvm-proof-hint-debugging', '')) + llvm_proof_hint_instrumentation = bool(args.get('llvm-proof-hint-instrumentation', '')) kompile_args = self._kompile_args(deps['wasm-semantics.source']) - kompile(output_dir=output_dir, verbose=verbose, **kompile_args) + kompile( + output_dir=output_dir, + verbose=verbose, + llvm_proof_hint_debugging=llvm_proof_hint_debugging, + llvm_proof_hint_instrumentation=llvm_proof_hint_instrumentation, + **kompile_args, + ) def context(self) -> dict[str, str]: return {'k-version': k_version().text} diff --git a/pykwasm/src/pykwasm/kdist/wasm-semantics/auxil.md b/pykwasm/src/pykwasm/kdist/wasm-semantics/auxil.md index 1ed01b680..2374dcf8c 100644 --- a/pykwasm/src/pykwasm/kdist/wasm-semantics/auxil.md +++ b/pykwasm/src/pykwasm/kdist/wasm-semantics/auxil.md @@ -24,7 +24,7 @@ module WASM-AUXIL #clearConfig => .K ... _ => .Int _ => .ValStack - _ => .Map + _ => .List _ => .Bag _ => .Map _ => 0 @@ -34,8 +34,7 @@ module WASM-AUXIL _ => .Bag _ => 0 _ => .Bag - _ => 0 - _ => .Bag + _ => .List _ => 0 _ => .Bag _ => 0 diff --git a/pykwasm/src/pykwasm/kdist/wasm-semantics/test.md b/pykwasm/src/pykwasm/kdist/wasm-semantics/test.md index a9a27dc59..a83d11f14 100644 --- a/pykwasm/src/pykwasm/kdist/wasm-semantics/test.md +++ b/pykwasm/src/pykwasm/kdist/wasm-semantics/test.md @@ -430,7 +430,8 @@ The operator `#assertLocal`/`#assertGlobal` operators perform a check for a loca ```k rule #assertLocal INDEX VALUE _ => .K ... - ... INDEX |-> VALUE ... + LOCALS + requires LOCALS[INDEX] ==K VALUE rule #assertGlobal TFIDX VALUE _ => .K ... CUR @@ -569,18 +570,12 @@ This checks that the last allocated memory has the given size and max value. CUR IDS - #ContextLookup(IDS, TFIDX) |-> ADDR + ListItem(ADDR) ... - - - ADDR - MAX - SIZE - ... - - ... - + MEMS + requires ADDR #assertMemoryData (KEY , VAL) MSG => #assertMemoryData CUR (KEY, VAL) MSG ... CUR @@ -588,18 +583,12 @@ This checks that the last allocated memory has the given size and max value. rule #assertMemoryData MODIDX (KEY , VAL) _MSG => .K ... MODIDX - 0 |-> ADDR + ListItem(ADDR) ... - - - ADDR - BM - ... - - ... - - requires #getRange(BM, KEY, 1) ==Int VAL + MEMS + requires ADDR (#block(VT:VecType, IS:Instrs, BLOCKINFO)) => #block(VT, #t2aInstrs(IS), BLOCKINFO) - rule #t2aInstr<_>(init_local I V) => init_local I V rule #t2aInstr<_>(init_locals VS) => init_locals VS ``` diff --git a/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm.md b/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm.md index 3a6b438d6..99e296fae 100644 --- a/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm.md +++ b/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm.md @@ -165,10 +165,9 @@ Internal Syntax module WASM-INTERNAL-SYNTAX imports WASM-DATA-INTERNAL-SYNTAX - syntax Instr ::= "init_local" Int Val - | "init_locals" ValStack - | "#init_locals" Int ValStack - // -------------------------------------------- + syntax Instr ::= "init_locals" ValStack + | "#init_locals" ValStack + // ---------------------------------------- syntax Int ::= #pageSize() [function, total] syntax Int ::= #maxMemorySize() [function, total] @@ -202,8 +201,8 @@ module WASM .K .ValStack - .Map - .Int + .List + .Int .Map .Map @@ -219,7 +218,7 @@ module WASM .Map 0 .Map - .Map + .List .Map .Map 0 @@ -258,15 +257,7 @@ module WASM 0 - - - 0 - .Int - 0 - .SparseBytes - - - 0 + .List 0 @@ -560,17 +551,15 @@ Variable Operators The various `init_local` variants assist in setting up the `locals` cell. ```k - rule init_local INDEX VALUE => .K ... - LOCALS => LOCALS [ INDEX <- VALUE ] + rule init_locals VALUES => #init_locals VALUES ... + _ => .List - rule init_locals VALUES => #init_locals 0 VALUES ... - - rule #init_locals _ .ValStack => .K ... - rule #init_locals N (VALUE : VALSTACK) - => init_local N VALUE - ~> #init_locals (N +Int 1) VALSTACK + rule #init_locals .ValStack => .K ... + rule #init_locals (VALUE : VALSTACK) + => #init_locals VALSTACK ... + ... .List => ListItem(VALUE) ``` The `*_local` instructions are defined here. @@ -581,18 +570,18 @@ The `*_local` instructions are defined here. | "#local.tee" "(" Int ")" [symbol(aLocal.tee)] // ---------------------------------------------------------------------- rule #local.get(I) => .K ... - VALSTACK => VALUE : VALSTACK - ... I |-> VALUE ... + VALSTACK => {LOCALS [ I ]}:>Val : VALSTACK + LOCALS rule #local.set(I) => .K ... VALUE : VALSTACK => VALSTACK LOCALS => LOCALS[I <- VALUE] - requires I in_keys(LOCALS) + requires I >=Int 0 andBool I #local.tee(I) => .K ... VALUE : _VALSTACK LOCALS => LOCALS[I <- VALUE] - requires I in_keys(LOCALS) + requires I >=Int 0 andBool I ` cell), and Unlike labels, only one frame can be "broken" through at a time. ```k - syntax Frame ::= "frame" Int ValTypes ValStack Map - // -------------------------------------------------- + syntax Frame ::= "frame" Int ValTypes ValStack List + // --------------------------------------------------- rule frame MODIDX' TRANGE VALSTACK' LOCAL' => .K ... VALSTACK => #take(lengthValTypes(TRANGE), VALSTACK) ++ VALSTACK' _ => LOCAL' @@ -1198,7 +1187,7 @@ The `#take` function will return the parameter stack in the reversed order, then ... VALSTACK => .ValStack - LOCAL => .Map + LOCAL MODIDX => MODIDX' FADDR @@ -1355,7 +1344,8 @@ The importing and exporting parts of specifications are dealt with in the respec ```k syntax MemoryDefn ::= #memory(limits: Limits, metadata: OptionalId) [symbol(aMemoryDefn)] syntax Alloc ::= allocmemory (OptionalId, Int, OptionalInt) - // ----------------------------------------------------------- + syntax KItem ::= memInst(mmax: OptionalInt, msize: Int, mdata: SparseBytes) + // --------------------------------------------------------------------------- rule #memory(... limits: #limitsMin(MIN), metadata: OID) => allocmemory(OID, MIN, .Int) ... requires MIN <=Int #maxMemorySize() rule #memory(... limits: #limits(MIN, MAX), metadata: OID) => allocmemory(OID, MIN, MAX) ... @@ -1367,21 +1357,10 @@ The importing and exporting parts of specifications are dealt with in the respec CUR IDS => #saveId(IDS, ID, 0) - .Map => (0 |-> NEXTADDR) + .List => ListItem(size(MEMS)) ... - NEXTADDR => NEXTADDR +Int 1 - - ( .Bag - => - NEXTADDR - MAX - MIN - ... - - ) - ... - + MEMS => MEMS ListItem(memInst(MAX, MIN, .SparseBytes)) ``` The assorted store operations take an address of type `i32` and a value. @@ -1399,36 +1378,27 @@ The value is encoded as bytes and stored at the "effective address", which is th rule #store(ITYPE:IValType, SOP, OFFSET) => ITYPE . SOP (IDX +Int OFFSET) VAL ... < ITYPE > VAL : < i32 > IDX : VALSTACK => VALSTACK - rule store { WIDTH EA VAL } => store { WIDTH EA VAL ({MEMADDRS[0] orDefault 0}:>Int) } ... + rule store { WIDTH EA VAL } => store { WIDTH EA VAL ADDR } ... CUR CUR - MEMADDRS + ListItem(ADDR) ... - requires 0 in_keys(MEMADDRS) andBool size(MEMADDRS) ==Int 1 andBool isInt(MEMADDRS[0] orDefault 0) - [preserves-definedness] rule store { WIDTH EA VAL ADDR } => .K ... - - ADDR - SIZE - DATA => #setRange(DATA, EA, VAL, #numBytes(WIDTH)) - ... - - requires (EA +Int #numBytes(WIDTH)) <=Int (SIZE *Int #pageSize()) + MEMS => MEMS [ ADDR <- #let memInst(MAX, SIZE, DATA) = MEMS[ADDR] #in memInst(MAX, SIZE, #setRange(DATA, EA, VAL, #numBytes(WIDTH))) ] + requires ADDR store { WIDTH EA _ ADDR } => trap ... - - ADDR - SIZE - ... - - requires (EA +Int #numBytes(WIDTH)) >Int (SIZE *Int #pageSize()) + MEMS + requires ADDR Int (msize(MEMS[ADDR]) *Int #pageSize()) rule ITYPE . store EA VAL => store { ITYPE EA VAL } ... rule _ . store8 EA VAL => store { i8 EA #wrap(1, VAL) } ... @@ -1460,32 +1430,23 @@ Sort `Signedness` is defined in module `BYTES`. rule ITYPE . load16_s EA:Int => load { ITYPE i16 EA Signed } ... rule i64 . load32_s EA:Int => load { i64 i32 EA Signed } ... - rule load { ITYPE WIDTH EA SIGN } => load { ITYPE WIDTH EA SIGN ({MEMADDRS[0] orDefault 0}:>Int)} ... + rule load { ITYPE WIDTH EA SIGN } => load { ITYPE WIDTH EA SIGN ADDR:Int } ... CUR CUR - MEMADDRS + ListItem(ADDR) ... - requires 0 in_keys(MEMADDRS) andBool size(MEMADDRS) ==Int 1 andBool isInt(MEMADDRS[0] orDefault 0) - [preserves-definedness] - rule load { ITYPE WIDTH EA SIGN ADDR:Int} => load { ITYPE WIDTH EA SIGN DATA } ... - - ADDR - SIZE - DATA - ... - - requires (EA +Int #numBytes(WIDTH)) <=Int (SIZE *Int #pageSize()) + rule load { ITYPE WIDTH EA SIGN ADDR:Int} => load { ITYPE WIDTH EA SIGN mdata(MEMS[ADDR]) } ... + MEMS + requires ADDR load { _ WIDTH EA _ ADDR:Int} => trap ... - - ADDR - SIZE - ... - - requires (EA +Int #numBytes(WIDTH)) >Int (SIZE *Int #pageSize()) + MEMS + requires ADDR Int (msize(MEMS[ADDR]) *Int #pageSize()) rule load { ITYPE WIDTH EA Signed DATA:SparseBytes } => #chop(< ITYPE > #signed(WIDTH, #getRange(DATA, EA, #numBytes(WIDTH)))) ... [preserves-definedness] @@ -1500,18 +1461,15 @@ The `size` operation returns the size of the memory, measured in pages. [Memory Size](https://webassembly.github.io/spec/core/exec/instructions.html#xref-syntax-instructions-syntax-instr-memory-mathsf-memory-size) ```k - rule memory.size => < i32 > SIZE ... + rule memory.size => < i32 > msize(MEMS[ADDR]) ... CUR CUR - 0 |-> ADDR + ListItem(ADDR) ... - - ADDR - SIZE - ... - + MEMS + requires ADDR ` field in the configuration to `true rule memory.grow => grow N ... < i32 > N : VALSTACK => VALSTACK - rule grow N => < i32 > SIZE ... + rule grow N => < i32 > msize(MEMS[ADDR]) ... CUR CUR - 0 |-> ADDR + ListItem(ADDR) ... - - ADDR - MAX - SIZE => SIZE +Int N - ... - - requires #growthAllowed(SIZE +Int N, MAX) + MEMS => #let memInst(MAX, SIZE, DATA) = MEMS[ADDR] #in MEMS[ADDR <- memInst(MAX, SIZE +Int N, DATA)] + requires ADDR grow N => < i32 > #unsigned(i32, -1) ... DET:Bool CUR CUR - 0 |-> ADDR + ListItem(ADDR) ... - - ADDR - MAX - SIZE - ... - - requires notBool DET - orBool notBool #growthAllowed(SIZE +Int N, MAX) + MEMS + requires ADDR CUR CUR - 0 |-> ADDR + ListItem(ADDR) ... - - ADDR - SIZE - ... - - requires N +Int D >Int SIZE *Int #pageSize() + MEMS + requires ADDR Int SIZE *Int #pageSize()) rule fillTrap N VAL D => fill N VAL D ... [owise] @@ -1610,15 +1557,11 @@ The spec states that this is really a sequence of `i32.store8` instructions, but CUR CUR - 0 |-> ADDR + ListItem(ADDR) ... - - ADDR - DATA => replaceAt(DATA, D, padRightBytes(.Bytes, N, VAL)) - ... - - requires notBool N ==Int 0 + MEMS => MEMS [ ADDR <- #let memInst(MAX, SIZE, DATA) = MEMS[ADDR] #in memInst(MAX, SIZE, replaceAt(DATA, D, padRightBytes(.Bytes, N, VAL))) ] + requires ADDR CUR CUR - 0 |-> ADDR + ListItem(ADDR) ... - - ADDR - SIZE - ... - - requires D +Int N >Int SIZE *Int #pageSize() - orBool S +Int N >Int SIZE *Int #pageSize() + MEMS + requires ADDR Int SIZE *Int #pageSize() + orBool S +Int N >Int SIZE *Int #pageSize()) rule copyTrap N S D => copy N S D ... [owise] @@ -1657,15 +1597,11 @@ performing a series of load and store operations as stated in the spec. CUR CUR - 0 |-> ADDR + ListItem(ADDR) ... - - ADDR - DATA => replaceAt(DATA, D, #getBytesRange(DATA, S, N)) - ... - - requires notBool N ==Int 0 + MEMS => MEMS [ ADDR <- #let memInst(MAX, SIZE, DATA) = MEMS[ADDR] #in memInst(MAX, SIZE, replaceAt(DATA, D, #getBytesRange(DATA, S, N))) ] + requires ADDR #data(IDX, IS, DATA) => sequenceInstrs(IS) ~> data { IDX DATA } ... - rule data { MEMIDX DSBYTES } => trap ... + rule data { 0 DSBYTES } => trap ... < i32 > OFFSET : _STACK CUR CUR - MEMIDX |-> ADDR + ListItem(ADDR) ... - - ADDR - SIZE - ... - - requires OFFSET +Int lengthBytes(DSBYTES) >Int SIZE *Int #pageSize() + MEMS + requires ADDR Int SIZE *Int #pageSize()) // For now, deal only with memory 0. - rule data { MEMIDX DSBYTES } => .K ... + rule data { 0 DSBYTES } => .K ... < i32 > OFFSET : STACK => STACK CUR CUR - MEMIDX |-> ADDR + ListItem(ADDR) ... - - ADDR - DATA => #setRange(DATA, OFFSET, Bytes2Int(DSBYTES, LE, Unsigned), lengthBytes(DSBYTES)) - ... - + MEMS => #let memInst(MAX, SIZE, DATA) = MEMS[ADDR] #in MEMS [ ADDR <- memInst(MAX, SIZE, #setRange(DATA, OFFSET, Bytes2Int(DSBYTES, LE, Unsigned), lengthBytes(DSBYTES))) ] + requires ADDR CUR IDS => #saveId(IDS, OID, 0) - .Map => 0 |-> ADDR + .List => ListItem(ADDRS[#ContextLookup(IDS', TFIDX)]) ... ... MOD |-> MODIDX ... MODIDX IDS' - ... #ContextLookup(IDS' , TFIDX) |-> ADDR ... + ADDRS ... NAME |-> TFIDX ... ... - - ADDR - MAX - SIZE - ... - - requires #limitsMatchImport(SIZE, MAX, LIM) + MEMS + requires #ContextLookup(IDS', TFIDX) Int Int] #in #limitsMatchImport(SIZE, MAX, LIM)) rule #import(MOD, NAME, #globalDesc(... id: OID, type: MUT TYP) ) => .K ... CUR diff --git a/tests/success-llvm.out b/tests/success-llvm.out index 0eae581e8..2dee704ab 100644 --- a/tests/success-llvm.out +++ b/tests/success-llvm.out @@ -11,7 +11,7 @@ - .Map + .List .Int @@ -43,11 +43,8 @@ 0 - .MemInstCellMap + .List - - 0 - .GlobalInstCellMap diff --git a/tests/ulm/erc20/Makefile b/tests/ulm/erc20/Makefile new file mode 100644 index 000000000..c43f5b118 --- /dev/null +++ b/tests/ulm/erc20/Makefile @@ -0,0 +1,3 @@ +erc20.rust.wat: rust/src/*.rs rust/Cargo.toml + cd rust && cargo build --target=wasm32-unknown-unknown + wasm2wat rust/target/wasm32-unknown-unknown/debug/erc20.wasm -o $@ diff --git a/tests/ulm/erc20/erc20.rust.wat b/tests/ulm/erc20/erc20.rust.wat new file mode 100644 index 000000000..4c495a68f --- /dev/null +++ b/tests/ulm/erc20/erc20.rust.wat @@ -0,0 +1,5905 @@ +(module $erc20.wasm + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32 i32))) + (type (;2;) (func (param i32) (result i32))) + (type (;3;) (func (param i32 i32 i32) (result i32))) + (type (;4;) (func (result i32))) + (type (;5;) (func (param i64) (result i32))) + (type (;6;) (func (param i32 i32 i32 i32))) + (type (;7;) (func (param i32))) + (type (;8;) (func (param i32 i32) (result i64))) + (type (;9;) (func (param i32 i32 i32 i32 i32))) + (type (;10;) (func (param i32 i32 i32))) + (type (;11;) (func)) + (import "env" "SetAccountStorage" (func $SetAccountStorage (type 1))) + (import "env" "GetAccountStorage" (func $GetAccountStorage (type 2))) + (import "env" "fingerprint" (func $fingerprint (type 2))) + (import "env" "bytesLength" (func $bytesLength (type 2))) + (import "env" "bytesSubstr" (func $bytesSubstr (type 3))) + (import "env" "cmpBytes" (func $cmpBytes (type 0))) + (import "env" "newEncoder" (func $newEncoder (type 4))) + (import "env" "u256FromU64" (func $u256FromU64 (type 5))) + (import "env" "encoderAddU256" (func $encoderAddU256 (type 0))) + (import "env" "encoderToBytes" (func $encoderToBytes (type 2))) + (import "env" "intSub" (func $intSub (type 0))) + (import "env" "intAdd" (func $intAdd (type 0))) + (import "env" "cmpInt" (func $cmpInt (type 0))) + (import "env" "u256FromBytes" (func $u256FromBytes (type 2))) + (import "env" "decoderFromBuffer" (func $decoderFromBuffer (type 2))) + (import "env" "decoderValueCount" (func $decoderValueCount (type 2))) + (import "env" "isValidDecoder" (func $isValidDecoder (type 2))) + (import "env" "fail" (func $fail (type 1))) + (import "env" "signatureFingerprint" (func $signatureFingerprint (type 0))) + (import "env" "encoderAddStr" (func $encoderAddStr (type 3))) + (import "env" "u160FromU64" (func $u160FromU64 (type 5))) + (import "env" "u256FromIntId" (func $u256FromIntId (type 2))) + (import "env" "u160FromIntId" (func $u160FromIntId (type 2))) + (import "env" "Caller" (func $Caller (type 4))) + (import "env" "Log3" (func $Log3 (type 6))) + (import "env" "CallData" (func $CallData (type 4))) + (import "env" "SetOutput" (func $SetOutput (type 7))) + (import "env" "decoderRegister" (func $decoderRegister (type 3))) + (import "env" "decodeExtractBytes" (func $decodeExtractBytes (type 0))) + (func $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3new17haccb738ecb8c3fc6E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + local.get 3 + local.get 0 + i32.store offset=8 + local.get 3 + i32.load offset=8 + local.set 4 + local.get 4 + return) + (func $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3set17h32ecd24cf2981267E (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=4 + local.get 4 + local.get 1 + i32.store offset=8 + local.get 1 + call $_ZN88_$LT$erc20..balance..Balance$u20$as$u20$core..convert..Into$LT$erc20..u256..U256$GT$$GT$4into17hedbef66d4283e5e0E + local.set 5 + local.get 4 + local.get 5 + i32.store offset=12 + local.get 0 + i32.load + local.set 6 + local.get 6 + local.get 5 + call $SetAccountStorage + i32.const 16 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + return) + (func $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=8 + local.get 0 + i32.load + local.set 4 + local.get 4 + call $GetAccountStorage + local.set 5 + local.get 3 + local.get 5 + i32.store offset=12 + local.get 5 + call $_ZN5erc204u2564U2567from_id17h803f5db381600ddeE + local.set 6 + i32.const 1048596 + local.set 7 + local.get 6 + local.get 7 + call $_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h88825d208e00007cE + local.set 8 + i32.const 16 + local.set 9 + local.get 3 + local.get 9 + i32.add + local.set 10 + local.get 10 + global.set $__stack_pointer + local.get 8 + return) + (func $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$3new17h4c1afdcf2aa53cfeE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 5 + local.get 5 + local.get 0 + local.get 1 + call $_ZN5erc207encoder7Encoder7add_str17h48eade08653f0a38E + local.set 6 + local.get 6 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$12from_encoder17h19aaa0c3f8f335ebE + local.set 7 + i32.const 16 + local.set 8 + local.get 4 + local.get 8 + i32.add + local.set 9 + local.get 9 + global.set $__stack_pointer + local.get 7 + return) + (func $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$12from_encoder17h19aaa0c3f8f335ebE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + local.get 3 + local.get 0 + i32.store offset=8 + local.get 3 + i32.load offset=8 + local.set 4 + local.get 4 + return) + (func $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$8with_arg17hb79a0694916ff152E (type 3) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 16 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=4 + local.get 5 + local.get 1 + i32.store offset=8 + local.get 5 + local.get 2 + i32.store offset=12 + local.get 0 + local.get 1 + local.get 2 + call $_ZN5erc207encoder7Encoder3add17h17efa0f887444fffE + local.set 6 + local.get 6 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$12from_encoder17h19aaa0c3f8f335ebE + local.set 7 + i32.const 16 + local.set 8 + local.get 5 + local.get 8 + i32.add + local.set 9 + local.get 9 + global.set $__stack_pointer + local.get 7 + return) + (func $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$5build17haf899c3202fbea93E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=4 + i32.const 4 + local.set 4 + local.get 3 + local.get 4 + i32.add + local.set 5 + local.get 5 + local.set 6 + local.get 6 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 7 + local.get 3 + local.get 7 + i32.store offset=8 + local.get 7 + call $fingerprint + local.set 8 + local.get 3 + local.get 8 + i32.store offset=12 + local.get 8 + call $_ZN5erc204u2564U2567from_id17h803f5db381600ddeE + local.set 9 + local.get 9 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3new17haccb738ecb8c3fc6E + local.set 10 + i32.const 16 + local.set 11 + local.get 3 + local.get 11 + i32.add + local.set 12 + local.get 12 + global.set $__stack_pointer + local.get 10 + return) + (func $_ZN5erc2010assertions4fail17h770341421e219d38E (type 1) (param i32 i32) + (local i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN5erc209ulm_hooks11failWrapper17h9cdd5286d3613c7fE + unreachable) + (func $rust_begin_unwind (type 7) (param i32) + (local i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=12 + i32.const 1048612 + local.set 4 + i32.const 5 + local.set 5 + local.get 4 + local.get 5 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable) + (func $_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h73918c771f211e87E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=12 + local.get 0 + call $_ZN88_$LT$erc20..address..Address$u20$as$u20$core..convert..From$LT$erc20..u256..U256$GT$$GT$4from17h99acffe3fa30dc49E + local.set 5 + i32.const 16 + local.set 6 + local.get 4 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h88825d208e00007cE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=12 + local.get 0 + call $_ZN88_$LT$erc20..balance..Balance$u20$as$u20$core..convert..From$LT$erc20..u256..U256$GT$$GT$4from17h2da9e7e2f9c4185aE + local.set 5 + i32.const 16 + local.set 6 + local.get 4 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN5erc205bytes5Bytes7from_id17h2e02cd3fb3c0d3d8E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + local.get 3 + local.get 0 + i32.store offset=8 + local.get 3 + i32.load offset=8 + local.set 4 + local.get 4 + return) + (func $_ZN5erc205bytes5Bytes6length17h1b60fb5c99d406f1E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=12 + local.get 0 + i32.load + local.set 4 + local.get 4 + call $bytesLength + local.set 5 + i32.const 16 + local.set 6 + local.get 3 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN5erc205bytes5Bytes6substr17hf571efe870c33040E (type 3) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 16 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=4 + local.get 5 + local.get 1 + i32.store offset=8 + local.get 5 + local.get 2 + i32.store offset=12 + local.get 0 + i32.load + local.set 6 + local.get 6 + local.get 1 + local.get 2 + call $bytesSubstr + local.set 7 + local.get 7 + call $_ZN5erc205bytes5Bytes7from_id17h2e02cd3fb3c0d3d8E + local.set 8 + i32.const 16 + local.set 9 + local.get 5 + local.get 9 + i32.add + local.set 10 + local.get 10 + global.set $__stack_pointer + local.get 8 + return) + (func $_ZN54_$LT$erc20..bytes..Bytes$u20$as$u20$core..cmp..Ord$GT$3cmp17hd703997e965a7495E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=4 + local.get 4 + local.get 1 + i32.store offset=8 + local.get 0 + i32.load + local.set 5 + local.get 1 + i32.load + local.set 6 + local.get 5 + local.get 6 + call $cmpBytes + local.set 7 + local.get 4 + local.get 7 + i32.store offset=12 + i32.const 0 + local.set 8 + local.get 7 + local.set 9 + local.get 8 + local.set 10 + local.get 9 + local.get 10 + i32.lt_s + local.set 11 + i32.const 1 + local.set 12 + local.get 11 + local.get 12 + i32.and + local.set 13 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + local.get 13 + br_if 0 (;@4;) + i32.const 0 + local.set 14 + local.get 7 + local.set 15 + local.get 14 + local.set 16 + local.get 15 + local.get 16 + i32.gt_s + local.set 17 + i32.const 1 + local.set 18 + local.get 17 + local.get 18 + i32.and + local.set 19 + local.get 19 + br_if 2 (;@2;) + br 1 (;@3;) + end + i32.const 255 + local.set 20 + local.get 4 + local.get 20 + i32.store8 offset=3 + br 2 (;@1;) + end + i32.const 0 + local.set 21 + local.get 4 + local.get 21 + i32.store8 offset=3 + br 1 (;@1;) + end + i32.const 1 + local.set 22 + local.get 4 + local.get 22 + i32.store8 offset=3 + end + local.get 4 + i32.load8_u offset=3 + local.set 23 + i32.const 16 + local.set 24 + local.get 4 + local.get 24 + i32.add + local.set 25 + local.get 25 + global.set $__stack_pointer + local.get 23 + return) + (func $_ZN60_$LT$erc20..bytes..Bytes$u20$as$u20$core..cmp..PartialEq$GT$2eq17h6c48405eb7a60734E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN54_$LT$erc20..bytes..Bytes$u20$as$u20$core..cmp..Ord$GT$3cmp17hd703997e965a7495E + local.set 5 + local.get 4 + local.get 5 + i32.store8 offset=7 + i32.const 7 + local.set 6 + local.get 4 + local.get 6 + i32.add + local.set 7 + local.get 7 + local.set 8 + i32.const 1048617 + local.set 9 + local.get 8 + local.get 9 + call $_ZN60_$LT$core..cmp..Ordering$u20$as$u20$core..cmp..PartialEq$GT$2eq17h4f7e0e7136f3950eE + local.set 10 + i32.const 1 + local.set 11 + local.get 10 + local.get 11 + i32.and + local.set 12 + i32.const 16 + local.set 13 + local.get 4 + local.get 13 + i32.add + local.set 14 + local.get 14 + global.set $__stack_pointer + local.get 12 + return) + (func $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE (type 4) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 0 + i32.const 16 + local.set 1 + local.get 0 + local.get 1 + i32.sub + local.set 2 + local.get 2 + global.set $__stack_pointer + call $newEncoder + local.set 3 + local.get 2 + local.get 3 + i32.store offset=12 + local.get 2 + i32.load offset=12 + local.set 4 + i32.const 16 + local.set 5 + local.get 2 + local.get 5 + i32.add + local.set 6 + local.get 6 + global.set $__stack_pointer + local.get 4 + return) + (func $_ZN5erc207encoder7Encoder3add17h17efa0f887444fffE (type 3) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 16 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=4 + local.get 5 + local.get 1 + i32.store offset=8 + local.get 5 + local.get 2 + i32.store offset=12 + local.get 2 + i32.load offset=12 + local.set 6 + local.get 1 + local.get 0 + local.get 6 + call_indirect (type 0) + local.set 7 + local.get 5 + local.get 7 + i32.store + local.get 5 + i32.load + local.set 8 + i32.const 16 + local.set 9 + local.get 5 + local.get 9 + i32.add + local.set 10 + local.get 10 + global.set $__stack_pointer + local.get 8 + return) + (func $_ZN5erc207encoder7Encoder8add_bool17hc20e2a4347cfa111E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i64 i64 i64 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 32 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=24 + local.get 1 + local.set 5 + local.get 4 + local.get 5 + i32.store8 offset=31 + local.get 1 + local.set 6 + block ;; label = @1 + block ;; label = @2 + local.get 6 + br_if 0 (;@2;) + i64.const 0 + local.set 7 + local.get 4 + local.get 7 + i64.store offset=16 + br 1 (;@1;) + end + i64.const 1 + local.set 8 + local.get 4 + local.get 8 + i64.store offset=16 + end + local.get 4 + i64.load offset=16 + local.set 9 + local.get 9 + call $u256FromU64 + local.set 10 + local.get 0 + local.get 10 + call $encoderAddU256 + local.set 11 + local.get 4 + local.get 11 + i32.store offset=12 + local.get 4 + i32.load offset=12 + local.set 12 + i32.const 32 + local.set 13 + local.get 4 + local.get 13 + i32.add + local.set 14 + local.get 14 + global.set $__stack_pointer + local.get 12 + return) + (func $_ZN5erc207encoder7Encoder6add_u817h07f8be4f229cdce8E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i64 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store8 offset=15 + i32.const 1048632 + local.set 5 + local.get 1 + local.get 5 + call $_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17ha520517a84bd503dE + local.set 6 + local.get 6 + call $u256FromU64 + local.set 7 + local.get 0 + local.get 7 + call $encoderAddU256 + local.set 8 + local.get 4 + local.get 8 + i32.store offset=4 + local.get 4 + i32.load offset=4 + local.set 9 + i32.const 16 + local.set 10 + local.get 4 + local.get 10 + i32.add + local.set 11 + local.get 11 + global.set $__stack_pointer + local.get 9 + return) + (func $_ZN5erc207encoder7Encoder7add_str17h48eade08653f0a38E (type 3) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 16 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=4 + local.get 5 + local.get 1 + i32.store offset=8 + local.get 5 + local.get 2 + i32.store offset=12 + local.get 0 + local.get 1 + local.get 2 + call $_ZN5erc209ulm_hooks20encoderAddStrWrapper17h55165afa3106331eE + local.set 6 + local.get 5 + local.get 6 + i32.store + local.get 5 + i32.load + local.set 7 + i32.const 16 + local.set 8 + local.get 5 + local.get 8 + i32.add + local.set 9 + local.get 9 + global.set $__stack_pointer + local.get 7 + return) + (func $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=12 + local.get 0 + i32.load + local.set 4 + local.get 4 + call $encoderToBytes + local.set 5 + local.get 5 + call $_ZN5erc205bytes5Bytes7from_id17h2e02cd3fb3c0d3d8E + local.set 6 + i32.const 16 + local.set 7 + local.get 3 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + local.get 6 + return) + (func $_ZN5erc204u2564U2567from_id17h803f5db381600ddeE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + local.get 3 + local.get 0 + i32.store offset=8 + local.get 3 + i32.load offset=8 + local.set 4 + local.get 4 + return) + (func $_ZN88_$LT$erc20..u256..U256$u20$as$u20$core..ops..arith..Sub$LT$$RF$erc20..u256..U256$GT$$GT$3sub17hcc32ad51d4288c61E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 1 + i32.load + local.set 5 + local.get 0 + local.get 5 + call $intSub + local.set 6 + local.get 4 + local.get 6 + i32.store offset=4 + local.get 4 + i32.load offset=4 + local.set 7 + i32.const 16 + local.set 8 + local.get 4 + local.get 8 + i32.add + local.set 9 + local.get 9 + global.set $__stack_pointer + local.get 7 + return) + (func $_ZN88_$LT$erc20..u256..U256$u20$as$u20$core..ops..arith..Add$LT$$RF$erc20..u256..U256$GT$$GT$3add17h1ecc2631a9ce6b5fE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 1 + i32.load + local.set 5 + local.get 0 + local.get 5 + call $intAdd + local.set 6 + local.get 4 + local.get 6 + i32.store offset=4 + local.get 4 + i32.load offset=4 + local.set 7 + i32.const 16 + local.set 8 + local.get 4 + local.get 8 + i32.add + local.set 9 + local.get 9 + global.set $__stack_pointer + local.get 7 + return) + (func $_ZN52_$LT$erc20..u256..U256$u20$as$u20$core..cmp..Ord$GT$3cmp17hf9b2169d053301feE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=4 + local.get 4 + local.get 1 + i32.store offset=8 + local.get 0 + i32.load + local.set 5 + local.get 1 + i32.load + local.set 6 + local.get 5 + local.get 6 + call $cmpInt + local.set 7 + local.get 4 + local.get 7 + i32.store offset=12 + i32.const 0 + local.set 8 + local.get 7 + local.set 9 + local.get 8 + local.set 10 + local.get 9 + local.get 10 + i32.lt_s + local.set 11 + i32.const 1 + local.set 12 + local.get 11 + local.get 12 + i32.and + local.set 13 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + local.get 13 + br_if 0 (;@4;) + i32.const 0 + local.set 14 + local.get 7 + local.set 15 + local.get 14 + local.set 16 + local.get 15 + local.get 16 + i32.gt_s + local.set 17 + i32.const 1 + local.set 18 + local.get 17 + local.get 18 + i32.and + local.set 19 + local.get 19 + br_if 2 (;@2;) + br 1 (;@3;) + end + i32.const 255 + local.set 20 + local.get 4 + local.get 20 + i32.store8 offset=3 + br 2 (;@1;) + end + i32.const 0 + local.set 21 + local.get 4 + local.get 21 + i32.store8 offset=3 + br 1 (;@1;) + end + i32.const 1 + local.set 22 + local.get 4 + local.get 22 + i32.store8 offset=3 + end + local.get 4 + i32.load8_u offset=3 + local.set 23 + i32.const 16 + local.set 24 + local.get 4 + local.get 24 + i32.add + local.set 25 + local.get 25 + global.set $__stack_pointer + local.get 23 + return) + (func $_ZN59_$LT$erc20..u256..U256$u20$as$u20$core..cmp..PartialOrd$GT$11partial_cmp17h08221bba81b05d26E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN52_$LT$erc20..u256..U256$u20$as$u20$core..cmp..Ord$GT$3cmp17hf9b2169d053301feE + local.set 5 + local.get 4 + local.get 5 + i32.store8 offset=7 + local.get 4 + i32.load8_u offset=7 + local.set 6 + i32.const 16 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + local.get 6 + return) + (func $_ZN56_$LT$erc20..u256..U256$u20$as$u20$core..clone..Clone$GT$5clone17h9d80d1a4a6549231E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + local.get 0 + i32.load + local.set 4 + local.get 3 + local.get 4 + i32.store offset=8 + local.get 3 + i32.load offset=8 + local.set 5 + local.get 5 + return) + (func $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..encoder..Encodable$GT$6add_to17h19915b1e4b69f615E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + i32.load + local.set 5 + local.get 1 + local.get 5 + call $encoderAddU256 + local.set 6 + i32.const 16 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + local.get 6 + return) + (func $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$18is_variable_length17hff1131dd9b2cdc75E (type 4) (result i32) + (local i32 i32 i32) + i32.const 0 + local.set 0 + i32.const 1 + local.set 1 + local.get 0 + local.get 1 + i32.and + local.set 2 + local.get 2 + return) + (func $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$17encoded_head_size17h90a70989d73c616cE (type 4) (result i32) + (local i32) + i32.const 32 + local.set 0 + local.get 0 + return) + (func $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$6decode17hf088c45c5c047980E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=8 + local.get 0 + call $u256FromBytes + local.set 4 + local.get 3 + local.get 4 + i32.store offset=12 + local.get 3 + local.get 4 + i32.store offset=4 + local.get 3 + i32.load offset=4 + local.set 5 + i32.const 16 + local.set 6 + local.get 3 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17ha520517a84bd503dE (type 8) (param i32 i32) (result i64) + (local i32 i32 i32 i32 i32 i64) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + local.get 0 + i32.store8 offset=14 + local.get 4 + local.get 0 + i32.store8 offset=15 + i32.const 255 + local.set 5 + local.get 0 + local.get 5 + i32.and + local.set 6 + local.get 6 + i64.extend_i32_u + local.set 7 + local.get 7 + return) + (func $_ZN5erc207decoder7Decoder11from_buffer17h1f5c3050793fe7c6E (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 1 + i32.store offset=12 + local.get 1 + call $decoderFromBuffer + local.set 5 + local.get 4 + local.get 5 + i32.store offset=4 + i32.const 0 + local.set 6 + local.get 4 + local.get 6 + i32.store offset=8 + local.get 4 + i32.load offset=4 + local.set 7 + local.get 4 + i32.load offset=8 + local.set 8 + local.get 0 + local.get 8 + i32.store offset=4 + local.get 0 + local.get 7 + i32.store + i32.const 16 + local.set 9 + local.get 4 + local.get 9 + i32.add + local.set 10 + local.get 10 + global.set $__stack_pointer + return) + (func $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E (type 7) (param i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=8 + local.get 0 + i32.load + local.set 4 + local.get 4 + call $decoderValueCount + local.set 5 + local.get 3 + local.get 5 + i32.store offset=12 + local.get 0 + i32.load offset=4 + local.set 6 + local.get 6 + local.set 7 + local.get 5 + local.set 8 + local.get 7 + local.get 8 + i32.eq + local.set 9 + i32.const 1 + local.set 10 + local.get 9 + local.get 10 + i32.and + local.set 11 + block ;; label = @1 + local.get 11 + br_if 0 (;@1;) + i32.const 16 + local.set 12 + local.get 3 + local.get 12 + i32.add + local.set 13 + local.get 13 + global.set $__stack_pointer + return + end + i32.const 1048648 + local.set 14 + i32.const 22 + local.set 15 + local.get 14 + local.get 15 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable) + (func $_ZN5erc207decoder7Decoder13validate_data17h6a69297ef76a79f4E (type 7) (param i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=8 + local.get 0 + i32.load + local.set 4 + local.get 4 + call $isValidDecoder + local.set 5 + i32.const 1 + local.set 6 + local.get 5 + local.get 6 + i32.and + local.set 7 + local.get 3 + local.get 7 + i32.store8 offset=15 + i32.const 1 + local.set 8 + local.get 5 + local.get 8 + i32.and + local.set 9 + block ;; label = @1 + local.get 9 + br_if 0 (;@1;) + i32.const 16 + local.set 10 + local.get 3 + local.get 10 + i32.add + local.set 11 + local.get 11 + global.set $__stack_pointer + return + end + i32.const 1048670 + local.set 12 + i32.const 17 + local.set 13 + local.get 12 + local.get 13 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable) + (func $_ZN100_$LT$erc20..balance..Balance$u20$as$u20$core..ops..arith..Sub$LT$$RF$erc20..balance..Balance$GT$$GT$3sub17hcf783bc0487d51e9E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN88_$LT$erc20..u256..U256$u20$as$u20$core..ops..arith..Sub$LT$$RF$erc20..u256..U256$GT$$GT$3sub17hcc32ad51d4288c61E + local.set 5 + local.get 4 + local.get 5 + i32.store offset=4 + local.get 4 + i32.load offset=4 + local.set 6 + i32.const 16 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + local.get 6 + return) + (func $_ZN100_$LT$erc20..balance..Balance$u20$as$u20$core..ops..arith..Add$LT$$RF$erc20..balance..Balance$GT$$GT$3add17hffe4c1029010cb2fE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN88_$LT$erc20..u256..U256$u20$as$u20$core..ops..arith..Add$LT$$RF$erc20..u256..U256$GT$$GT$3add17h1ecc2631a9ce6b5fE + local.set 5 + local.get 4 + local.get 5 + i32.store offset=4 + local.get 4 + i32.load offset=4 + local.set 6 + i32.const 16 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + local.get 6 + return) + (func $_ZN88_$LT$erc20..balance..Balance$u20$as$u20$core..convert..Into$LT$erc20..u256..U256$GT$$GT$4into17hedbef66d4283e5e0E (type 2) (param i32) (result i32) + (local i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + local.get 0 + return) + (func $_ZN88_$LT$erc20..balance..Balance$u20$as$u20$core..convert..From$LT$erc20..u256..U256$GT$$GT$4from17h2da9e7e2f9c4185aE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + local.get 3 + local.get 0 + i32.store offset=8 + local.get 3 + i32.load offset=8 + local.set 4 + local.get 4 + return) + (func $_ZN62_$LT$erc20..balance..Balance$u20$as$u20$core..clone..Clone$GT$5clone17hfc85203d540af18aE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=12 + local.get 0 + call $_ZN56_$LT$erc20..u256..U256$u20$as$u20$core..clone..Clone$GT$5clone17h9d80d1a4a6549231E + local.set 4 + local.get 3 + local.get 4 + i32.store offset=8 + local.get 3 + i32.load offset=8 + local.set 5 + i32.const 16 + local.set 6 + local.get 3 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN69_$LT$erc20..balance..Balance$u20$as$u20$erc20..encoder..Encodable$GT$6add_to17hd7ca5a57f68c1f2eE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..encoder..Encodable$GT$6add_to17h19915b1e4b69f615E + local.set 5 + i32.const 16 + local.set 6 + local.get 4 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN69_$LT$erc20..balance..Balance$u20$as$u20$erc20..decoder..Decodable$GT$18is_variable_length17h083f63e4ebcd9366E (type 4) (result i32) + (local i32 i32 i32) + call $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$18is_variable_length17hff1131dd9b2cdc75E + local.set 0 + i32.const 1 + local.set 1 + local.get 0 + local.get 1 + i32.and + local.set 2 + local.get 2 + return) + (func $_ZN69_$LT$erc20..balance..Balance$u20$as$u20$erc20..decoder..Decodable$GT$17encoded_head_size17h1c4146462953415bE (type 4) (result i32) + (local i32) + call $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$17encoded_head_size17h90a70989d73c616cE + local.set 0 + local.get 0 + return) + (func $_ZN69_$LT$erc20..balance..Balance$u20$as$u20$erc20..decoder..Decodable$GT$6decode17h19af32acb5a50a6eE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=8 + local.get 0 + call $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$6decode17hf088c45c5c047980E + local.set 4 + local.get 3 + local.get 4 + i32.store offset=12 + i32.const 1048704 + local.set 5 + local.get 4 + local.get 5 + call $_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h88825d208e00007cE + local.set 6 + i32.const 16 + local.set 7 + local.get 3 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + local.get 6 + return) + (func $_ZN65_$LT$erc20..balance..Balance$u20$as$u20$core..cmp..PartialOrd$GT$11partial_cmp17hfb87ca8022bfd03aE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN59_$LT$erc20..u256..U256$u20$as$u20$core..cmp..PartialOrd$GT$11partial_cmp17h08221bba81b05d26E + local.set 5 + i32.const 16 + local.set 6 + local.get 4 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN4core3cmp10PartialOrd2le17h08fcfc730c9adb26E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN65_$LT$erc20..balance..Balance$u20$as$u20$core..cmp..PartialOrd$GT$11partial_cmp17hfb87ca8022bfd03aE + local.set 5 + local.get 4 + local.get 5 + i32.store8 offset=7 + local.get 4 + i32.load8_u offset=7 + local.set 6 + i32.const 2 + local.set 7 + i32.const 255 + local.set 8 + local.get 6 + local.get 8 + i32.and + local.set 9 + i32.const 255 + local.set 10 + local.get 7 + local.get 10 + i32.and + local.set 11 + local.get 9 + local.get 11 + i32.eq + local.set 12 + i32.const 0 + local.set 13 + i32.const 1 + local.set 14 + i32.const 1 + local.set 15 + local.get 12 + local.get 15 + i32.and + local.set 16 + local.get 13 + local.get 14 + local.get 16 + select + local.set 17 + i32.const 1 + local.set 18 + local.get 17 + local.set 19 + local.get 18 + local.set 20 + local.get 19 + local.get 20 + i32.eq + local.set 21 + i32.const 1 + local.set 22 + local.get 21 + local.get 22 + i32.and + local.set 23 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 23 + i32.eqz + br_if 0 (;@3;) + local.get 4 + i32.load8_u offset=7 + local.set 24 + i32.const 1 + local.set 25 + local.get 24 + local.get 25 + i32.add + local.set 26 + i32.const 255 + local.set 27 + local.get 26 + local.get 27 + i32.and + local.set 28 + local.get 28 + br_table 1 (;@2;) 1 (;@2;) 0 (;@3;) 1 (;@2;) + end + i32.const 0 + local.set 29 + local.get 4 + local.get 29 + i32.store8 offset=6 + br 1 (;@1;) + end + i32.const 1 + local.set 30 + local.get 4 + local.get 30 + i32.store8 offset=6 + end + local.get 4 + i32.load8_u offset=6 + local.set 31 + i32.const 1 + local.set 32 + local.get 31 + local.get 32 + i32.and + local.set 33 + i32.const 16 + local.set 34 + local.get 4 + local.get 34 + i32.add + local.set 35 + local.get 35 + global.set $__stack_pointer + local.get 33 + return + unreachable) + (func $_ZN4core3cmp5impls70_$LT$impl$u20$core..cmp..PartialOrd$LT$$RF$B$GT$$u20$for$u20$$RF$A$GT$2le17hbd011d94f76634d3E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + i32.load + local.set 5 + local.get 1 + i32.load + local.set 6 + local.get 5 + local.get 6 + call $_ZN4core3cmp10PartialOrd2le17h08fcfc730c9adb26E + local.set 7 + i32.const 1 + local.set 8 + local.get 7 + local.get 8 + i32.and + local.set 9 + i32.const 16 + local.set 10 + local.get 4 + local.get 10 + i32.add + local.set 11 + local.get 11 + global.set $__stack_pointer + local.get 9 + return) + (func $_ZN4core3ptr44drop_in_place$LT$erc20..address..Address$GT$17h8456b4854419963dE (type 7) (param i32) + (local i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + return) + (func $_ZN4core3ptr44drop_in_place$LT$erc20..balance..Balance$GT$17h76e05e6c9083f3e6E (type 7) (param i32) + (local i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + return) + (func $_ZN5erc209ulm_hooks11failWrapper17h9cdd5286d3613c7fE (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 32 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store + local.get 4 + local.get 1 + i32.store offset=4 + local.get 4 + local.get 0 + i32.store offset=16 + local.get 4 + local.get 1 + i32.store offset=20 + local.get 1 + local.set 5 + local.get 0 + local.set 6 + local.get 4 + local.get 6 + i32.store offset=8 + local.get 4 + local.get 5 + i32.store offset=12 + local.get 4 + local.get 6 + i32.store offset=24 + local.get 4 + local.get 5 + i32.store offset=28 + local.get 6 + local.get 5 + call $fail + unreachable) + (func $_ZN5erc209ulm_hooks27signatureFingerprintWrapper17h625f92283221d6c6E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 32 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store + local.get 4 + local.get 1 + i32.store offset=4 + local.get 4 + local.get 0 + i32.store offset=16 + local.get 4 + local.get 1 + i32.store offset=20 + local.get 1 + local.set 5 + local.get 0 + local.set 6 + local.get 4 + local.get 6 + i32.store offset=8 + local.get 4 + local.get 5 + i32.store offset=12 + local.get 4 + local.get 6 + i32.store offset=24 + local.get 4 + local.get 5 + i32.store offset=28 + local.get 6 + local.get 5 + call $signatureFingerprint + local.set 7 + i32.const 32 + local.set 8 + local.get 4 + local.get 8 + i32.add + local.set 9 + local.get 9 + global.set $__stack_pointer + local.get 7 + return) + (func $_ZN5erc209ulm_hooks26endpointFingerprintWrapper17h2bacea3f2e6b46c0E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=4 + local.get 4 + local.get 1 + i32.store offset=8 + local.get 0 + local.get 1 + call $_ZN5erc209ulm_hooks27signatureFingerprintWrapper17h625f92283221d6c6E + local.set 5 + local.get 4 + local.get 5 + i32.store offset=12 + local.get 5 + call $bytesLength + local.set 6 + i32.const 4 + local.set 7 + local.get 6 + local.set 8 + local.get 7 + local.set 9 + local.get 8 + local.get 9 + i32.lt_u + local.set 10 + i32.const 1 + local.set 11 + local.get 10 + local.get 11 + i32.and + local.set 12 + block ;; label = @1 + local.get 12 + br_if 0 (;@1;) + i32.const 0 + local.set 13 + i32.const 4 + local.set 14 + local.get 5 + local.get 13 + local.get 14 + call $bytesSubstr + local.set 15 + i32.const 16 + local.set 16 + local.get 4 + local.get 16 + i32.add + local.set 17 + local.get 17 + global.set $__stack_pointer + local.get 15 + return + end + i32.const 1048720 + local.set 18 + i32.const 19 + local.set 19 + local.get 18 + local.get 19 + call $_ZN5erc209ulm_hooks11failWrapper17h9cdd5286d3613c7fE + unreachable) + (func $_ZN5erc209ulm_hooks20encoderAddStrWrapper17h55165afa3106331eE (type 3) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 48 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=12 + local.get 5 + local.get 1 + i32.store offset=16 + local.get 5 + local.get 2 + i32.store offset=20 + local.get 5 + local.get 1 + i32.store offset=32 + local.get 5 + local.get 2 + i32.store offset=36 + local.get 2 + local.set 6 + local.get 1 + local.set 7 + local.get 5 + local.get 7 + i32.store offset=24 + local.get 5 + local.get 6 + i32.store offset=28 + local.get 5 + local.get 7 + i32.store offset=40 + local.get 5 + local.get 6 + i32.store offset=44 + local.get 0 + local.get 7 + local.get 6 + call $encoderAddStr + local.set 8 + i32.const 48 + local.set 9 + local.get 5 + local.get 9 + i32.add + local.set 10 + local.get 10 + global.set $__stack_pointer + local.get 8 + return) + (func $_ZN5erc207address7Address4zero17h0e5fb3f67c2242c2E (type 4) (result i32) + (local i32 i32 i32 i64 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 0 + i32.const 16 + local.set 1 + local.get 0 + local.get 1 + i32.sub + local.set 2 + local.get 2 + global.set $__stack_pointer + i64.const 0 + local.set 3 + local.get 3 + call $u160FromU64 + local.set 4 + local.get 2 + local.get 4 + i32.store offset=12 + local.get 2 + i32.load offset=12 + local.set 5 + i32.const 16 + local.set 6 + local.get 2 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN5erc207address7Address7from_id17he783da6766323a81E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + local.get 0 + i32.store offset=12 + local.get 3 + local.get 0 + i32.store offset=8 + local.get 3 + i32.load offset=8 + local.set 4 + local.get 4 + return) + (func $_ZN5erc207address7Address7is_zero17hf086e03baaa13a2eE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=12 + local.get 0 + i32.load + local.set 4 + call $_ZN5erc207address7Address4zero17h0e5fb3f67c2242c2E + local.set 5 + local.get 4 + local.get 5 + call $cmpInt + local.set 6 + i32.const 0 + local.set 7 + local.get 6 + local.set 8 + local.get 7 + local.set 9 + local.get 8 + local.get 9 + i32.eq + local.set 10 + i32.const 1 + local.set 11 + local.get 10 + local.get 11 + i32.and + local.set 12 + i32.const 16 + local.set 13 + local.get 3 + local.get 13 + i32.add + local.set 14 + local.get 14 + global.set $__stack_pointer + local.get 12 + return) + (func $_ZN92_$LT$$RF$erc20..address..Address$u20$as$u20$core..convert..Into$LT$erc20..u256..U256$GT$$GT$4into17hfaa8bb23fc92c9b2E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=12 + local.get 0 + i32.load + local.set 4 + local.get 4 + call $u256FromIntId + local.set 5 + local.get 5 + call $_ZN5erc204u2564U2567from_id17h803f5db381600ddeE + local.set 6 + i32.const 16 + local.set 7 + local.get 3 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + local.get 6 + return) + (func $_ZN88_$LT$erc20..address..Address$u20$as$u20$core..convert..From$LT$erc20..u256..U256$GT$$GT$4from17h99acffe3fa30dc49E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=8 + local.get 0 + call $u160FromIntId + local.set 4 + local.get 3 + local.get 4 + i32.store offset=12 + local.get 3 + local.get 4 + i32.store offset=4 + local.get 3 + i32.load offset=4 + local.set 5 + i32.const 16 + local.set 6 + local.get 3 + local.get 6 + i32.add + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 5 + return) + (func $_ZN69_$LT$erc20..address..Address$u20$as$u20$erc20..encoder..Encodable$GT$6add_to17hbf87ab60036eabf4E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + call $_ZN92_$LT$$RF$erc20..address..Address$u20$as$u20$core..convert..Into$LT$erc20..u256..U256$GT$$GT$4into17hfaa8bb23fc92c9b2E + local.set 5 + local.get 4 + local.get 5 + i32.store offset=4 + i32.const 4 + local.set 6 + local.get 4 + local.get 6 + i32.add + local.set 7 + local.get 7 + local.set 8 + local.get 8 + local.get 1 + call $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..encoder..Encodable$GT$6add_to17h19915b1e4b69f615E + local.set 9 + i32.const 16 + local.set 10 + local.get 4 + local.get 10 + i32.add + local.set 11 + local.get 11 + global.set $__stack_pointer + local.get 9 + return) + (func $_ZN69_$LT$erc20..address..Address$u20$as$u20$erc20..decoder..Decodable$GT$18is_variable_length17hed2c5fe86201076eE (type 4) (result i32) + (local i32 i32 i32) + call $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$18is_variable_length17hff1131dd9b2cdc75E + local.set 0 + i32.const 1 + local.set 1 + local.get 0 + local.get 1 + i32.and + local.set 2 + local.get 2 + return) + (func $_ZN69_$LT$erc20..address..Address$u20$as$u20$erc20..decoder..Decodable$GT$17encoded_head_size17h5b675d0368481b09E (type 4) (result i32) + (local i32) + call $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$17encoded_head_size17h90a70989d73c616cE + local.set 0 + local.get 0 + return) + (func $_ZN69_$LT$erc20..address..Address$u20$as$u20$erc20..decoder..Decodable$GT$6decode17h4ddec667a8dbb3bdE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=8 + local.get 0 + call $_ZN63_$LT$erc20..u256..U256$u20$as$u20$erc20..decoder..Decodable$GT$6decode17hf088c45c5c047980E + local.set 4 + local.get 3 + local.get 4 + i32.store offset=12 + i32.const 1048756 + local.set 5 + local.get 4 + local.get 5 + call $_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h73918c771f211e87E + local.set 6 + i32.const 16 + local.set 7 + local.get 3 + local.get 7 + i32.add + local.set 8 + local.get 8 + global.set $__stack_pointer + local.get 6 + return) + (func $_ZN5erc2013CallerWrapper17hcc834606c06a9aefE (type 4) (result i32) + (local i32 i32) + call $Caller + local.set 0 + local.get 0 + call $_ZN5erc207address7Address7from_id17he783da6766323a81E + local.set 1 + local.get 1 + return) + (func $_ZN5erc204log317hd2e263bf345704ecE (type 9) (param i32 i32 i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 5 + i32.const 32 + local.set 6 + local.get 5 + local.get 6 + i32.sub + local.set 7 + local.get 7 + global.set $__stack_pointer + local.get 7 + local.get 0 + i32.store offset=12 + local.get 7 + local.get 1 + i32.store offset=16 + local.get 7 + local.get 2 + i32.store offset=20 + local.get 7 + local.get 3 + i32.store offset=24 + local.get 7 + local.get 4 + i32.store offset=28 + local.get 0 + local.get 1 + call $_ZN5erc209ulm_hooks27signatureFingerprintWrapper17h625f92283221d6c6E + local.set 8 + local.get 4 + i32.load + local.set 9 + local.get 8 + local.get 2 + local.get 3 + local.get 9 + call $Log3 + i32.const 32 + local.set 10 + local.get 7 + local.get 10 + i32.add + local.set 11 + local.get 11 + global.set $__stack_pointer + return) + (func $_ZN5erc2014same_signature17h585c21bffd3f9488E (type 3) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 32 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=12 + local.get 5 + local.get 1 + i32.store offset=24 + local.get 5 + local.get 2 + i32.store offset=28 + local.get 1 + local.get 2 + call $_ZN5erc209ulm_hooks26endpointFingerprintWrapper17h2bacea3f2e6b46c0E + local.set 6 + local.get 6 + call $_ZN5erc205bytes5Bytes7from_id17h2e02cd3fb3c0d3d8E + local.set 7 + local.get 5 + local.get 7 + i32.store offset=20 + i32.const 20 + local.set 8 + local.get 5 + local.get 8 + i32.add + local.set 9 + local.get 9 + local.set 10 + local.get 5 + local.get 10 + i32.store offset=16 + i32.const 12 + local.set 11 + local.get 5 + local.get 11 + i32.add + local.set 12 + local.get 12 + local.set 13 + i32.const 16 + local.set 14 + local.get 5 + local.get 14 + i32.add + local.set 15 + local.get 15 + local.set 16 + local.get 13 + local.get 16 + call $_ZN4core3cmp5impls69_$LT$impl$u20$core..cmp..PartialEq$LT$$RF$B$GT$$u20$for$u20$$RF$A$GT$2eq17h259317a46a8973c6E + local.set 17 + i32.const 1 + local.set 18 + local.get 17 + local.get 18 + i32.and + local.set 19 + i32.const 32 + local.set 20 + local.get 5 + local.get 20 + i32.add + local.set 21 + local.get 21 + global.set $__stack_pointer + local.get 19 + return) + (func $dispatch (type 7) (param i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 48 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 0 + local.set 4 + local.get 3 + local.get 4 + i32.store8 offset=31 + call $CallData + local.set 5 + local.get 3 + local.get 5 + i32.store offset=32 + local.get 5 + call $_ZN5erc205bytes5Bytes7from_id17h2e02cd3fb3c0d3d8E + local.set 6 + local.get 3 + local.get 6 + i32.store offset=20 + local.get 0 + local.set 7 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + block ;; label = @8 + block ;; label = @9 + block ;; label = @10 + block ;; label = @11 + block ;; label = @12 + block ;; label = @13 + block ;; label = @14 + block ;; label = @15 + block ;; label = @16 + block ;; label = @17 + block ;; label = @18 + local.get 7 + br_if 0 (;@18;) + i32.const 20 + local.set 8 + local.get 3 + local.get 8 + i32.add + local.set 9 + local.get 9 + local.set 10 + local.get 10 + call $_ZN5erc205bytes5Bytes6length17h1b60fb5c99d406f1E + local.set 11 + i32.const 4 + local.set 12 + local.get 11 + local.set 13 + local.get 12 + local.set 14 + local.get 13 + local.get 14 + i32.le_u + local.set 15 + i32.const 1 + local.set 16 + local.get 15 + local.get 16 + i32.and + local.set 17 + local.get 17 + br_if 2 (;@16;) + br 1 (;@17;) + end + local.get 3 + i32.load offset=20 + local.set 18 + local.get 3 + local.get 18 + call $_ZN5erc207decoder7Decoder11from_buffer17h1f5c3050793fe7c6E + local.get 3 + i32.load offset=4 + local.set 19 + local.get 3 + i32.load + local.set 20 + local.get 20 + local.get 19 + call $_ZN5erc2010initCaller17hd18ce7a2c5b62a05E + br 16 (;@1;) + end + i32.const 20 + local.set 21 + local.get 3 + local.get 21 + i32.add + local.set 22 + local.get 22 + local.set 23 + i32.const 0 + local.set 24 + i32.const 4 + local.set 25 + local.get 23 + local.get 24 + local.get 25 + call $_ZN5erc205bytes5Bytes6substr17hf571efe870c33040E + local.set 26 + local.get 3 + local.get 26 + i32.store offset=24 + i32.const 20 + local.set 27 + local.get 3 + local.get 27 + i32.add + local.set 28 + local.get 28 + local.set 29 + local.get 29 + call $_ZN5erc205bytes5Bytes6length17h1b60fb5c99d406f1E + local.set 30 + i32.const 20 + local.set 31 + local.get 3 + local.get 31 + i32.add + local.set 32 + local.get 32 + local.set 33 + i32.const 4 + local.set 34 + local.get 33 + local.get 34 + local.get 30 + call $_ZN5erc205bytes5Bytes6substr17hf571efe870c33040E + local.set 35 + local.get 3 + local.get 35 + i32.store offset=36 + i32.const 8 + local.set 36 + local.get 3 + local.get 36 + i32.add + local.set 37 + local.get 37 + local.get 35 + call $_ZN5erc207decoder7Decoder11from_buffer17h1f5c3050793fe7c6E + local.get 3 + i32.load offset=12 + local.set 38 + local.get 3 + i32.load offset=8 + local.set 39 + local.get 3 + local.get 39 + i32.store offset=40 + local.get 3 + local.get 38 + i32.store offset=44 + i32.const 24 + local.set 40 + local.get 3 + local.get 40 + i32.add + local.set 41 + local.get 41 + local.set 42 + i32.const 1048772 + local.set 43 + i32.const 10 + local.set 44 + local.get 42 + local.get 43 + local.get 44 + call $_ZN5erc2014same_signature17h585c21bffd3f9488E + local.set 45 + i32.const 1 + local.set 46 + local.get 45 + local.get 46 + i32.and + local.set 47 + local.get 47 + br_if 2 (;@14;) + br 1 (;@15;) + end + i32.const 1048941 + local.set 48 + i32.const 33 + local.set 49 + local.get 48 + local.get 49 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable + end + i32.const 24 + local.set 50 + local.get 3 + local.get 50 + i32.add + local.set 51 + local.get 51 + local.set 52 + i32.const 1048782 + local.set 53 + i32.const 13 + local.set 54 + local.get 52 + local.get 53 + local.get 54 + call $_ZN5erc2014same_signature17h585c21bffd3f9488E + local.set 55 + i32.const 1 + local.set 56 + local.get 55 + local.get 56 + i32.and + local.set 57 + local.get 57 + br_if 2 (;@12;) + br 1 (;@13;) + end + local.get 39 + local.get 38 + call $_ZN5erc2014decimalsCaller17he71bae09be07744cE + br 12 (;@1;) + end + i32.const 24 + local.set 58 + local.get 3 + local.get 58 + i32.add + local.set 59 + local.get 59 + local.set 60 + i32.const 1048795 + local.set 61 + i32.const 18 + local.set 62 + local.get 60 + local.get 61 + local.get 62 + call $_ZN5erc2014same_signature17h585c21bffd3f9488E + local.set 63 + i32.const 1 + local.set 64 + local.get 63 + local.get 64 + i32.and + local.set 65 + local.get 65 + br_if 2 (;@10;) + br 1 (;@11;) + end + local.get 39 + local.get 38 + call $_ZN5erc2017totalSupplyCaller17h19d85bde8ed08e83E + br 10 (;@1;) + end + i32.const 24 + local.set 66 + local.get 3 + local.get 66 + i32.add + local.set 67 + local.get 67 + local.set 68 + i32.const 1048813 + local.set 69 + i32.const 25 + local.set 70 + local.get 68 + local.get 69 + local.get 70 + call $_ZN5erc2014same_signature17h585c21bffd3f9488E + local.set 71 + i32.const 1 + local.set 72 + local.get 71 + local.get 72 + i32.and + local.set 73 + local.get 73 + br_if 2 (;@8;) + br 1 (;@9;) + end + local.get 39 + local.get 38 + call $_ZN5erc2015balanceOfCaller17hacd74ad926b74a92E + br 8 (;@1;) + end + i32.const 24 + local.set 74 + local.get 3 + local.get 74 + i32.add + local.set 75 + local.get 75 + local.set 76 + i32.const 1048838 + local.set 77 + i32.const 26 + local.set 78 + local.get 76 + local.get 77 + local.get 78 + call $_ZN5erc2014same_signature17h585c21bffd3f9488E + local.set 79 + i32.const 1 + local.set 80 + local.get 79 + local.get 80 + i32.and + local.set 81 + local.get 81 + br_if 2 (;@6;) + br 1 (;@7;) + end + local.get 39 + local.get 38 + call $_ZN5erc2014transferCaller17hb9cb5e12a96b30ccE + br 6 (;@1;) + end + i32.const 24 + local.set 82 + local.get 3 + local.get 82 + i32.add + local.set 83 + local.get 83 + local.set 84 + i32.const 1048864 + local.set 85 + i32.const 24 + local.set 86 + local.get 84 + local.get 85 + local.get 86 + call $_ZN5erc2014same_signature17h585c21bffd3f9488E + local.set 87 + i32.const 1 + local.set 88 + local.get 87 + local.get 88 + i32.and + local.set 89 + local.get 89 + br_if 2 (;@4;) + br 1 (;@5;) + end + local.get 39 + local.get 38 + call $_ZN5erc2015allowanceCaller17hda135d575dbf53a2E + br 4 (;@1;) + end + i32.const 24 + local.set 90 + local.get 3 + local.get 90 + i32.add + local.set 91 + local.get 91 + local.set 92 + i32.const 1048888 + local.set 93 + i32.const 37 + local.set 94 + local.get 92 + local.get 93 + local.get 94 + call $_ZN5erc2014same_signature17h585c21bffd3f9488E + local.set 95 + i32.const 1 + local.set 96 + local.get 95 + local.get 96 + i32.and + local.set 97 + local.get 97 + br_if 2 (;@2;) + br 1 (;@3;) + end + local.get 39 + local.get 38 + call $_ZN5erc2013approveCaller17h60f9f344ad971562E + br 2 (;@1;) + end + i32.const 1048925 + local.set 98 + i32.const 16 + local.set 99 + local.get 98 + local.get 99 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable + end + local.get 39 + local.get 38 + call $_ZN5erc2018transferFromCaller17h6d9ea98cf4e7c9e0E + end + i32.const 48 + local.set 100 + local.get 3 + local.get 100 + i32.add + local.set 101 + local.get 101 + global.set $__stack_pointer + return) + (func $_ZN5erc2010initCaller17hd18ce7a2c5b62a05E (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store + local.get 4 + local.get 1 + i32.store offset=4 + local.get 4 + local.set 5 + local.get 5 + call $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E + call $_ZN5erc204init17hb8a1941cd966bca0E + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 6 + local.get 4 + local.get 6 + i32.store offset=8 + i32.const 8 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + local.set 9 + local.get 9 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 10 + local.get 4 + local.get 10 + i32.store offset=12 + local.get 10 + call $SetOutput + i32.const 16 + local.set 11 + local.get 4 + local.get 11 + i32.add + local.set 12 + local.get 12 + global.set $__stack_pointer + return) + (func $_ZN5erc2014decimalsCaller17he71bae09be07744cE (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 32 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=12 + local.get 4 + local.get 1 + i32.store offset=16 + i32.const 12 + local.set 5 + local.get 4 + local.get 5 + i32.add + local.set 6 + local.get 6 + local.set 7 + local.get 7 + call $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E + call $_ZN5erc208decimals17h59bf7db248d6ac72E + local.set 8 + local.get 4 + local.get 8 + i32.store8 offset=27 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 9 + local.get 9 + local.get 8 + call $_ZN5erc207encoder7Encoder6add_u817h07f8be4f229cdce8E + local.set 10 + local.get 4 + local.get 10 + i32.store offset=20 + i32.const 20 + local.set 11 + local.get 4 + local.get 11 + i32.add + local.set 12 + local.get 12 + local.set 13 + local.get 13 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 14 + local.get 4 + local.get 14 + i32.store offset=28 + local.get 14 + call $SetOutput + i32.const 32 + local.set 15 + local.get 4 + local.get 15 + i32.add + local.set 16 + local.get 16 + global.set $__stack_pointer + return) + (func $_ZN5erc2017totalSupplyCaller17h19d85bde8ed08e83E (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 32 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=12 + local.get 4 + local.get 1 + i32.store offset=16 + i32.const 12 + local.set 5 + local.get 4 + local.get 5 + i32.add + local.set 6 + local.get 6 + local.set 7 + local.get 7 + call $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E + call $_ZN5erc2012total_supply17h87fc8384b37c1eb3E + local.set 8 + local.get 4 + local.get 8 + i32.store offset=20 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 9 + i32.const 20 + local.set 10 + local.get 4 + local.get 10 + i32.add + local.set 11 + local.get 11 + local.set 12 + i32.const 1049036 + local.set 13 + local.get 9 + local.get 12 + local.get 13 + call $_ZN5erc207encoder7Encoder3add17h17efa0f887444fffE + local.set 14 + local.get 4 + local.get 14 + i32.store offset=24 + i32.const 24 + local.set 15 + local.get 4 + local.get 15 + i32.add + local.set 16 + local.get 16 + local.set 17 + local.get 17 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 18 + local.get 4 + local.get 18 + i32.store offset=28 + local.get 18 + call $SetOutput + i32.const 32 + local.set 19 + local.get 4 + local.get 19 + i32.add + local.set 20 + local.get 20 + global.set $__stack_pointer + return) + (func $_ZN5erc2015balanceOfCaller17hacd74ad926b74a92E (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 64 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=52 + local.get 4 + local.get 1 + i32.store offset=56 + local.get 4 + local.get 0 + local.get 1 + call $_ZN5erc207decoder7Decoder13register_data17h88575c688ab44d25E + local.get 4 + i32.load offset=4 + local.set 5 + local.get 4 + i32.load + local.set 6 + local.get 4 + local.get 6 + i32.store offset=12 + local.get 4 + local.get 5 + i32.store offset=16 + i32.const 12 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + local.set 9 + local.get 9 + call $_ZN5erc207decoder7Decoder13validate_data17h6a69297ef76a79f4E + local.get 4 + i32.load offset=12 + local.set 10 + local.get 4 + i32.load offset=16 + local.set 11 + i32.const 32 + local.set 12 + local.get 4 + local.get 12 + i32.add + local.set 13 + local.get 13 + local.set 14 + local.get 14 + local.get 10 + local.get 11 + call $_ZN5erc207decoder7Decoder6decode17h00df42b9df3874b2E + local.get 4 + i32.load offset=32 + local.set 15 + local.get 4 + local.get 15 + i32.store offset=20 + local.get 4 + i32.load offset=36 + local.set 16 + local.get 4 + i32.load offset=40 + local.set 17 + local.get 4 + local.get 16 + i32.store offset=24 + local.get 4 + local.get 17 + i32.store offset=28 + i32.const 24 + local.set 18 + local.get 4 + local.get 18 + i32.add + local.set 19 + local.get 19 + local.set 20 + local.get 20 + call $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E + i32.const 20 + local.set 21 + local.get 4 + local.get 21 + i32.add + local.set 22 + local.get 22 + local.set 23 + local.get 23 + call $_ZN5erc2010balance_of17he55a8cf0bdfa2fdeE + local.set 24 + local.get 4 + local.get 24 + i32.store offset=44 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 25 + i32.const 44 + local.set 26 + local.get 4 + local.get 26 + i32.add + local.set 27 + local.get 27 + local.set 28 + i32.const 1049036 + local.set 29 + local.get 25 + local.get 28 + local.get 29 + call $_ZN5erc207encoder7Encoder3add17h17efa0f887444fffE + local.set 30 + local.get 4 + local.get 30 + i32.store offset=48 + i32.const 48 + local.set 31 + local.get 4 + local.get 31 + i32.add + local.set 32 + local.get 32 + local.set 33 + local.get 33 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 34 + local.get 4 + local.get 34 + i32.store offset=60 + local.get 34 + call $SetOutput + i32.const 64 + local.set 35 + local.get 4 + local.get 35 + i32.add + local.set 36 + local.get 36 + global.set $__stack_pointer + return) + (func $_ZN5erc2014transferCaller17hb9cb5e12a96b30ccE (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 112 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=80 + local.get 4 + local.get 1 + i32.store offset=84 + i32.const 8 + local.set 5 + local.get 4 + local.get 5 + i32.add + local.set 6 + local.get 6 + local.get 0 + local.get 1 + call $_ZN5erc207decoder7Decoder13register_data17h88575c688ab44d25E + local.get 4 + i32.load offset=12 + local.set 7 + local.get 4 + i32.load offset=8 + local.set 8 + local.get 4 + local.get 8 + i32.store offset=88 + local.get 4 + local.get 7 + i32.store offset=92 + i32.const 16 + local.set 9 + local.get 4 + local.get 9 + i32.add + local.set 10 + local.get 10 + local.get 8 + local.get 7 + call $_ZN5erc207decoder7Decoder13register_data17h55c19404ff8904eeE + local.get 4 + i32.load offset=20 + local.set 11 + local.get 4 + i32.load offset=16 + local.set 12 + local.get 4 + local.get 12 + i32.store offset=28 + local.get 4 + local.get 11 + i32.store offset=32 + i32.const 28 + local.set 13 + local.get 4 + local.get 13 + i32.add + local.set 14 + local.get 14 + local.set 15 + local.get 15 + call $_ZN5erc207decoder7Decoder13validate_data17h6a69297ef76a79f4E + local.get 4 + i32.load offset=28 + local.set 16 + local.get 4 + i32.load offset=32 + local.set 17 + i32.const 40 + local.set 18 + local.get 4 + local.get 18 + i32.add + local.set 19 + local.get 19 + local.set 20 + local.get 20 + local.get 16 + local.get 17 + call $_ZN5erc207decoder7Decoder6decode17h00df42b9df3874b2E + local.get 4 + i32.load offset=40 + local.set 21 + local.get 4 + local.get 21 + i32.store offset=36 + local.get 4 + i32.load offset=44 + local.set 22 + local.get 4 + i32.load offset=48 + local.set 23 + local.get 4 + local.get 22 + i32.store offset=96 + local.get 4 + local.get 23 + i32.store offset=100 + i32.const 64 + local.set 24 + local.get 4 + local.get 24 + i32.add + local.set 25 + local.get 25 + local.set 26 + local.get 26 + local.get 22 + local.get 23 + call $_ZN5erc207decoder7Decoder6decode17hb864f87f6e5fc4f7E + local.get 4 + i32.load offset=64 + local.set 27 + local.get 4 + local.get 27 + i32.store offset=52 + local.get 4 + i32.load offset=68 + local.set 28 + local.get 4 + i32.load offset=72 + local.set 29 + local.get 4 + local.get 28 + i32.store offset=56 + local.get 4 + local.get 29 + i32.store offset=60 + i32.const 56 + local.set 30 + local.get 4 + local.get 30 + i32.add + local.set 31 + local.get 31 + local.set 32 + local.get 32 + call $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E + i32.const 36 + local.set 33 + local.get 4 + local.get 33 + i32.add + local.set 34 + local.get 34 + local.set 35 + i32.const 52 + local.set 36 + local.get 4 + local.get 36 + i32.add + local.set 37 + local.get 37 + local.set 38 + local.get 35 + local.get 38 + call $_ZN5erc208transfer17hbdf658bf12731a15E + local.set 39 + i32.const 1 + local.set 40 + local.get 39 + local.get 40 + i32.and + local.set 41 + local.get 4 + local.get 41 + i32.store8 offset=107 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 42 + i32.const 1 + local.set 43 + local.get 39 + local.get 43 + i32.and + local.set 44 + local.get 42 + local.get 44 + call $_ZN5erc207encoder7Encoder8add_bool17hc20e2a4347cfa111E + local.set 45 + local.get 4 + local.get 45 + i32.store offset=76 + i32.const 76 + local.set 46 + local.get 4 + local.get 46 + i32.add + local.set 47 + local.get 47 + local.set 48 + local.get 48 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 49 + local.get 4 + local.get 49 + i32.store offset=108 + local.get 49 + call $SetOutput + i32.const 112 + local.set 50 + local.get 4 + local.get 50 + i32.add + local.set 51 + local.get 51 + global.set $__stack_pointer + return) + (func $_ZN5erc2015allowanceCaller17hda135d575dbf53a2E (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 112 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=84 + local.get 4 + local.get 1 + i32.store offset=88 + i32.const 8 + local.set 5 + local.get 4 + local.get 5 + i32.add + local.set 6 + local.get 6 + local.get 0 + local.get 1 + call $_ZN5erc207decoder7Decoder13register_data17h88575c688ab44d25E + local.get 4 + i32.load offset=12 + local.set 7 + local.get 4 + i32.load offset=8 + local.set 8 + local.get 4 + local.get 8 + i32.store offset=92 + local.get 4 + local.get 7 + i32.store offset=96 + i32.const 16 + local.set 9 + local.get 4 + local.get 9 + i32.add + local.set 10 + local.get 10 + local.get 8 + local.get 7 + call $_ZN5erc207decoder7Decoder13register_data17h88575c688ab44d25E + local.get 4 + i32.load offset=20 + local.set 11 + local.get 4 + i32.load offset=16 + local.set 12 + local.get 4 + local.get 12 + i32.store offset=28 + local.get 4 + local.get 11 + i32.store offset=32 + i32.const 28 + local.set 13 + local.get 4 + local.get 13 + i32.add + local.set 14 + local.get 14 + local.set 15 + local.get 15 + call $_ZN5erc207decoder7Decoder13validate_data17h6a69297ef76a79f4E + local.get 4 + i32.load offset=28 + local.set 16 + local.get 4 + i32.load offset=32 + local.set 17 + i32.const 40 + local.set 18 + local.get 4 + local.get 18 + i32.add + local.set 19 + local.get 19 + local.set 20 + local.get 20 + local.get 16 + local.get 17 + call $_ZN5erc207decoder7Decoder6decode17h00df42b9df3874b2E + local.get 4 + i32.load offset=40 + local.set 21 + local.get 4 + local.get 21 + i32.store offset=36 + local.get 4 + i32.load offset=44 + local.set 22 + local.get 4 + i32.load offset=48 + local.set 23 + local.get 4 + local.get 22 + i32.store offset=100 + local.get 4 + local.get 23 + i32.store offset=104 + i32.const 64 + local.set 24 + local.get 4 + local.get 24 + i32.add + local.set 25 + local.get 25 + local.set 26 + local.get 26 + local.get 22 + local.get 23 + call $_ZN5erc207decoder7Decoder6decode17h00df42b9df3874b2E + local.get 4 + i32.load offset=64 + local.set 27 + local.get 4 + local.get 27 + i32.store offset=52 + local.get 4 + i32.load offset=68 + local.set 28 + local.get 4 + i32.load offset=72 + local.set 29 + local.get 4 + local.get 28 + i32.store offset=56 + local.get 4 + local.get 29 + i32.store offset=60 + i32.const 56 + local.set 30 + local.get 4 + local.get 30 + i32.add + local.set 31 + local.get 31 + local.set 32 + local.get 32 + call $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E + i32.const 36 + local.set 33 + local.get 4 + local.get 33 + i32.add + local.set 34 + local.get 34 + local.set 35 + i32.const 52 + local.set 36 + local.get 4 + local.get 36 + i32.add + local.set 37 + local.get 37 + local.set 38 + local.get 35 + local.get 38 + call $_ZN5erc209allowance17he0018ef6d4537bb9E + local.set 39 + local.get 4 + local.get 39 + i32.store offset=76 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 40 + i32.const 76 + local.set 41 + local.get 4 + local.get 41 + i32.add + local.set 42 + local.get 42 + local.set 43 + i32.const 1049036 + local.set 44 + local.get 40 + local.get 43 + local.get 44 + call $_ZN5erc207encoder7Encoder3add17h17efa0f887444fffE + local.set 45 + local.get 4 + local.get 45 + i32.store offset=80 + i32.const 80 + local.set 46 + local.get 4 + local.get 46 + i32.add + local.set 47 + local.get 47 + local.set 48 + local.get 48 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 49 + local.get 4 + local.get 49 + i32.store offset=108 + local.get 49 + call $SetOutput + i32.const 112 + local.set 50 + local.get 4 + local.get 50 + i32.add + local.set 51 + local.get 51 + global.set $__stack_pointer + return) + (func $_ZN5erc2013approveCaller17h60f9f344ad971562E (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 112 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=80 + local.get 4 + local.get 1 + i32.store offset=84 + i32.const 8 + local.set 5 + local.get 4 + local.get 5 + i32.add + local.set 6 + local.get 6 + local.get 0 + local.get 1 + call $_ZN5erc207decoder7Decoder13register_data17h88575c688ab44d25E + local.get 4 + i32.load offset=12 + local.set 7 + local.get 4 + i32.load offset=8 + local.set 8 + local.get 4 + local.get 8 + i32.store offset=88 + local.get 4 + local.get 7 + i32.store offset=92 + i32.const 16 + local.set 9 + local.get 4 + local.get 9 + i32.add + local.set 10 + local.get 10 + local.get 8 + local.get 7 + call $_ZN5erc207decoder7Decoder13register_data17h55c19404ff8904eeE + local.get 4 + i32.load offset=20 + local.set 11 + local.get 4 + i32.load offset=16 + local.set 12 + local.get 4 + local.get 12 + i32.store offset=28 + local.get 4 + local.get 11 + i32.store offset=32 + i32.const 28 + local.set 13 + local.get 4 + local.get 13 + i32.add + local.set 14 + local.get 14 + local.set 15 + local.get 15 + call $_ZN5erc207decoder7Decoder13validate_data17h6a69297ef76a79f4E + local.get 4 + i32.load offset=28 + local.set 16 + local.get 4 + i32.load offset=32 + local.set 17 + i32.const 40 + local.set 18 + local.get 4 + local.get 18 + i32.add + local.set 19 + local.get 19 + local.set 20 + local.get 20 + local.get 16 + local.get 17 + call $_ZN5erc207decoder7Decoder6decode17h00df42b9df3874b2E + local.get 4 + i32.load offset=40 + local.set 21 + local.get 4 + local.get 21 + i32.store offset=36 + local.get 4 + i32.load offset=44 + local.set 22 + local.get 4 + i32.load offset=48 + local.set 23 + local.get 4 + local.get 22 + i32.store offset=96 + local.get 4 + local.get 23 + i32.store offset=100 + i32.const 64 + local.set 24 + local.get 4 + local.get 24 + i32.add + local.set 25 + local.get 25 + local.set 26 + local.get 26 + local.get 22 + local.get 23 + call $_ZN5erc207decoder7Decoder6decode17hb864f87f6e5fc4f7E + local.get 4 + i32.load offset=64 + local.set 27 + local.get 4 + local.get 27 + i32.store offset=52 + local.get 4 + i32.load offset=68 + local.set 28 + local.get 4 + i32.load offset=72 + local.set 29 + local.get 4 + local.get 28 + i32.store offset=56 + local.get 4 + local.get 29 + i32.store offset=60 + i32.const 56 + local.set 30 + local.get 4 + local.get 30 + i32.add + local.set 31 + local.get 31 + local.set 32 + local.get 32 + call $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E + i32.const 36 + local.set 33 + local.get 4 + local.get 33 + i32.add + local.set 34 + local.get 34 + local.set 35 + i32.const 52 + local.set 36 + local.get 4 + local.get 36 + i32.add + local.set 37 + local.get 37 + local.set 38 + local.get 35 + local.get 38 + call $_ZN5erc207approve17hfd7d0deff82a5397E + local.set 39 + i32.const 1 + local.set 40 + local.get 39 + local.get 40 + i32.and + local.set 41 + local.get 4 + local.get 41 + i32.store8 offset=107 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 42 + i32.const 1 + local.set 43 + local.get 39 + local.get 43 + i32.and + local.set 44 + local.get 42 + local.get 44 + call $_ZN5erc207encoder7Encoder8add_bool17hc20e2a4347cfa111E + local.set 45 + local.get 4 + local.get 45 + i32.store offset=76 + i32.const 76 + local.set 46 + local.get 4 + local.get 46 + i32.add + local.set 47 + local.get 47 + local.set 48 + local.get 48 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 49 + local.get 4 + local.get 49 + i32.store offset=108 + local.get 49 + call $SetOutput + i32.const 112 + local.set 50 + local.get 4 + local.get 50 + i32.add + local.set 51 + local.get 51 + global.set $__stack_pointer + return) + (func $_ZN5erc2018transferFromCaller17h6d9ea98cf4e7c9e0E (type 1) (param i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 144 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=96 + local.get 4 + local.get 1 + i32.store offset=100 + local.get 4 + local.get 0 + local.get 1 + call $_ZN5erc207decoder7Decoder13register_data17h88575c688ab44d25E + local.get 4 + i32.load offset=4 + local.set 5 + local.get 4 + i32.load + local.set 6 + local.get 4 + local.get 6 + i32.store offset=104 + local.get 4 + local.get 5 + i32.store offset=108 + i32.const 8 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + local.get 6 + local.get 5 + call $_ZN5erc207decoder7Decoder13register_data17h88575c688ab44d25E + local.get 4 + i32.load offset=12 + local.set 9 + local.get 4 + i32.load offset=8 + local.set 10 + local.get 4 + local.get 10 + i32.store offset=112 + local.get 4 + local.get 9 + i32.store offset=116 + i32.const 16 + local.set 11 + local.get 4 + local.get 11 + i32.add + local.set 12 + local.get 12 + local.get 10 + local.get 9 + call $_ZN5erc207decoder7Decoder13register_data17h55c19404ff8904eeE + local.get 4 + i32.load offset=20 + local.set 13 + local.get 4 + i32.load offset=16 + local.set 14 + local.get 4 + local.get 14 + i32.store offset=28 + local.get 4 + local.get 13 + i32.store offset=32 + i32.const 28 + local.set 15 + local.get 4 + local.get 15 + i32.add + local.set 16 + local.get 16 + local.set 17 + local.get 17 + call $_ZN5erc207decoder7Decoder13validate_data17h6a69297ef76a79f4E + local.get 4 + i32.load offset=28 + local.set 18 + local.get 4 + i32.load offset=32 + local.set 19 + i32.const 40 + local.set 20 + local.get 4 + local.get 20 + i32.add + local.set 21 + local.get 21 + local.set 22 + local.get 22 + local.get 18 + local.get 19 + call $_ZN5erc207decoder7Decoder6decode17h00df42b9df3874b2E + local.get 4 + i32.load offset=40 + local.set 23 + local.get 4 + local.get 23 + i32.store offset=36 + local.get 4 + i32.load offset=44 + local.set 24 + local.get 4 + i32.load offset=48 + local.set 25 + local.get 4 + local.get 24 + i32.store offset=120 + local.get 4 + local.get 25 + i32.store offset=124 + i32.const 56 + local.set 26 + local.get 4 + local.get 26 + i32.add + local.set 27 + local.get 27 + local.set 28 + local.get 28 + local.get 24 + local.get 25 + call $_ZN5erc207decoder7Decoder6decode17h00df42b9df3874b2E + local.get 4 + i32.load offset=56 + local.set 29 + local.get 4 + local.get 29 + i32.store offset=52 + local.get 4 + i32.load offset=60 + local.set 30 + local.get 4 + i32.load offset=64 + local.set 31 + local.get 4 + local.get 30 + i32.store offset=128 + local.get 4 + local.get 31 + i32.store offset=132 + i32.const 80 + local.set 32 + local.get 4 + local.get 32 + i32.add + local.set 33 + local.get 33 + local.set 34 + local.get 34 + local.get 30 + local.get 31 + call $_ZN5erc207decoder7Decoder6decode17hb864f87f6e5fc4f7E + local.get 4 + i32.load offset=80 + local.set 35 + local.get 4 + local.get 35 + i32.store offset=68 + local.get 4 + i32.load offset=84 + local.set 36 + local.get 4 + i32.load offset=88 + local.set 37 + local.get 4 + local.get 36 + i32.store offset=72 + local.get 4 + local.get 37 + i32.store offset=76 + i32.const 72 + local.set 38 + local.get 4 + local.get 38 + i32.add + local.set 39 + local.get 39 + local.set 40 + local.get 40 + call $_ZN5erc207decoder7Decoder10check_done17hf6c42598ea2ea148E + i32.const 36 + local.set 41 + local.get 4 + local.get 41 + i32.add + local.set 42 + local.get 42 + local.set 43 + i32.const 52 + local.set 44 + local.get 4 + local.get 44 + i32.add + local.set 45 + local.get 45 + local.set 46 + i32.const 68 + local.set 47 + local.get 4 + local.get 47 + i32.add + local.set 48 + local.get 48 + local.set 49 + local.get 43 + local.get 46 + local.get 49 + call $_ZN5erc2013transfer_from17h9d8bb371a9402da0E + local.set 50 + i32.const 1 + local.set 51 + local.get 50 + local.get 51 + i32.and + local.set 52 + local.get 4 + local.get 52 + i32.store8 offset=139 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 53 + i32.const 1 + local.set 54 + local.get 50 + local.get 54 + i32.and + local.set 55 + local.get 53 + local.get 55 + call $_ZN5erc207encoder7Encoder8add_bool17hc20e2a4347cfa111E + local.set 56 + local.get 4 + local.get 56 + i32.store offset=92 + i32.const 92 + local.set 57 + local.get 4 + local.get 57 + i32.add + local.set 58 + local.get 58 + local.set 59 + local.get 59 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 60 + local.get 4 + local.get 60 + i32.store offset=140 + local.get 60 + call $SetOutput + i32.const 144 + local.set 61 + local.get 4 + local.get 61 + i32.add + local.set 62 + local.get 62 + global.set $__stack_pointer + return) + (func $_ZN5erc2014s_total_supply17hd3bc498a99699e53E (type 4) (result i32) + (local i32 i32 i32 i32) + i32.const 1048974 + local.set 0 + i32.const 12 + local.set 1 + local.get 0 + local.get 1 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$3new17h4c1afdcf2aa53cfeE + local.set 2 + local.get 2 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$5build17haf899c3202fbea93E + local.set 3 + local.get 3 + return) + (func $_ZN5erc2010s_balances17hf1a4ae8b529bd265E (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=12 + i32.const 1048974 + local.set 4 + i32.const 12 + local.set 5 + local.get 4 + local.get 5 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$3new17h4c1afdcf2aa53cfeE + local.set 6 + i32.const 1048988 + local.set 7 + local.get 6 + local.get 0 + local.get 7 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$8with_arg17hb79a0694916ff152E + local.set 8 + local.get 8 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$5build17haf899c3202fbea93E + local.set 9 + i32.const 16 + local.set 10 + local.get 3 + local.get 10 + i32.add + local.set 11 + local.get 11 + global.set $__stack_pointer + local.get 9 + return) + (func $_ZN5erc2012s_allowances17hca9647a0c16ee44aE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + i32.const 1048974 + local.set 5 + i32.const 12 + local.set 6 + local.get 5 + local.get 6 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$3new17h4c1afdcf2aa53cfeE + local.set 7 + i32.const 1048988 + local.set 8 + local.get 7 + local.get 0 + local.get 8 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$8with_arg17hb79a0694916ff152E + local.set 9 + i32.const 1048988 + local.set 10 + local.get 9 + local.get 1 + local.get 10 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$8with_arg17hb79a0694916ff152E + local.set 11 + local.get 11 + call $_ZN5erc2012value_mapper41SingleValueMapperBuilder$LT$ValueType$GT$5build17haf899c3202fbea93E + local.set 12 + i32.const 16 + local.set 13 + local.get 4 + local.get 13 + i32.add + local.set 14 + local.get 14 + global.set $__stack_pointer + local.get 12 + return) + (func $_ZN5erc2014transfer_event17hbaaef7b97e8addd6E (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 32 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=20 + local.get 5 + local.get 1 + i32.store offset=24 + local.get 5 + local.get 2 + i32.store offset=28 + local.get 0 + call $_ZN92_$LT$$RF$erc20..address..Address$u20$as$u20$core..convert..Into$LT$erc20..u256..U256$GT$$GT$4into17hfaa8bb23fc92c9b2E + local.set 6 + local.get 1 + call $_ZN92_$LT$$RF$erc20..address..Address$u20$as$u20$core..convert..Into$LT$erc20..u256..U256$GT$$GT$4into17hfaa8bb23fc92c9b2E + local.set 7 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 8 + i32.const 1049036 + local.set 9 + local.get 8 + local.get 2 + local.get 9 + call $_ZN5erc207encoder7Encoder3add17h17efa0f887444fffE + local.set 10 + local.get 5 + local.get 10 + i32.store offset=16 + i32.const 16 + local.set 11 + local.get 5 + local.get 11 + i32.add + local.set 12 + local.get 12 + local.set 13 + local.get 13 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 14 + local.get 5 + local.get 14 + i32.store offset=12 + i32.const 1049004 + local.set 15 + i32.const 30 + local.set 16 + i32.const 12 + local.set 17 + local.get 5 + local.get 17 + i32.add + local.set 18 + local.get 18 + local.set 19 + local.get 15 + local.get 16 + local.get 6 + local.get 7 + local.get 19 + call $_ZN5erc204log317hd2e263bf345704ecE + i32.const 32 + local.set 20 + local.get 5 + local.get 20 + i32.add + local.set 21 + local.get 21 + global.set $__stack_pointer + return) + (func $_ZN5erc2014approval_event17h3f2392765a8bf115E (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 32 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=20 + local.get 5 + local.get 1 + i32.store offset=24 + local.get 5 + local.get 2 + i32.store offset=28 + local.get 0 + call $_ZN92_$LT$$RF$erc20..address..Address$u20$as$u20$core..convert..Into$LT$erc20..u256..U256$GT$$GT$4into17hfaa8bb23fc92c9b2E + local.set 6 + local.get 1 + call $_ZN92_$LT$$RF$erc20..address..Address$u20$as$u20$core..convert..Into$LT$erc20..u256..U256$GT$$GT$4into17hfaa8bb23fc92c9b2E + local.set 7 + call $_ZN5erc207encoder7Encoder3new17h851bfd79371892adE + local.set 8 + i32.const 1049036 + local.set 9 + local.get 8 + local.get 2 + local.get 9 + call $_ZN5erc207encoder7Encoder3add17h17efa0f887444fffE + local.set 10 + local.get 5 + local.get 10 + i32.store offset=16 + i32.const 16 + local.set 11 + local.get 5 + local.get 11 + i32.add + local.set 12 + local.get 12 + local.set 13 + local.get 13 + call $_ZN5erc207encoder7Encoder5build17hf6cd92c93adac35dE + local.set 14 + local.get 5 + local.get 14 + i32.store offset=12 + i32.const 1049052 + local.set 15 + i32.const 30 + local.set 16 + i32.const 12 + local.set 17 + local.get 5 + local.get 17 + i32.add + local.set 18 + local.get 18 + local.set 19 + local.get 15 + local.get 16 + local.get 6 + local.get 7 + local.get 19 + call $_ZN5erc204log317hd2e263bf345704ecE + i32.const 32 + local.set 20 + local.get 5 + local.get 20 + i32.add + local.set 21 + local.get 21 + global.set $__stack_pointer + return) + (func $_ZN5erc204init17hb8a1941cd966bca0E (type 11) + return) + (func $_ZN5erc208decimals17h59bf7db248d6ac72E (type 4) (result i32) + (local i32) + i32.const 18 + local.set 0 + local.get 0 + return) + (func $_ZN5erc2012total_supply17h87fc8384b37c1eb3E (type 4) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 0 + i32.const 16 + local.set 1 + local.get 0 + local.get 1 + i32.sub + local.set 2 + local.get 2 + global.set $__stack_pointer + call $_ZN5erc2014s_total_supply17hd3bc498a99699e53E + local.set 3 + local.get 2 + local.get 3 + i32.store offset=12 + i32.const 12 + local.set 4 + local.get 2 + local.get 4 + i32.add + local.set 5 + local.get 5 + local.set 6 + local.get 6 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE + local.set 7 + i32.const 16 + local.set 8 + local.get 2 + local.get 8 + i32.add + local.set 9 + local.get 9 + global.set $__stack_pointer + local.get 7 + return) + (func $_ZN5erc2010balance_of17he55a8cf0bdfa2fdeE (type 2) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 1 + i32.const 16 + local.set 2 + local.get 1 + local.get 2 + i32.sub + local.set 3 + local.get 3 + global.set $__stack_pointer + local.get 3 + local.get 0 + i32.store offset=12 + local.get 0 + call $_ZN5erc2010s_balances17hf1a4ae8b529bd265E + local.set 4 + local.get 3 + local.get 4 + i32.store offset=8 + i32.const 8 + local.set 5 + local.get 3 + local.get 5 + i32.add + local.set 6 + local.get 6 + local.set 7 + local.get 7 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE + local.set 8 + i32.const 16 + local.set 9 + local.get 3 + local.get 9 + i32.add + local.set 10 + local.get 10 + global.set $__stack_pointer + local.get 8 + return) + (func $_ZN5erc208transfer17hbdf658bf12731a15E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 1 + i32.store offset=4 + local.get 4 + local.get 0 + i32.store offset=12 + call $_ZN5erc2013CallerWrapper17hcc834606c06a9aefE + local.set 5 + local.get 4 + local.get 5 + i32.store offset=8 + local.get 4 + i32.load offset=4 + local.set 6 + i32.const 8 + local.set 7 + local.get 4 + local.get 7 + i32.add + local.set 8 + local.get 8 + local.set 9 + local.get 9 + local.get 0 + local.get 6 + call $_ZN5erc209_transfer17h05806431990d16b6E + i32.const 1 + local.set 10 + i32.const 1 + local.set 11 + local.get 10 + local.get 11 + i32.and + local.set 12 + i32.const 16 + local.set 13 + local.get 4 + local.get 13 + i32.add + local.set 14 + local.get 14 + global.set $__stack_pointer + local.get 12 + return) + (func $_ZN5erc209_transfer17h05806431990d16b6E (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 16 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=4 + local.get 5 + local.get 1 + i32.store offset=8 + local.get 5 + local.get 2 + i32.store offset=12 + local.get 0 + call $_ZN5erc207address7Address7is_zero17hf086e03baaa13a2eE + local.set 6 + i32.const 1 + local.set 7 + local.get 6 + local.get 7 + i32.and + local.set 8 + block ;; label = @1 + local.get 8 + br_if 0 (;@1;) + i32.const 1049082 + local.set 9 + i32.const 14 + local.set 10 + local.get 9 + local.get 10 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable + end + local.get 1 + call $_ZN5erc207address7Address7is_zero17hf086e03baaa13a2eE + local.set 11 + i32.const 1 + local.set 12 + local.get 11 + local.get 12 + i32.and + local.set 13 + block ;; label = @1 + local.get 13 + br_if 0 (;@1;) + i32.const 1049096 + local.set 14 + i32.const 16 + local.set 15 + local.get 14 + local.get 15 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable + end + local.get 0 + local.get 1 + local.get 2 + call $_ZN5erc207_update17h59ea8c47a5eaa44cE + local.get 0 + local.get 1 + local.get 2 + call $_ZN5erc2014transfer_event17hbaaef7b97e8addd6E + i32.const 16 + local.set 16 + local.get 5 + local.get 16 + i32.add + local.set 17 + local.get 17 + global.set $__stack_pointer + return) + (func $_ZN5erc209allowance17he0018ef6d4537bb9E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + local.get 1 + call $_ZN5erc2012s_allowances17hca9647a0c16ee44aE + local.set 5 + local.get 4 + local.get 5 + i32.store offset=4 + i32.const 4 + local.set 6 + local.get 4 + local.get 6 + i32.add + local.set 7 + local.get 7 + local.set 8 + local.get 8 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE + local.set 9 + i32.const 16 + local.set 10 + local.get 4 + local.get 10 + i32.add + local.set 11 + local.get 11 + global.set $__stack_pointer + local.get 9 + return) + (func $_ZN5erc207approve17hfd7d0deff82a5397E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + call $_ZN5erc2013CallerWrapper17hcc834606c06a9aefE + local.set 5 + local.get 4 + local.get 5 + i32.store offset=4 + i32.const 4 + local.set 6 + local.get 4 + local.get 6 + i32.add + local.set 7 + local.get 7 + local.set 8 + i32.const 1 + local.set 9 + i32.const 1 + local.set 10 + local.get 9 + local.get 10 + i32.and + local.set 11 + local.get 8 + local.get 0 + local.get 1 + local.get 11 + call $_ZN5erc208_approve17h811598e0ace302e5E + i32.const 1 + local.set 12 + i32.const 1 + local.set 13 + local.get 12 + local.get 13 + i32.and + local.set 14 + i32.const 16 + local.set 15 + local.get 4 + local.get 15 + i32.add + local.set 16 + local.get 16 + global.set $__stack_pointer + local.get 14 + return) + (func $_ZN5erc208_approve17h811598e0ace302e5E (type 6) (param i32 i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 4 + i32.const 32 + local.set 5 + local.get 4 + local.get 5 + i32.sub + local.set 6 + local.get 6 + global.set $__stack_pointer + local.get 6 + local.get 2 + i32.store offset=12 + local.get 6 + local.get 0 + i32.store offset=20 + local.get 6 + local.get 1 + i32.store offset=24 + local.get 3 + local.set 7 + local.get 6 + local.get 7 + i32.store8 offset=31 + local.get 0 + call $_ZN5erc207address7Address7is_zero17hf086e03baaa13a2eE + local.set 8 + i32.const 1 + local.set 9 + local.get 8 + local.get 9 + i32.and + local.set 10 + block ;; label = @1 + local.get 10 + br_if 0 (;@1;) + i32.const 1049132 + local.set 11 + i32.const 16 + local.set 12 + local.get 11 + local.get 12 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable + end + local.get 1 + call $_ZN5erc207address7Address7is_zero17hf086e03baaa13a2eE + local.set 13 + i32.const 1 + local.set 14 + local.get 13 + local.get 14 + i32.and + local.set 15 + block ;; label = @1 + local.get 15 + br_if 0 (;@1;) + i32.const 1049148 + local.set 16 + i32.const 15 + local.set 17 + local.get 16 + local.get 17 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable + end + local.get 0 + local.get 1 + call $_ZN5erc2012s_allowances17hca9647a0c16ee44aE + local.set 18 + local.get 6 + local.get 18 + i32.store offset=16 + local.get 6 + i32.load offset=12 + local.set 19 + local.get 19 + call $_ZN62_$LT$erc20..balance..Balance$u20$as$u20$core..clone..Clone$GT$5clone17hfc85203d540af18aE + local.set 20 + i32.const 16 + local.set 21 + local.get 6 + local.get 21 + i32.add + local.set 22 + local.get 22 + local.set 23 + local.get 23 + local.get 20 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3set17h32ecd24cf2981267E + local.get 3 + local.set 24 + block ;; label = @1 + local.get 24 + i32.eqz + br_if 0 (;@1;) + local.get 6 + i32.load offset=12 + local.set 25 + local.get 0 + local.get 1 + local.get 25 + call $_ZN5erc2014approval_event17h3f2392765a8bf115E + end + i32.const 32 + local.set 26 + local.get 6 + local.get 26 + i32.add + local.set 27 + local.get 27 + global.set $__stack_pointer + return) + (func $_ZN5erc2013transfer_from17h9d8bb371a9402da0E (type 3) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 16 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 0 + i32.store offset=4 + local.get 5 + local.get 1 + i32.store offset=8 + local.get 5 + local.get 2 + i32.store offset=12 + call $_ZN5erc2013CallerWrapper17hcc834606c06a9aefE + local.set 6 + local.get 5 + local.get 6 + i32.store + local.get 5 + local.set 7 + local.get 0 + local.get 7 + local.get 2 + call $_ZN5erc2016_spend_allowance17h0e433499c925c210E + local.get 0 + local.get 1 + local.get 2 + call $_ZN5erc209_transfer17h05806431990d16b6E + i32.const 1 + local.set 8 + i32.const 1 + local.set 9 + local.get 8 + local.get 9 + i32.and + local.set 10 + i32.const 16 + local.set 11 + local.get 5 + local.get 11 + i32.add + local.set 12 + local.get 12 + global.set $__stack_pointer + local.get 10 + return) + (func $_ZN5erc2016_spend_allowance17h0e433499c925c210E (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 32 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 2 + i32.store offset=8 + local.get 5 + local.get 0 + i32.store offset=24 + local.get 5 + local.get 1 + i32.store offset=28 + local.get 0 + local.get 1 + call $_ZN5erc209allowance17he0018ef6d4537bb9E + local.set 6 + local.get 5 + local.get 6 + i32.store offset=12 + i32.const 12 + local.set 7 + local.get 5 + local.get 7 + i32.add + local.set 8 + local.get 8 + local.set 9 + local.get 5 + local.get 9 + i32.store offset=16 + i32.const 8 + local.set 10 + local.get 5 + local.get 10 + i32.add + local.set 11 + local.get 11 + local.set 12 + i32.const 16 + local.set 13 + local.get 5 + local.get 13 + i32.add + local.set 14 + local.get 14 + local.set 15 + local.get 12 + local.get 15 + call $_ZN4core3cmp5impls70_$LT$impl$u20$core..cmp..PartialOrd$LT$$RF$B$GT$$u20$for$u20$$RF$A$GT$2le17hbd011d94f76634d3E + local.set 16 + i32.const 1 + local.set 17 + local.get 16 + local.get 17 + i32.and + local.set 18 + block ;; label = @1 + local.get 18 + br_if 0 (;@1;) + local.get 5 + i32.load offset=12 + local.set 19 + local.get 5 + i32.load offset=8 + local.set 20 + local.get 19 + local.get 20 + call $_ZN100_$LT$erc20..balance..Balance$u20$as$u20$core..ops..arith..Sub$LT$$RF$erc20..balance..Balance$GT$$GT$3sub17hcf783bc0487d51e9E + local.set 21 + local.get 5 + local.get 21 + i32.store offset=20 + i32.const 20 + local.set 22 + local.get 5 + local.get 22 + i32.add + local.set 23 + local.get 23 + local.set 24 + i32.const 0 + local.set 25 + i32.const 1 + local.set 26 + local.get 25 + local.get 26 + i32.and + local.set 27 + local.get 0 + local.get 1 + local.get 24 + local.get 27 + call $_ZN5erc208_approve17h811598e0ace302e5E + i32.const 32 + local.set 28 + local.get 5 + local.get 28 + i32.add + local.set 29 + local.get 29 + global.set $__stack_pointer + return + end + i32.const 1049163 + local.set 30 + i32.const 21 + local.set 31 + local.get 30 + local.get 31 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable) + (func $_ZN5erc207_update17h59ea8c47a5eaa44cE (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 64 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 2 + i32.store offset=8 + local.get 5 + local.get 0 + i32.store offset=56 + local.get 5 + local.get 1 + i32.store offset=60 + local.get 0 + call $_ZN5erc207address7Address7is_zero17hf086e03baaa13a2eE + local.set 6 + i32.const 1 + local.set 7 + local.get 6 + local.get 7 + i32.and + local.set 8 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + local.get 8 + br_if 0 (;@4;) + local.get 0 + call $_ZN5erc2010s_balances17hf1a4ae8b529bd265E + local.set 9 + local.get 5 + local.get 9 + i32.store offset=24 + i32.const 24 + local.set 10 + local.get 5 + local.get 10 + i32.add + local.set 11 + local.get 11 + local.set 12 + local.get 12 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE + local.set 13 + local.get 5 + local.get 13 + i32.store offset=20 + i32.const 20 + local.set 14 + local.get 5 + local.get 14 + i32.add + local.set 15 + local.get 15 + local.set 16 + local.get 5 + local.get 16 + i32.store offset=28 + i32.const 8 + local.set 17 + local.get 5 + local.get 17 + i32.add + local.set 18 + local.get 18 + local.set 19 + i32.const 28 + local.set 20 + local.get 5 + local.get 20 + i32.add + local.set 21 + local.get 21 + local.set 22 + local.get 19 + local.get 22 + call $_ZN4core3cmp5impls70_$LT$impl$u20$core..cmp..PartialOrd$LT$$RF$B$GT$$u20$for$u20$$RF$A$GT$2le17hbd011d94f76634d3E + local.set 23 + i32.const 1 + local.set 24 + local.get 23 + local.get 24 + i32.and + local.set 25 + local.get 25 + br_if 2 (;@2;) + br 1 (;@3;) + end + call $_ZN5erc2014s_total_supply17hd3bc498a99699e53E + local.set 26 + local.get 5 + local.get 26 + i32.store offset=12 + call $_ZN5erc2014s_total_supply17hd3bc498a99699e53E + local.set 27 + local.get 5 + local.get 27 + i32.store offset=16 + i32.const 16 + local.set 28 + local.get 5 + local.get 28 + i32.add + local.set 29 + local.get 29 + local.set 30 + local.get 30 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE + local.set 31 + local.get 5 + i32.load offset=8 + local.set 32 + local.get 31 + local.get 32 + call $_ZN100_$LT$erc20..balance..Balance$u20$as$u20$core..ops..arith..Add$LT$$RF$erc20..balance..Balance$GT$$GT$3add17hffe4c1029010cb2fE + local.set 33 + i32.const 12 + local.set 34 + local.get 5 + local.get 34 + i32.add + local.set 35 + local.get 35 + local.set 36 + local.get 36 + local.get 33 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3set17h32ecd24cf2981267E + br 2 (;@1;) + end + local.get 0 + call $_ZN5erc2010s_balances17hf1a4ae8b529bd265E + local.set 37 + local.get 5 + local.get 37 + i32.store offset=32 + local.get 0 + call $_ZN5erc2010s_balances17hf1a4ae8b529bd265E + local.set 38 + local.get 5 + local.get 38 + i32.store offset=36 + i32.const 36 + local.set 39 + local.get 5 + local.get 39 + i32.add + local.set 40 + local.get 40 + local.set 41 + local.get 41 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE + local.set 42 + local.get 5 + i32.load offset=8 + local.set 43 + local.get 42 + local.get 43 + call $_ZN100_$LT$erc20..balance..Balance$u20$as$u20$core..ops..arith..Sub$LT$$RF$erc20..balance..Balance$GT$$GT$3sub17hcf783bc0487d51e9E + local.set 44 + i32.const 32 + local.set 45 + local.get 5 + local.get 45 + i32.add + local.set 46 + local.get 46 + local.set 47 + local.get 47 + local.get 44 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3set17h32ecd24cf2981267E + br 1 (;@1;) + end + i32.const 1049112 + local.set 48 + i32.const 20 + local.set 49 + local.get 48 + local.get 49 + call $_ZN5erc2010assertions4fail17h770341421e219d38E + unreachable + end + local.get 1 + call $_ZN5erc207address7Address7is_zero17hf086e03baaa13a2eE + local.set 50 + i32.const 1 + local.set 51 + local.get 50 + local.get 51 + i32.and + local.set 52 + block ;; label = @1 + block ;; label = @2 + local.get 52 + br_if 0 (;@2;) + local.get 1 + call $_ZN5erc2010s_balances17hf1a4ae8b529bd265E + local.set 53 + local.get 5 + local.get 53 + i32.store offset=48 + local.get 1 + call $_ZN5erc2010s_balances17hf1a4ae8b529bd265E + local.set 54 + local.get 5 + local.get 54 + i32.store offset=52 + i32.const 52 + local.set 55 + local.get 5 + local.get 55 + i32.add + local.set 56 + local.get 56 + local.set 57 + local.get 57 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE + local.set 58 + local.get 5 + i32.load offset=8 + local.set 59 + local.get 58 + local.get 59 + call $_ZN100_$LT$erc20..balance..Balance$u20$as$u20$core..ops..arith..Add$LT$$RF$erc20..balance..Balance$GT$$GT$3add17hffe4c1029010cb2fE + local.set 60 + i32.const 48 + local.set 61 + local.get 5 + local.get 61 + i32.add + local.set 62 + local.get 62 + local.set 63 + local.get 63 + local.get 60 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3set17h32ecd24cf2981267E + br 1 (;@1;) + end + call $_ZN5erc2014s_total_supply17hd3bc498a99699e53E + local.set 64 + local.get 5 + local.get 64 + i32.store offset=40 + call $_ZN5erc2014s_total_supply17hd3bc498a99699e53E + local.set 65 + local.get 5 + local.get 65 + i32.store offset=44 + i32.const 44 + local.set 66 + local.get 5 + local.get 66 + i32.add + local.set 67 + local.get 67 + local.set 68 + local.get 68 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3get17hd6ab0d6797ac0cabE + local.set 69 + local.get 5 + i32.load offset=8 + local.set 70 + local.get 69 + local.get 70 + call $_ZN100_$LT$erc20..balance..Balance$u20$as$u20$core..ops..arith..Sub$LT$$RF$erc20..balance..Balance$GT$$GT$3sub17hcf783bc0487d51e9E + local.set 71 + i32.const 40 + local.set 72 + local.get 5 + local.get 72 + i32.add + local.set 73 + local.get 73 + local.set 74 + local.get 74 + local.get 71 + call $_ZN5erc2012value_mapper34SingleValueMapper$LT$ValueType$GT$3set17h32ecd24cf2981267E + end + i32.const 64 + local.set 75 + local.get 5 + local.get 75 + i32.add + local.set 76 + local.get 76 + global.set $__stack_pointer + return) + (func $_ZN5erc207decoder7Decoder13register_data17h55c19404ff8904eeE (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 32 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 1 + i32.store offset=20 + local.get 5 + local.get 2 + i32.store offset=24 + call $_ZN69_$LT$erc20..balance..Balance$u20$as$u20$erc20..decoder..Decodable$GT$17encoded_head_size17h1c4146462953415bE + local.set 6 + call $_ZN69_$LT$erc20..balance..Balance$u20$as$u20$erc20..decoder..Decodable$GT$18is_variable_length17h083f63e4ebcd9366E + local.set 7 + local.get 1 + local.get 6 + local.get 7 + call $decoderRegister + local.set 8 + local.get 5 + local.get 8 + i32.store offset=28 + local.get 5 + local.get 8 + i32.store offset=12 + local.get 5 + local.get 2 + i32.store offset=16 + local.get 5 + i32.load offset=12 + local.set 9 + local.get 5 + i32.load offset=16 + local.set 10 + local.get 0 + local.get 10 + i32.store offset=4 + local.get 0 + local.get 9 + i32.store + i32.const 32 + local.set 11 + local.get 5 + local.get 11 + i32.add + local.set 12 + local.get 12 + global.set $__stack_pointer + return) + (func $_ZN5erc207decoder7Decoder13register_data17h88575c688ab44d25E (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 32 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 1 + i32.store offset=20 + local.get 5 + local.get 2 + i32.store offset=24 + call $_ZN69_$LT$erc20..address..Address$u20$as$u20$erc20..decoder..Decodable$GT$17encoded_head_size17h5b675d0368481b09E + local.set 6 + call $_ZN69_$LT$erc20..address..Address$u20$as$u20$erc20..decoder..Decodable$GT$18is_variable_length17hed2c5fe86201076eE + local.set 7 + local.get 1 + local.get 6 + local.get 7 + call $decoderRegister + local.set 8 + local.get 5 + local.get 8 + i32.store offset=28 + local.get 5 + local.get 8 + i32.store offset=12 + local.get 5 + local.get 2 + i32.store offset=16 + local.get 5 + i32.load offset=12 + local.set 9 + local.get 5 + i32.load offset=16 + local.set 10 + local.get 0 + local.get 10 + i32.store offset=4 + local.get 0 + local.get 9 + i32.store + i32.const 32 + local.set 11 + local.get 5 + local.get 11 + i32.add + local.set 12 + local.get 12 + global.set $__stack_pointer + return) + (func $_ZN5erc207decoder7Decoder6decode17h00df42b9df3874b2E (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 32 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 1 + i32.store offset=20 + local.get 5 + local.get 2 + i32.store offset=24 + local.get 1 + local.get 2 + call $decodeExtractBytes + local.set 6 + local.get 6 + call $_ZN5erc205bytes5Bytes7from_id17h2e02cd3fb3c0d3d8E + local.set 7 + local.get 5 + local.get 7 + i32.store offset=28 + i32.const 1 + local.set 8 + local.get 2 + local.get 8 + i32.add + local.set 9 + local.get 9 + i32.eqz + local.set 10 + i32.const 1 + local.set 11 + local.get 10 + local.get 11 + i32.and + local.set 12 + block ;; label = @1 + local.get 12 + br_if 0 (;@1;) + local.get 5 + local.get 1 + i32.store offset=12 + local.get 5 + local.get 9 + i32.store offset=16 + local.get 7 + call $_ZN69_$LT$erc20..address..Address$u20$as$u20$erc20..decoder..Decodable$GT$6decode17h4ddec667a8dbb3bdE + local.set 13 + local.get 0 + local.get 13 + i32.store + local.get 5 + i32.load offset=12 + local.set 14 + local.get 5 + i32.load offset=16 + local.set 15 + local.get 0 + local.get 14 + i32.store offset=4 + local.get 0 + local.get 15 + i32.store offset=8 + i32.const 32 + local.set 16 + local.get 5 + local.get 16 + i32.add + local.set 17 + local.get 17 + global.set $__stack_pointer + return + end + i32.const 1049200 + local.set 18 + local.get 18 + call $_ZN4core9panicking11panic_const24panic_const_add_overflow17hde776086e9d58b0fE + unreachable) + (func $_ZN5erc207decoder7Decoder6decode17hb864f87f6e5fc4f7E (type 10) (param i32 i32 i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 3 + i32.const 32 + local.set 4 + local.get 3 + local.get 4 + i32.sub + local.set 5 + local.get 5 + global.set $__stack_pointer + local.get 5 + local.get 1 + i32.store offset=20 + local.get 5 + local.get 2 + i32.store offset=24 + local.get 1 + local.get 2 + call $decodeExtractBytes + local.set 6 + local.get 6 + call $_ZN5erc205bytes5Bytes7from_id17h2e02cd3fb3c0d3d8E + local.set 7 + local.get 5 + local.get 7 + i32.store offset=28 + i32.const 1 + local.set 8 + local.get 2 + local.get 8 + i32.add + local.set 9 + local.get 9 + i32.eqz + local.set 10 + i32.const 1 + local.set 11 + local.get 10 + local.get 11 + i32.and + local.set 12 + block ;; label = @1 + local.get 12 + br_if 0 (;@1;) + local.get 5 + local.get 1 + i32.store offset=12 + local.get 5 + local.get 9 + i32.store offset=16 + local.get 7 + call $_ZN69_$LT$erc20..balance..Balance$u20$as$u20$erc20..decoder..Decodable$GT$6decode17h19af32acb5a50a6eE + local.set 13 + local.get 0 + local.get 13 + i32.store + local.get 5 + i32.load offset=12 + local.set 14 + local.get 5 + i32.load offset=16 + local.set 15 + local.get 0 + local.get 14 + i32.store offset=4 + local.get 0 + local.get 15 + i32.store offset=8 + i32.const 32 + local.set 16 + local.get 5 + local.get 16 + i32.add + local.set 17 + local.get 17 + global.set $__stack_pointer + return + end + i32.const 1049200 + local.set 18 + local.get 18 + call $_ZN4core9panicking11panic_const24panic_const_add_overflow17hde776086e9d58b0fE + unreachable) + (func $_ZN60_$LT$core..cmp..Ordering$u20$as$u20$core..cmp..PartialEq$GT$2eq17h4f7e0e7136f3950eE (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + local.get 0 + i32.store offset=4 + local.get 4 + local.get 1 + i32.store offset=8 + local.get 0 + i32.load8_u + local.set 5 + local.get 4 + local.get 5 + i32.store8 offset=14 + local.get 1 + i32.load8_u + local.set 6 + local.get 4 + local.get 6 + i32.store8 offset=15 + i32.const 255 + local.set 7 + local.get 5 + local.get 7 + i32.and + local.set 8 + i32.const 255 + local.set 9 + local.get 6 + local.get 9 + i32.and + local.set 10 + local.get 8 + local.get 10 + i32.eq + local.set 11 + i32.const 1 + local.set 12 + local.get 11 + local.get 12 + i32.and + local.set 13 + local.get 13 + return) + (func $_ZN4core3cmp5impls69_$LT$impl$u20$core..cmp..PartialEq$LT$$RF$B$GT$$u20$for$u20$$RF$A$GT$2eq17h259317a46a8973c6E (type 0) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + global.get $__stack_pointer + local.set 2 + i32.const 16 + local.set 3 + local.get 2 + local.get 3 + i32.sub + local.set 4 + local.get 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + i32.store offset=8 + local.get 4 + local.get 1 + i32.store offset=12 + local.get 0 + i32.load + local.set 5 + local.get 1 + i32.load + local.set 6 + local.get 5 + local.get 6 + call $_ZN60_$LT$erc20..bytes..Bytes$u20$as$u20$core..cmp..PartialEq$GT$2eq17h6c48405eb7a60734E + local.set 7 + i32.const 1 + local.set 8 + local.get 7 + local.get 8 + i32.and + local.set 9 + i32.const 16 + local.set 10 + local.get 4 + local.get 10 + i32.add + local.set 11 + local.get 11 + global.set $__stack_pointer + local.get 9 + return) + (func $_ZN4core3ptr37drop_in_place$LT$core..fmt..Error$GT$17h1c3f1cbd1368fccaE (type 7) (param i32)) + (func $_ZN4core9panicking9panic_fmt17h5c7ce52813e94bcdE (type 1) (param i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 1 + i32.store16 offset=28 + local.get 2 + local.get 1 + i32.store offset=24 + local.get 2 + local.get 0 + i32.store offset=20 + local.get 2 + i32.const 1049252 + i32.store offset=16 + local.get 2 + i32.const 1 + i32.store offset=12 + local.get 2 + i32.const 12 + i32.add + call $rust_begin_unwind + unreachable) + (func $_ZN36_$LT$T$u20$as$u20$core..any..Any$GT$7type_id17h4e5a4609280a40f1E (type 1) (param i32 i32) + local.get 0 + i64.const 9172487606043731407 + i64.store offset=8 + local.get 0 + i64.const -8877450274954529964 + i64.store) + (func $_ZN4core9panicking11panic_const24panic_const_add_overflow17hde776086e9d58b0fE (type 7) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 0 + i32.store offset=24 + local.get 1 + i32.const 1 + i32.store offset=12 + local.get 1 + i32.const 1049244 + i32.store offset=8 + local.get 1 + i64.const 4 + i64.store offset=16 align=4 + local.get 1 + i32.const 8 + i32.add + local.get 0 + call $_ZN4core9panicking9panic_fmt17h5c7ce52813e94bcdE + unreachable) + (table (;0;) 7 7 funcref) + (memory (;0;) 17) + (global $__stack_pointer (mut i32) (i32.const 1048576)) + (global (;1;) i32 (i32.const 1049268)) + (global (;2;) i32 (i32.const 1049280)) + (export "memory" (memory 0)) + (export "dispatch" (func $dispatch)) + (export "__data_end" (global 1)) + (export "__heap_base" (global 2)) + (elem (;0;) (i32.const 1) func $_ZN4core3ptr44drop_in_place$LT$erc20..address..Address$GT$17h8456b4854419963dE $_ZN69_$LT$erc20..address..Address$u20$as$u20$erc20..encoder..Encodable$GT$6add_to17hbf87ab60036eabf4E $_ZN4core3ptr44drop_in_place$LT$erc20..balance..Balance$GT$17h76e05e6c9083f3e6E $_ZN69_$LT$erc20..balance..Balance$u20$as$u20$erc20..encoder..Encodable$GT$6add_to17hd7ca5a57f68c1f2eE $_ZN4core3ptr37drop_in_place$LT$core..fmt..Error$GT$17h1c3f1cbd1368fccaE $_ZN36_$LT$T$u20$as$u20$core..any..Any$GT$7type_id17h4e5a4609280a40f1E) + (data $.rodata (i32.const 1048576) "src/value_mapper.rs\00\00\00\10\00\13\00\00\00\1a\00\00\00\1e\00\00\00Panic\00src/encoder.rs*\00\10\00\0e\00\00\00#\00\00\00W\00\00\00Did not read all inputUnexpected input.src/balance.rs\00\00\00o\00\10\00\0e\00\00\00[\00\00\00\0f\00\00\00Signature too shortsrc/address.rs\00\00\00\a3\00\10\00\0e\00\00\004\00\00\00\0f\00\00\00decimals()totalSupply()balanceOf(address)transfer(address,uint256)allowance(address,address)approve(address,uint256)transferFrom(address,address,uint256)Unknown endpointBuffer without function signaturetotal_supply\00\00\01\00\00\00\04\00\00\00\04\00\00\00\02\00\00\00Transfer(address,address,u256)\00\00\03\00\00\00\04\00\00\00\04\00\00\00\04\00\00\00Approval(address,address,u256)Invalid senderInvalid receiverInsufficient balanceInvalid approverInvalid spenderInsuficient allowancesrc/decoder.rs\00\00`\02\10\00\0e\00\00\001\00\00\00\17\00\00\00attempt to add with overflow\80\02\10\00\1c\00\00\00\05\00\00\00\00\00\00\00\01\00\00\00\06\00\00\00")) diff --git a/tests/ulm/erc20/rust/.gitignore b/tests/ulm/erc20/rust/.gitignore new file mode 100644 index 000000000..1de565933 --- /dev/null +++ b/tests/ulm/erc20/rust/.gitignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/tests/ulm/erc20/rust/Cargo.lock b/tests/ulm/erc20/rust/Cargo.lock new file mode 100644 index 000000000..489cd7749 --- /dev/null +++ b/tests/ulm/erc20/rust/Cargo.lock @@ -0,0 +1,124 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "erc20" +version = "0.1.0" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "proc-macro2" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "2.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" + +[[package]] +name = "wasm-bindgen" +version = "0.2.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21d3b25c3ea1126a2ad5f4f9068483c2af1e64168f847abe863a526b8dbfe00b" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52857d4c32e496dc6537646b5b117081e71fd2ff06de792e3577a150627db283" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "920b0ffe069571ebbfc9ddc0b36ba305ef65577c94b06262ed793716a1afd981" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf59002391099644be3524e23b781fa43d2be0c5aa0719a18c0731b9d195cab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5047c5392700766601942795a436d7d2599af60dcc3cc1248c9120bfb0827b0" diff --git a/tests/ulm/erc20/rust/Cargo.toml b/tests/ulm/erc20/rust/Cargo.toml new file mode 100644 index 000000000..a0661b15d --- /dev/null +++ b/tests/ulm/erc20/rust/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "erc20" +version = "0.1.0" +edition = "2021" + +#[profile.dev] +#panic = "abort" + +#[profile.release] +#panic = "abort" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = "0.2" diff --git a/tests/ulm/erc20/rust/src/address.rs b/tests/ulm/erc20/rust/src/address.rs new file mode 100644 index 000000000..031da3c2c --- /dev/null +++ b/tests/ulm/erc20/rust/src/address.rs @@ -0,0 +1,54 @@ +use crate::Bytes; +use crate::Encodable; +use crate::Decodable; +use crate::U256; +use crate::ulm_hooks; + +#[derive(Clone)] +pub struct Address { + int_id: u32, +} + +impl Address { + pub fn zero() -> Address { + Address{ int_id: unsafe { ulm_hooks::u160FromU64(0) } } + } + pub fn from_id(int_id: u32) -> Address { + return Address { int_id } + } + + pub fn is_zero(&self) -> bool { + unsafe { ulm_hooks::cmpInt(self.int_id, Address::zero().int_id) == 0 } + } +} + +impl Into for &Address { + fn into(self) -> U256 { + U256::from_id( unsafe { ulm_hooks::u256FromIntId(self.int_id) } ) + } +} +impl From for Address { + fn from(value: U256) -> Self { + let int_id = unsafe { ulm_hooks::u160FromIntId(value.int_id) }; + Address { int_id } + } +} + +impl Encodable for Address { + fn add_to(&self, encoder_id: u32) -> u32 { + let converted: U256 = self.into(); + converted.add_to(encoder_id) + } +} +impl Decodable for Address { + fn is_variable_length() -> bool { + U256::is_variable_length() + } + fn encoded_head_size() -> u32 { + U256::encoded_head_size() + } + fn decode(bytes: Bytes) -> Self { + let value = U256::decode(bytes); + value.into() + } +} diff --git a/tests/ulm/erc20/rust/src/assertions.rs b/tests/ulm/erc20/rust/src/assertions.rs new file mode 100644 index 000000000..f41365e54 --- /dev/null +++ b/tests/ulm/erc20/rust/src/assertions.rs @@ -0,0 +1,21 @@ +use core::panic::PanicInfo; + +use crate::ulm_hooks; + +pub fn fail(msg: &str) -> ! { + ulm_hooks::failWrapper(msg); +} + +#[panic_handler] +pub fn panic(_info: &PanicInfo) -> ! { + fail("Panic") +} + +#[macro_export] +macro_rules! require { + ( $cond:expr , $msg:expr ) => { + if $cond { + fail($msg); + } + } +} diff --git a/tests/ulm/erc20/rust/src/balance.rs b/tests/ulm/erc20/rust/src/balance.rs new file mode 100644 index 000000000..84da3ff1e --- /dev/null +++ b/tests/ulm/erc20/rust/src/balance.rs @@ -0,0 +1,93 @@ +use core::ops::Add; +use core::ops::Sub; + +use crate::Bytes; +use crate::Encodable; +use crate::Decodable; +use crate::U256; + +#[derive(PartialEq, Eq, PartialOrd, Ord)] +pub struct Balance { + value: U256, +} + +impl Sub for Balance { + type Output = Balance; + fn sub(self, other: Balance) -> Balance { + Balance { value: &self.value - other.value } + } +} +impl Sub<&Balance> for Balance { + type Output = Balance; + fn sub(self, other: &Balance) -> Balance { + Balance { value: self.value - &other.value } + } +} +impl Sub for &Balance { + type Output = Balance; + fn sub(self, other: Balance) -> Balance { + Balance { value: &self.value - other.value } + } +} +impl Sub for &Balance { + type Output = Balance; + fn sub(self, other: &Balance) -> Balance { + Balance { value: &self.value - &other.value } + } +} +impl Add for Balance { + type Output = Balance; + fn add(self, other: Balance) -> Balance { + Balance { value: &self.value + other.value } + } +} +impl Add<&Balance> for Balance { + type Output = Balance; + fn add(self, other: &Balance) -> Balance { + Balance { value: self.value + &other.value } + } +} +impl Add for &Balance { + type Output = Balance; + fn add(self, other: Balance) -> Balance { + Balance { value: &self.value + other.value } + } +} +impl Add for &Balance { + type Output = Balance; + fn add(self, other: &Balance) -> Balance { + Balance { value: &self.value + &other.value } + } +} +impl Into for Balance { + fn into(self) -> U256 { + self.value + } +} +impl From for Balance { + fn from(value: U256) -> Self { + Balance { value } + } +} +impl Clone for Balance { + fn clone(&self) -> Self { + Balance { value: self.value.clone() } + } +} +impl Encodable for Balance { + fn add_to(&self, encoder_id: u32) -> u32 { + self.value.add_to(encoder_id) + } +} +impl Decodable for Balance { + fn is_variable_length() -> bool { + U256::is_variable_length() + } + fn encoded_head_size() -> u32 { + U256::encoded_head_size() + } + fn decode(bytes: Bytes) -> Self { + let value = U256::decode(bytes); + value.into() + } +} diff --git a/tests/ulm/erc20/rust/src/bytes.rs b/tests/ulm/erc20/rust/src/bytes.rs new file mode 100644 index 000000000..a72dfbb4b --- /dev/null +++ b/tests/ulm/erc20/rust/src/bytes.rs @@ -0,0 +1,44 @@ +use core::cmp::Ordering; + +use crate::ulm_hooks; + +pub struct Bytes { + pub bytes_id: u32 +} + +impl Bytes { + pub fn from_id(bytes_id: u32) -> Bytes { + Bytes { bytes_id } + } + + pub fn length(&self) -> u32 { + unsafe { ulm_hooks::bytesLength(self.bytes_id) } + } + + pub fn substr(&self, start: u32, end: u32) -> Bytes { + Bytes::from_id( unsafe { ulm_hooks::bytesSubstr(self.bytes_id, start, end) } ) + } +} +impl Ord for Bytes { + fn cmp(&self, other: &Self) -> Ordering { + let result = unsafe { ulm_hooks::cmpBytes(self.bytes_id, other.bytes_id) }; + if result < 0 { + Ordering::Less + } else if result > 0 { + Ordering::Greater + } else { + Ordering::Equal + } + } +} +impl PartialOrd for Bytes { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} +impl PartialEq for Bytes { + fn eq(&self, other: &Self) -> bool { + self.cmp(other) == Ordering::Equal + } +} +impl Eq for Bytes {} diff --git a/tests/ulm/erc20/rust/src/decoder.rs b/tests/ulm/erc20/rust/src/decoder.rs new file mode 100644 index 000000000..cc05ac6cc --- /dev/null +++ b/tests/ulm/erc20/rust/src/decoder.rs @@ -0,0 +1,54 @@ +use crate::Bytes; +use crate::fail; +use crate::require; +use crate::ulm_hooks; + +pub trait Decodable { + fn is_variable_length() -> bool; + fn encoded_head_size() -> u32; + fn decode(bytes: Bytes) -> Self; +} + +pub struct Decoder { + decoder_id: u32, + next_index: u32, +} + +impl Decoder { + pub fn from_buffer(buffer:Bytes) -> Decoder { + Decoder { + decoder_id: unsafe { ulm_hooks::decoderFromBuffer(buffer.bytes_id) }, + next_index: 0, + } + } + pub fn check_done(&self) { + let value_count = unsafe { ulm_hooks::decoderValueCount(self.decoder_id) }; + require!(self.next_index == value_count, "Did not read all input"); + } + + pub fn register_data(self) -> Decoder { + let decoder_id = unsafe { + ulm_hooks::decoderRegister(self.decoder_id, T::encoded_head_size(), T::is_variable_length()) + }; + Decoder { + decoder_id, + ..self + } + } + + pub fn validate_data(&self) { + let is_valid = unsafe { ulm_hooks::isValidDecoder(self.decoder_id) }; + require!(is_valid, "Unexpected input."); + } + + pub fn decode(self) -> (T, Decoder) { + let obj_bytes = Bytes::from_id(unsafe { + ulm_hooks::decodeExtractBytes(self.decoder_id, self.next_index) + }); + let decoder = Decoder { + next_index: self.next_index + 1, + ..self + }; + (T::decode(obj_bytes), decoder) + } +} diff --git a/tests/ulm/erc20/rust/src/encoder.rs b/tests/ulm/erc20/rust/src/encoder.rs new file mode 100644 index 000000000..f1d33936d --- /dev/null +++ b/tests/ulm/erc20/rust/src/encoder.rs @@ -0,0 +1,50 @@ +use crate::Bytes; +use crate::ulm_hooks; + +pub trait Encodable { + fn add_to(&self, encoder_id: u32) -> u32; +} + +pub struct Encoder { + encoder_id: u32, +} + +impl Encoder { + pub fn new() -> Self { + Encoder { encoder_id: unsafe { ulm_hooks::newEncoder() } } + } + + pub fn add(self, value: &dyn Encodable) -> Self { + Encoder { encoder_id: value.add_to(self.encoder_id) } + } + + pub fn add_bool(self, value: bool) -> Self { + Encoder { + encoder_id: unsafe { + ulm_hooks::encoderAddU256( + self.encoder_id, + ulm_hooks::u256FromU64(if value {1} else {0}) + ) + } + } + } + + pub fn add_u8(self, value: u8) -> Self { + Encoder { + encoder_id: unsafe { + ulm_hooks::encoderAddU256(self.encoder_id, ulm_hooks::u256FromU64(value.into())) + } + } + } + + + pub fn add_str(self, value: &str) -> Self { + Encoder { + encoder_id: ulm_hooks::encoderAddStrWrapper(self.encoder_id, value) + } + } + + pub fn build(&self) -> Bytes { + Bytes::from_id( unsafe { ulm_hooks::encoderToBytes(self.encoder_id) } ) + } +} diff --git a/tests/ulm/erc20/rust/src/lib.rs b/tests/ulm/erc20/rust/src/lib.rs new file mode 100644 index 000000000..93aabf2a3 --- /dev/null +++ b/tests/ulm/erc20/rust/src/lib.rs @@ -0,0 +1,297 @@ +// This contract is derived from +// https://github.com/Pi-Squared-Inc/pi2-examples/blob/b63d0a78922874a486be8a0395a627425fb5a052/solidity/src/tokens/SomeToken.sol + +#![no_std] + +mod address; +mod assertions; +mod balance; +mod bytes; +mod encoder; +mod decoder; +mod ulm; +mod ulm_hooks; +mod u256; +mod value_mapper; + +use address::*; +use assertions::*; +use balance::*; +use bytes::*; +use decoder::*; +use encoder::*; +use u256::*; +use value_mapper::*; + +#[allow(non_snake_case)] +fn CallerWrapper() -> Address { + Address::from_id( unsafe { ulm::Caller() } ) +} + +fn log3(signature: &str, first: U256, second: U256, data: &Bytes) { + unsafe { + ulm :: Log3( + ulm_hooks::signatureFingerprintWrapper(signature), + first.int_id, + second.int_id, + data.bytes_id + ); + } +} + +fn same_signature(expected: &Bytes, signature: &str) -> bool { + expected == &Bytes::from_id( + ulm_hooks::endpointFingerprintWrapper(signature) + ) +} + +// --------------------------- + +#[no_mangle] +pub fn dispatch(init: bool) { + let buffer_id = unsafe { ulm::CallData() }; + let buffer = Bytes::from_id(buffer_id); + if init { + initCaller(Decoder::from_buffer(buffer)); + } else { + require!(buffer.length() <= 4, "Buffer without function signature"); + let signature = buffer.substr(0, 4); + let buffer = buffer.substr(4, buffer.length()); + let decoder = Decoder::from_buffer(buffer); + if same_signature(&signature, "decimals()") { + decimalsCaller(decoder); + } else if same_signature(&signature, "totalSupply()") { + totalSupplyCaller(decoder); + } else if same_signature(&signature, "balanceOf(address)") { + balanceOfCaller(decoder); + } else if same_signature(&signature, "transfer(address,uint256)") { + transferCaller(decoder); + } else if same_signature(&signature, "allowance(address,address)") { + allowanceCaller(decoder); + } else if same_signature(&signature, "approve(address,uint256)") { + approveCaller(decoder); + } else if same_signature(&signature, "transferFrom(address,address,uint256)") { + transferFromCaller(decoder); + } else { + fail("Unknown endpoint"); + } + } +} + +// --------------------------- + +fn s_total_supply() -> SingleValueMapper { + SingleValueMapperBuilder::new("total_supply").build() +} + +fn s_balances(address: &Address) -> SingleValueMapper { + SingleValueMapperBuilder::new("total_supply").with_arg(address).build() +} + +fn s_allowances(account: &Address, spender: &Address) -> SingleValueMapper { + SingleValueMapperBuilder::new("total_supply").with_arg(account).with_arg(spender).build() +} + +// --------------------------- + +fn transfer_event(from: &Address, to: &Address, value: &Balance) { + log3( + "Transfer(address,address,u256)", + from.into(), to.into(), + &Encoder::new().add(value).build() + ) +} + +fn approval_event(owner: &Address, spender: &Address, value: &Balance) { + log3( + "Approval(address,address,u256)", + owner.into(), spender.into(), + &Encoder::new().add(value).build() + ) +} + +// --------------------------- + +#[allow(non_snake_case)] +fn initCaller(decoder: Decoder) { + decoder.check_done(); + init(); + let bytes_id = Encoder::new().build().bytes_id; + unsafe { ulm::SetOutput(bytes_id); } +} + +fn init() {} + +#[allow(non_snake_case)] +fn decimalsCaller(decoder: Decoder) { + decoder.check_done(); + let value = decimals(); + let bytes_id = Encoder::new().add_u8(value).build().bytes_id; + unsafe { ulm::SetOutput(bytes_id); } +} + +fn decimals() -> u8 { + 18 +} + +#[allow(non_snake_case)] +fn totalSupplyCaller(decoder: Decoder) { + decoder.check_done(); + let value = total_supply(); + let bytes_id = Encoder::new().add(&value).build().bytes_id; + unsafe { ulm::SetOutput(bytes_id); } +} + +fn total_supply() -> Balance { + s_total_supply().get() +} + +#[allow(non_snake_case)] +fn balanceOfCaller(decoder: Decoder) { + let decoder = decoder.register_data::
(); + decoder.validate_data(); + + let (address, decoder) = decoder.decode::
(); + decoder.check_done(); + + let value = balance_of(&address); + + let bytes_id = Encoder::new().add(&value).build().bytes_id; + unsafe { ulm::SetOutput(bytes_id); } +} + +fn balance_of(account: &Address) -> Balance { + s_balances(account).get() +} + +#[allow(non_snake_case)] +fn transferCaller(decoder: Decoder) { + let decoder = decoder.register_data::
(); + let decoder = decoder.register_data::(); + decoder.validate_data(); + + let (to, decoder) = decoder.decode::
(); + let (balance, decoder) = decoder.decode::(); + decoder.check_done(); + + let value = transfer(&to, &balance); + + let bytes_id = Encoder::new().add_bool(value).build().bytes_id; + unsafe { ulm::SetOutput(bytes_id); } +} + +fn transfer(to: &Address, value: &Balance) -> bool { + let owner = CallerWrapper(); + _transfer(&owner, to, &value); + true +} + +#[allow(non_snake_case)] +fn allowanceCaller(decoder: Decoder) { + let decoder = decoder.register_data::
(); + let decoder = decoder.register_data::
(); + decoder.validate_data(); + + let (owner, decoder) = decoder.decode::
(); + let (spender, decoder) = decoder.decode::
(); + decoder.check_done(); + + let value = allowance(&owner, &spender); + + let bytes_id = Encoder::new().add(&value).build().bytes_id; + unsafe { ulm::SetOutput(bytes_id); } +} + +fn allowance(owner: &Address, spender: &Address) -> Balance { + s_allowances(owner, spender).get() +} + +#[allow(non_snake_case)] +fn approveCaller(decoder: Decoder) { + let decoder = decoder.register_data::
(); + let decoder = decoder.register_data::(); + decoder.validate_data(); + + let (spender, decoder) = decoder.decode::
(); + let (value, decoder) = decoder.decode::(); + decoder.check_done(); + + let value = approve(&spender, &value); + + let bytes_id = Encoder::new().add_bool(value).build().bytes_id; + unsafe { ulm::SetOutput(bytes_id); } +} + +fn approve(spender: &Address, value: &Balance) -> bool { + let owner = CallerWrapper(); + _approve(&owner, spender, value, true); + true +} + +#[allow(non_snake_case)] +fn transferFromCaller(decoder: Decoder) { + let decoder = decoder.register_data::
(); + let decoder = decoder.register_data::
(); + let decoder = decoder.register_data::(); + decoder.validate_data(); + + let (from, decoder) = decoder.decode::
(); + let (to, decoder) = decoder.decode::
(); + let (value, decoder) = decoder.decode::(); + decoder.check_done(); + + let value = transfer_from(&from, &to, &value); + + let bytes_id = Encoder::new().add_bool(value).build().bytes_id; + unsafe { ulm::SetOutput(bytes_id); } +} + +fn transfer_from(from: &Address, to: &Address, value: &Balance) -> bool { + let spender = CallerWrapper(); + _spend_allowance(from, &spender, value); + _transfer(from, to, value); + true +} + +fn _transfer(from: &Address, to: &Address, value: &Balance) { + require!(!from.is_zero(), "Invalid sender"); + require!(!to.is_zero(), "Invalid receiver"); + _update(from, to, value); + transfer_event(from, to, value); +} + +fn _update(from: &Address, to: &Address, value: &Balance) { + if from.is_zero() { + s_total_supply().set(s_total_supply().get() + value); + } else { + let from_balance = s_balances(from).get(); + require!(value <= &from_balance, "Insufficient balance"); + s_balances(from).set(s_balances(from).get() - value); + }; + + if to.is_zero() { + s_total_supply().set(s_total_supply().get() - value); + } else { + s_balances(to).set(s_balances(to).get() + value); + } +} + +fn _mint(account: &Address, value: &Balance) { + require!(!account.is_zero(), "Zero address"); + _update(&Address::zero(), account, value); +} + +fn _approve(owner: &Address, spender: &Address, value: &Balance, emit_event: bool) { + require!(!owner.is_zero(), "Invalid approver"); + require!(!spender.is_zero(), "Invalid spender"); + s_allowances(owner, spender).set(value.clone()); + if emit_event { + approval_event(owner, spender, &value); + } +} + +fn _spend_allowance(owner: &Address, spender: &Address, value: &Balance) { + let current_allowance = allowance(owner, spender); + require!(value <= ¤t_allowance, "Insuficient allowance"); + _approve(owner, spender, &(current_allowance - value), false); +} diff --git a/tests/ulm/erc20/rust/src/u256.rs b/tests/ulm/erc20/rust/src/u256.rs new file mode 100644 index 000000000..c61a60bd1 --- /dev/null +++ b/tests/ulm/erc20/rust/src/u256.rs @@ -0,0 +1,111 @@ +use core::cmp::Ordering; +use core::ops::Add; +use core::ops::Sub; + +use crate::ulm_hooks; +use crate::Bytes; +use crate::Encodable; +use crate::Decodable; + +pub struct U256 { + pub int_id: u32, +} + +impl U256 { + pub fn from_id(int_id: u32) -> Self { + U256 { int_id } + } +} +impl Sub for U256 { + type Output = U256; + fn sub(self, other: U256) -> U256 { + U256 { int_id: unsafe { ulm_hooks::intSub(self.int_id, other.int_id) } } + } +} +impl Sub<&U256> for U256 { + type Output = U256; + fn sub(self, other: &U256) -> U256 { + U256 { int_id: unsafe { ulm_hooks::intSub(self.int_id, other.int_id) } } + } +} +impl Sub for &U256 { + type Output = U256; + fn sub(self, other: U256) -> U256 { + U256 { int_id: unsafe { ulm_hooks::intSub(self.int_id, other.int_id) } } + } +} +impl Sub for &U256 { + type Output = U256; + fn sub(self, other: &U256) -> U256 { + U256 { int_id: unsafe { ulm_hooks::intSub(self.int_id, other.int_id) } } + } +} +impl Add for U256 { + type Output = U256; + fn add(self, other: U256) -> U256 { + U256 { int_id: unsafe { ulm_hooks::intAdd(self.int_id, other.int_id) } } + } +} +impl Add<&U256> for U256 { + type Output = U256; + fn add(self, other: &U256) -> U256 { + U256 { int_id: unsafe { ulm_hooks::intAdd(self.int_id, other.int_id) } } + } +} +impl Add for &U256 { + type Output = U256; + fn add(self, other: U256) -> U256 { + U256 { int_id: unsafe { ulm_hooks::intAdd(self.int_id, other.int_id) } } + } +} +impl Add for &U256 { + type Output = U256; + fn add(self, other: &U256) -> U256 { + U256 { int_id: unsafe { ulm_hooks::intAdd(self.int_id, other.int_id) } } + } +} +impl Ord for U256 { + fn cmp(&self, other: &Self) -> Ordering { + let result = unsafe { ulm_hooks::cmpInt(self.int_id, other.int_id) }; + if result < 0 { + Ordering::Less + } else if result > 0 { + Ordering::Greater + } else { + Ordering::Equal + } + } +} +impl PartialOrd for U256 { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} +impl PartialEq for U256 { + fn eq(&self, other: &Self) -> bool { + self.cmp(other) == Ordering::Equal + } +} +impl Eq for U256 {} +impl Clone for U256 { + fn clone(&self) -> Self { + U256 { int_id: self.int_id } + } +} +impl Encodable for U256 { + fn add_to(&self, encoder_id: u32) -> u32 { + unsafe { ulm_hooks::encoderAddU256(encoder_id, self.int_id) } + } +} +impl Decodable for U256 { + fn is_variable_length() -> bool { + false + } + fn encoded_head_size() -> u32 { + 32 + } + fn decode(bytes: Bytes) -> Self { + let int_id = unsafe { ulm_hooks::u256FromBytes(bytes.bytes_id) }; + U256 { int_id } + } +} diff --git a/tests/ulm/erc20/rust/src/ulm.rs b/tests/ulm/erc20/rust/src/ulm.rs new file mode 100644 index 000000000..17b0fc5f2 --- /dev/null +++ b/tests/ulm/erc20/rust/src/ulm.rs @@ -0,0 +1,14 @@ +extern "C" { + #[allow(non_snake_case)] + pub fn Log3(data1_id: u32, data2_id: u32, data3_id: u32, bytes_id: u32); + #[allow(non_snake_case)] + pub fn GetAccountStorage(key_id: u32) -> u32; + #[allow(non_snake_case)] + pub fn SetAccountStorage(key_id: u32, value_id: u32); + #[allow(non_snake_case)] + pub fn SetOutput(bytes_id: u32); + #[allow(non_snake_case)] + pub fn Caller() -> u32; + #[allow(non_snake_case)] + pub fn CallData() -> u32; +} diff --git a/tests/ulm/erc20/rust/src/ulm_hooks.rs b/tests/ulm/erc20/rust/src/ulm_hooks.rs new file mode 100644 index 000000000..e64110e11 --- /dev/null +++ b/tests/ulm/erc20/rust/src/ulm_hooks.rs @@ -0,0 +1,83 @@ +extern "C" { + pub fn fail(msg: *const u8, msg_len: usize) -> !; + + #[allow(non_snake_case)] + pub fn u256FromU64(value: u64) -> u32; + #[allow(non_snake_case)] + pub fn u256FromIntId(value_id: u32) -> u32; + #[allow(non_snake_case)] + pub fn u256FromBytes(bytes_id: u32) -> u32; + #[allow(non_snake_case)] + pub fn u160FromU64(value: u64) -> u32; + #[allow(non_snake_case)] + pub fn u160FromIntId(value_id: u32) -> u32; + + #[allow(non_snake_case)] + pub fn intAdd(value1_id: u32, value2_id: u32) -> u32; + #[allow(non_snake_case)] + pub fn intSub(value1_id: u32, value2_id: u32) -> u32; + #[allow(non_snake_case)] + pub fn cmpInt(value1_id: u32, value2_id: u32) -> i32; + + #[allow(non_snake_case)] + pub fn signatureFingerprint(value: *const u8, value_len: usize) -> u32; + pub fn fingerprint(bytes_id: u32) -> u32; + + #[allow(non_snake_case)] + pub fn newEncoder() -> u32; + #[allow(non_snake_case)] + pub fn encoderAddU256(encoder_id: u32, value_id: u32) -> u32; + #[allow(non_snake_case)] + pub fn encoderAddStr(encoder_id: u32, value: *const u8, value_len: usize) -> u32; + #[allow(non_snake_case)] + pub fn encoderToBytes(encoder_id: u32) -> u32; + + // The decoder id points to a structure similar to this one: + // struct Decoder { + // bytes: Bytes + // accumulated_head_lengths: u32[] // sum of head lengths up to the current index + // } + pub fn decoderFromBuffer(bytes_id: u32) -> u32; + #[allow(non_snake_case)] + pub fn decoderRegister(decoder_id: u32, head_size: u32, variable: bool) -> u32; + #[allow(non_snake_case)] + pub fn decoderValueCount(decoder_id: u32) -> u32; + #[allow(non_snake_case)] + pub fn decodeExtractBytes(decoder_id: u32, index: u32) -> u32; + // Checks whether the registered values fit the decoder's bytes. + #[allow(non_snake_case)] + pub fn isValidDecoder(decoder_id:u32) -> bool; + + pub fn bytesLength(bytes_id: u32) -> u32; + pub fn bytesSubstr(bytes_id: u32, start: u32, end: u32) -> u32; + pub fn cmpBytes(bytes_id1: u32, bytes_id2: u32) -> i32; +} + +#[allow(non_snake_case)] +pub fn failWrapper(msg: &str) -> ! { + let msg_bytes = msg.as_bytes(); + unsafe { fail(msg_bytes.as_ptr(), msg_bytes.len()); } +} + +#[allow(non_snake_case)] +pub fn signatureFingerprintWrapper(value: &str) -> u32 { + let buf = value.as_bytes(); + unsafe { signatureFingerprint(buf.as_ptr(), buf.len()) } +} + +#[allow(non_snake_case)] +pub fn endpointFingerprintWrapper(value: &str) -> u32 { + unsafe { + let fp_id = signatureFingerprintWrapper(value); + if bytesLength(fp_id) < 4 { + failWrapper("Signature too short"); + } + bytesSubstr(fp_id, 0, 4) + } +} + +#[allow(non_snake_case)] +pub fn encoderAddStrWrapper(encoder_id: u32, value: &str) -> u32 { + let buf = value.as_bytes(); + unsafe { encoderAddStr(encoder_id, buf.as_ptr(), buf.len()) } +} diff --git a/tests/ulm/erc20/rust/src/value_mapper.rs b/tests/ulm/erc20/rust/src/value_mapper.rs new file mode 100644 index 000000000..de2181390 --- /dev/null +++ b/tests/ulm/erc20/rust/src/value_mapper.rs @@ -0,0 +1,56 @@ +use core::marker::PhantomData; + +use crate::Encodable; +use crate::Encoder; +use crate::U256; +use crate::ulm; +use crate::ulm_hooks; + +pub struct SingleValueMapper + From + 'static> { + phantom: PhantomData, + fingerprint: U256, +} + +impl + From> SingleValueMapper { + pub fn new(fingerprint: U256) -> Self { + SingleValueMapper:: { phantom: PhantomData, fingerprint } + } + + pub fn set(&self, value: ValueType) { + let converted: U256 = value.into(); + unsafe { ulm::SetAccountStorage(self.fingerprint.int_id, converted.int_id); } + } + + pub fn get(&self) -> ValueType { + let u256_id = unsafe { ulm::GetAccountStorage(self.fingerprint.int_id) }; + U256::from_id(u256_id).into() + } +} + +pub struct SingleValueMapperBuilder + From + 'static> { + phantom: PhantomData, + encoder: Encoder, +} + +impl + From> SingleValueMapperBuilder { + pub fn new(name: &str) -> Self { + Self::from_encoder(Encoder::new().add_str(name)) + } + + pub fn from_encoder(encoder: Encoder) -> Self { + SingleValueMapperBuilder:: { + phantom: PhantomData, + encoder + } + } + + pub fn with_arg(self, arg: &dyn Encodable) -> Self { + Self::from_encoder(self.encoder.add(arg)) + } + + pub fn build(self) -> SingleValueMapper { + let bytes_id = self.encoder.build().bytes_id; + let fingerprint = unsafe { ulm_hooks::fingerprint(bytes_id) }; + SingleValueMapper::new(U256::from_id(fingerprint)) + } +}