Can't run bonding smart contract

Hello guys!

We have tried to implement a bonding smart contract with pretty simple logic buying a token with a discount and unlocking it when time is right.

Here is a link to the code - link

It fails with different errors that are commented on in the code. Please help us to get rid of those once and run it.

  1. Compiler error: thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', sway-ir/src/optimize/dce.rs:93:60 // note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  2. Error: No method named "len" found for type "StorageKey<StorageVec<Vesting>>".

  3. Error: No method named "push" found for type "StorageKey<StorageVec<Vesting>>".

I also assume that the problem can relate to current beta3 version problems. Here is my toolchain:

Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup

installed toolchains
--------------------
beta-3-aarch64-apple-darwin
latest-aarch64-apple-darwin
hotfix
my-custom-toolchain (default)

active toolchain
-----------------
my-custom-toolchain (default)
  forc : 0.39.0
    - forc-client
      - forc-deploy : 0.39.0
      - forc-run : 0.39.0
    - forc-doc : 0.39.0
    - forc-explore - not found
    - forc-fmt : 0.39.0
    - forc-index - not found
    - forc-lsp : 0.39.0
    - forc-tx : 0.39.0
    - forc-wallet - not found
  fuel-core : 0.17.13
  fuel-indexer - not found

fuels versions
---------------
forc : 0.39
1 Like

Hey Lidia great to hear from you again! :slight_smile:

  1. Can you bump up your forc version this appears to be an old bug
-----------------
latest-aarch64-apple-darwin (default)
  forc : 0.42.0
    - forc-client
      - forc-deploy : 0.42.0
      - forc-run : 0.42.0
    - forc-doc : 0.42.0
    - forc-explore : 0.28.1
    - forc-fmt : 0.42.0
    - forc-index : 0.17.3
    - forc-lsp : 0.42.0
    - forc-tx : 0.42.0
    - forc-wallet : 0.2.3
  fuel-core : 0.18.3
  fuel-indexer : 0.17.3

fuels versions
---------------
forc : 0.43
forc-wallet : 0.43.0
  1. and 3. On line 5 import everything instead of just storage_vec std::storage::storage_vec::*;

We are using those versions due this is latest stable version that works on testnet

Good, thanks, that works on latest toolchain

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.