Checking attached token quantity "require" does not work

Hey guys!!!
I have a new problem with sway.

I wrote the code based on [this tutorial] , remake code from this topic (Native Assets - The Sway Programming Language)

I got a contract like this. I have two checks here for the token and amount,

And in the test, I create a brand new wallet, which definitely does not have the attached token, call the method supply_amount and it is successfully executed and ignores all checks


Can you print the response to verify that it didn’t revert?


Here is output

 *  Executing task: cargo test --package storage_vec_example --test integration_tests -- my_test --exact --nocapture 

   Compiling storage_vec_example v0.1.0 (/Users/alexey/projects/fuel/fuel-project/storage_vec_example)
    Finished test [unoptimized + debuginfo] target(s) in 2.05s
     Running tests/ (target/debug/deps/integration_tests-ff99f5527a8a1d97)

running 1 test
test my_test ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.08s

 *  Terminal will be reused by tasks, press any key to close it. 

You can checkout to the commit to pull this code into your computer
git checkout 67936b62dfbe6fbfa3720641f4616f54c2270d0a


Thanks for that. It seems to me the issue is related to the wallet setup. I tried using the wallet setup from here and am getting the correct error that there aren’t enough resources.


I don’t know how to solve it

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