Write to chain
Solid allows you to write to the chain without any additional code. You can deploy contracts and issue transactions.
Deploy a token a send some tokens
Let's deploy a token and send some tokens to an address.
DeployToken.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "./std/console.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract CustomToken is ERC20 {
constructor() ERC20("My new token on Fiber", "MNT") {
_mint(msg.sender, 1000000000000000000000000);
}
}
contract Main {
function main() public {
CustomToken token = new CustomToken();
token.transfer(address(0x3), 10000000000000000000000);
Console.log("Token deployed");
Console.logAddress(address(token));
}
}Now we can run the contract.
Terminal
solid run DeployToken.solYou should see the following output:
Terminal
Token deployed
0xb7C43Db7DD6B77B7128154f4664820B75949Af51