# Can't run bonding smart contract

**URL:** <https://forum.fuel.network/t/cant-run-bonding-smart-contract/2845>\
**Category:** Sway\
**Created:** [July 7, 2023, 5:46pm UTC](https://forum.fuel.network/t/cant-run-bonding-smart-contract/2845 "2023-07-07T17:46:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sway](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/sway/32/103_2.png) [@sway](https://forum.fuel.network/u/sway)\
**Post date:** [July 7, 2023, 5:46pm UTC](https://forum.fuel.network/t/cant-run-bonding-smart-contract/2845/1 "2023-07-07T17:46:33Z")

</div>

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](https://github.com/compolabs/bonding-contract/blob/master/src/main.sw)

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:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![calldelegation](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/calldelegation/32/1484_2.png) [@calldelegation](https://forum.fuel.network/u/calldelegation)\
**Post date:** [July 7, 2023, 6:47pm UTC](https://forum.fuel.network/t/cant-run-bonding-smart-contract/2845/2 "2023-07-07T18:47:22Z")

</div>

Hey Lidia great to hear from you again! 🙂

1. Can you bump up your `forc` version this appears to be an old bug

```plaintext
-----------------
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::*;`

---

<div class="post-metadata">

**Author:** ![sway](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/sway/32/103_2.png) [@sway](https://forum.fuel.network/u/sway)\
**Post date:** [July 7, 2023, 7:15pm UTC](https://forum.fuel.network/t/cant-run-bonding-smart-contract/2845/3 "2023-07-07T19:15:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sway](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/sway/32/103_2.png) [@sway](https://forum.fuel.network/u/sway)\
**Post date:** [July 7, 2023, 7:24pm UTC](https://forum.fuel.network/t/cant-run-bonding-smart-contract/2845/5 "2023-07-07T19:24:46Z")

</div>

Good, thanks, that works on latest toolchain

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/5/57d5a345cc15a64b636e0d56e042857f8a0e80b1.png) [@system](https://forum.fuel.network/u/system)\
**Post date:** [July 28, 2023, 3:25pm UTC](https://forum.fuel.network/t/cant-run-bonding-smart-contract/2845/6 "2023-07-28T15:25:34Z")

</div>

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