#
Targets
Targets are how Gemforge deploys knows how to deploy your contracts.
Each target must specify a network and wallet to use for deployment.
This means you can deploy multiple instances of your Diamond to the same network, where each instance is represented by a different target.
// gemforge.config.cjs
module.exports = {
...
targets: {
// Target named "local"
local: {
// Network to deploy to
network: 'local',
// Wallet to use for deployment
wallet: 'wallet1',
// Initialization method arguments
initArgs: []
// OPTIONAL - CREATE3 salt. If empty or ommitted a random SALT is used.
create3Salt: '0x...'
},
// Target named "testnet"
testnet: {
// Network to deploy to
network: 'sepolia',
// Wallet to use for deployment
wallet: 'wallet2',
// Initialization method arguments
initArgs: [],
// OPTIONAL - CREATE3 salt. If empty or ommitted a random SALT is used.
create3Salt: '0x...'
}
}
...
}
The wallet
value must refer to a valid, defined wallet. The initArgs
value is only valid if you are customizing the initialization of your diamond.
To deploy contracts to one of the specified targets simply use its name with the deploy command. For example, to deploy to the testnet
target:
gemforge deploy testnet
#
CREATE3 salt
The create3Salt
value is a "0x"
prefixed hex string of length 66
that is to be used for keyless CREATE3 deployments of the Diamond proxy contract.
By setting this value you can ensure that your Diamond proxy contract is always deployed to the same address as long as the deployment wallet and salt value remain unchanged. And by using the same wallet and salt for every deployment target you can ensure that all deployments to all targets (and thus chains) are at the same address, making managing omni-chain deployments easy.
If the salt value is empty or ommitted then Gemforge will create a random salt to use, meaning that fresh deployments of your Diamond proxy will always be at different addresses.
Note: Only the Diamond proxy contract is deployed using CREATE3
. Facet contracts are deployed normally.