Deploy and verify contract by Foundry

Initialize the foundry directory

forge init 

Install an open-source solidity repo

forge install OpenZeppelin/openzeppelin-contracts

Open the directory by vs-code

code .

Modify "Counter.sol"

1 Rename the file to "TokenTest.sol"

2 Modify the "TokenTest.sol" code as follows:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";

contract TokenTest is ERC20 {
    constructor() ERC20("BEVM", "BEVM") {
        _mint(msg.sender, 1000 * 10 ** 18);
    }
} 

Modify "Counter.s.sol"

1 Rename the file to "TokenTest.s.sol"

2 Modify the "TokenTest.s.sol" code as follows:

Delete "test.sol"

It's optional. You may adjust the code accordingly.

Add a ".env" File

Activate ".env"

Deploy and verify your contract

When utilizing BEVM Canary/BEVM Canary TestNet, to align the Solidity version correctly, you may insert "solc_version = "0.8.13" " into the "foundry.toml" file within the "[profile.default]" section. This adjustment may require you to modify certain dependencies.

Afterward, the current status is provided beneath.

Deploy
Verify

Last updated