⌘K

Icon SunFilledIcon MoonStars

Icon LinkImports

The Sway standard library Icon Link provides several utility types and methods we can use in our contract. To import a library, you can use the use keyword and ::, also called a namespace qualifier, to chain library names like this:

use std::auth::msg_sender;

You can also group together imports using curly brackets:

use std::{
	auth::msg_sender,
	storage::StorageVec,
}

For this contract, here is what needs to be imported. Copy this to your main.sw file:

use std::{
    auth::msg_sender,
    call_frames::msg_asset_id,
    constants::BASE_ASSET_ID,
    context::{
        msg_amount,
        this_balance,
    },
    asset::transfer,
    hash::Hash
};

We'll go through what each of these imports does as we use them in the next steps.