Back to Fuels Ts

Storage Slots

apps/docs/src/guide/contracts/storage-slots.md

0.103.0787 B
Original Source

Storage Slots

When deploying a contract, you can specify the custom storage slots that you want to use.

<<< @./snippets/storage-slots/override-storage-slots.ts#contract-deployment-storage-slots{ts:line-numbers}

Using plain JavaScript

In the above example, we directly imported the storage slots from a JSON file generated by the Sway compiler.

Instead of importing from a file, you can also specify the custom storage slots directly in your code:

<<< @./snippets/storage-slots/override-storage-slots-inline.ts#contract-deployment-storage-slots-inline{ts:line-numbers}

Auto-load of Storage Slots

Code generated using Typegen automatically load Storage Slots for you.