Config
config.json
It can change the initial environment settings by setting the config file separately in the root path. However, the config file is not required and if it does not exist or some entries are not present, it will act as a default setting built into the code. Therefore, if separate environment settings are not required, they can be omitted.
export const config = {
deployer: {
address: process.env.DEPLOYER,
privateKey: process.env.PRIVATE_KEY,
},
artifact: {
diamonds: ["MyDiamond", "contracts/myapp/diamond2/MyDiamond.sol:MyDiamond"],
abi: {
include: ["facet", "facets", "shared"],
exclude: ["Data", "Facet"],
path: "artifacts/.diamonds",
file: "diamond",
},
},
loupe: {
path: "artifacts/.diamonds",
file: "facet",
},
};
export default config;
None of the following fields in the config file are required. values could be added and changed if only needed.
deployer
address
: string
The owner address is an initial value that will be used as the 'owner' property of diamond args, at the time of deploying the diamond factory. If no value is provided for the field, the default address provided by Hardhat will be used.
artifacts
diamonds
: string[]
Define here, which diamond files required generating an integrated abi of diamonds. If a diamond contract is used with a duplicate name, it must be identified by providing an artifact name that includes the full path to the diamond.
diamonds: [
'MyDiamond',
'contracts/myapp/diamond2/MyDiamond.sol:MyDiamond'
],
abi
include
include
: string[]
or ['facet', 'facets', 'shared']
as default.
String words defined in include
properties are used to search artifacts of facet contracts. If the 'MyDiamond' was defined as the name of the diamond in the above artifacts.diamond
, will find facets that include the words in their path from paths that include the diamond name.
[
'contracts/myapp/MyDiamond.sol:MyDiamond',
+ 'contracts/myapp/facets/Mint.sol:Mint',
+ 'contracts/myapp/facets/Burn.sol:Burn',
+ 'contracts/myapp/facets/Approval.sol:Approval',
+ 'contracts/myapp/facets/Transfer.sol:Transfer',
]
If there are some artifacts not include the filter words among this filtered result of artifacts, those artifacts as a starting point, and other facets will be excluded under those.
[
'contracts/myapp/MyDiamond.sol:MyDiamond',
+ 'contracts/myapp/facets/Mint.sol:Mint',
+ 'contracts/myapp/facets/Burn.sol:Burn',
+ 'contracts/myapp/facets/Approval.sol:Approval',
+ 'contracts/myapp/facets/Transfer.sol:Transfer',
'contracts/myapp/vault/MyVaultDiamond.sol:MyVaultDiamond',
# 'contracts/myapp/vault/facets/Deposit.sol:Deposit',
# 'contracts/myapp/vault/facets/Withdraw.sol:Withdraw',
# 'contracts/myapp/vault/facets/Lockup.sol:Lockup'
]