Migrating from Scrypto v0.7.0 to v0.8.0

resim command

Removed the need to add --owner-badge flag when publishing a package.

When we create a new account, by default, an owner badge will come with it. Publishing a package will automatically use the defaulted badge as its designated owner badge without having to specify it with --owner-badge flag.

If you desire, you can still provide a specific owner badge with the --owner-badge [owner_badge_global_id] flag.

Scrypto

Replaced the blueprint! macro

We changed the syntax for defining a blueprint. This change was made to make rust-analyzer offer better code suggestion and error messages.

In v0.7, a blueprint used to be encased with the blueprint! macro as so:

blueprint! {
    struct Hello {

    }
    impl Hello {

    }
}

As of v0.8, the syntax is now:

#[blueprint]
mod hello_module{ // Note that the name of the module can be anything.
    struct Hello {

    }
    impl Hello {

    }
}

It is important to note that the name of the blueprint is the name of the struct. In the previous example it would be Hello. Not hello_module!

Removed the u32 non-fungible ID type

We decided to remove the u32 non-fungible ID type and renamed the u64 type to simply integer.

Updated syntax for creating NonFungible resource

With v0.7, you specified the ID type as a parameter to ResourceBuilder::new_non_fungible(). As of v0.8, this function do not exist and you have to call a specific function depending on which type you want your NFTs to have:

The functions to call for creating a NonFungible resource with the ResourceBuilder are now:

ResourceBuilder::new_string_non_fungible()
ResourceBuilder::new_integer_non_fungible()
ResourceBuilder::new_bytes_non_fungible()
ResourceBuilder::new_uuid_non_fungible()

Changed the syntax for specifying mutable NFT attributes

In v0.7, you used the #[scrypto(mutable)] syntax to specify an attribute in the non-fungible data that can be mutated. You now use the following syntax: #[mutable]

Renamed the traits you have to implement on custom struct

v0.7

v0.8

Encode

ScryptoEncode

Decode

ScryptoDecode

TypeId

ScryptoCategorize

Describe

LegacyDescribe*

* Until RCNet, you should use LegacyDescribe. There is a ScryptoDescribe trait but more work needs to be done on it.

Renamed NonFungibleAddress to NonFungibleGlobalId

The NonFungibleAddress type that allows developers to group the resource manager address and ID of the NFT in a single notation has now been renamed to NonFungibleGlobalId. Additionally, you can now retrieve the NonFungibleGlobalId from a NonFungible with the method .global_id().

Renamed NonFungibleId to NonFungibleLocalId

Retrieving the NonFungibleLocalId from a NonFungible has been also changed from .id() to .local_id().

Similarly, when retrieving the ids from a validated proof, you now call validated_proof.non_fungible_local_ids().

Changed initial_supply method when creating new resources with the ResourceBuilder

initial_supply() replaced by mint_initial_supply() no_initial_supply() replaced by create_with_no_initial_supply()

Additionaly, to assign an owner to the resource you create, you must call the ResourceBuilder’s set_owner() method before creating the resource with mint_initial_supply() or create_with_no_initial_supply().

Added assert_access_rule(rule) to ComponentAuthZone

You can now assert that a badge is present on the auth zone with ComponentAuthZone::assert_access_rule(rule). The transaction fails if the badge is not present.

Transaction Manifest

Renamed BURN_BUCKET to BURN_RESOURCE

Added RECALL_RESOURCE instruction

You can recall a resource from the transaction manifest. It accepts two parameter: one for the Vault ID to recall the tokens from and a decimal amount. Example:

RECALL_RESOURCE Bytes("49cd9235ba62b2c217e32e5b4754c08219ef16389761356eaccbf6f6bdbfa44d00000000") Decimal("1.2");

Added SET_METADATA instruction

You can now set the metadata of your components, packages and resources with the transaction manifest.

SET_METADATA
    PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe")
    "k"
    "v";

SET_METADATA
    ComponentAddress("component_sim1qg2jwzl3hxnkqye8tfj5v3p2wp7cv9xdcjv4nl63refs785pvt")
    "k"
    "v";

SET_METADATA
    ResourceAddress("resource_sim1qq8cays25704xdyap2vhgmshkkfyr023uxdtk59ddd4qs8cr5v")
    "k"
    "v";

Added instructions to manage royalties

More documentation on this will be provided soon.

Added SET_METHOD_ACCESS_RULE instruction

Provided you have access to the owner badge associated with the component, you can now set or change an AccessRule of a component or resource with the transaction manifest.

SET_METHOD_ACCESS_RULE
    ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum")
    0u32
    Enum("AccessRuleKey::Scrypto", "test")
    Enum("AccessRule::AllowAll");

Changed the CREATE_RESOURCE instruction.

Depending on whether you create a fungible or non-fungible resource, you will now use either CREATE_NON_FUNGIBLE_RESOURCE or CREATE_FUNGIBLE_RESOURCE.

Added CREATE_FUNGIBLE_RESOURCE_WITH_OWNER instruction

You can now create a fungible resource with an owner using the transaction manifest.

Added MINT_NON_FUNGIBLE instruction

There is now an easy syntax to mint non-fungible resource with the transaction manifest.

Added MINT_UUID_NON_FUNGIBLE instruction

If the ID of the NFT you want to mint is of the UUID type and you want to generate a random one, you can use the MINT_UUID_NON_FUNGIBLE instruction. That way you only have to specify the NFT data. A random ID will be automatically associated with it.

Changed ID syntax in a NonFungibleGlobalAddress

ID Type

Representation

String

<my_string>

Integer

#number#

Bytes

[010a]

UUID

{0236805c-56e9-4431-a2a3-7d339db305c4}

Example for a NonFungibleGlobalAddress with an integer ID:

NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:#123#")