Skip to content

Commit

Permalink
Store DEWEB version in storage during contract initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey committed Oct 10, 2024
1 parent e43f64c commit 8e5618c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions smart-contract/assembly/contracts/deweb-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Context,
generateEvent,
setBytecode,
Storage,
transferCoins,
} from '@massalabs/massa-as-sdk';
import {
Expand Down Expand Up @@ -33,6 +34,7 @@ import {
import { _getFileLocations } from './internals/location';
import { _fileInit } from './internals/fileInit';
import { FileInit } from './serializable/FileInit';
import { DEWEB_VERSION_TAG } from './internals/storageKeys/tags';

/**
* Initializes the smart contract.
Expand All @@ -41,6 +43,9 @@ import { FileInit } from './serializable/FileInit';
export function constructor(_: StaticArray<u8>): void {
if (!Context.isDeployingContract()) return;

const version = new Args().next<string>().expect('Invalid version');
Storage.set(DEWEB_VERSION_TAG, stringToBytes(version));

_setOwner(Context.caller().toString());
}

Expand Down

0 comments on commit 8e5618c

Please sign in to comment.