Skip to content

Instantly share code, notes, and snippets.

This is my SRC20 contract:

contract;

use standards::{src20::SRC20, src3::SRC3};
use std::{
    asset::{
        burn,
        mint_to,
@jecikpo
jecikpo / local-node-testing.md
Created June 13, 2024 10:56
Testing contracts on local Fuel node - basic deployment

If you want to test Sway smart contracts on your local Fuel node, you will probably encounter the following instruction: https://docs.fuel.network/docs/fuels-rs/connecting/external-node/ to modify your harness.rs test file.

You will most likely encounter two issues:

  1. SecrteKey::from_str() return value is of Result type and cannot be handled using ? because of how get_contract_instance() is defined.
  2. The salt of Create transaction is by default set to 0 and hence deploy() will try to deploy the contract using already existing contractId.

To solve those issues use the following.