Is there any kind of a constructor
like function, which will run at the time of deployment in move
programming language?
Asked
Active
Viewed 45 times
1 Answers
2
You might be looking for init_module
. This function runs just when you publish your module.
An example:
fun init_module(sender: &signer) {
aptos_framework::managed_coin::initialize<MoonCoin>(
sender,
b"Moon Coin",
b"MOON",
6,
false,
);
}
From aptos-move/move-examples/moon_coin/sources/MoonCoin.move in aptos-core.
You can learn more about it here: https://aptos.dev/move/move-on-aptos/modules-on-aptos/.

Daniel Porteous
- 5,536
- 3
- 25
- 44
-
is init_module specific to aptos or move in general? – A. K. Aug 03 '23 at 04:46