Specify installed contracts to external contracts section of locklift config, by providing path to contracts artifacts (.abi.json files, .tvc files etc., most commonly placed in a build folder of smart contracts projects) and contract names array.
Let's move to deploy action. Firstly, we make a new deploy script in scripts directory for TokenRoot contract.
01-deploy-token-root.ts
import { Address, getRandomNonce, toNano, zeroAddress } from"locklift"import BigNumber from"bignumber.js"asyncfunctionmain() {constsigner= (awaitlocklift.keystore.getSigner("0"))!// Address of initial token supply recipient (write your own)constinitialSupplyTo=newAddress("0:7542...")// Address of token owner (write your own)constrootOwner=newAddress("0:7542...")// Name of the token constname="First Venom Token"// Symbol of the tokenconstsymbol="FVT"// How many token will be issued instantly after deploy constinitialSupply=0// The number of decimals the token uses constdecimals=18// If `true`, disables token mintingconstdisableMint=false// If `true`, disables token burning by root constdisableBurnByRoot=false// If `true`, pauses token burning constpauseBurn=false/* Returns compilation artifacts based on the .sol file name or name from value config.externalContracts[pathToLib]. */constTokenWallet=locklift.factory.getContractArtifacts("TokenWallet")/* Deploy the TIP-3 Token Root contract. @params deployWalletValue: Along with the deployment of the root token, the wallet will be automatically deployed to the owner. This is the amount of EVERs that will be sent to the wallet. */const { contract: tokenRoot } =awaitlocklift.factory.deployContract({ contract:"TokenRoot", publicKey:signer.publicKey, initParams: { deployer_: zeroAddress,// this field should be zero address if deploying with public key (see source code) randomNonce_:getRandomNonce(), rootOwner_: rootOwner, name_: name, symbol_: symbol, decimals_: decimals, walletCode_:TokenWallet.code, }, constructorParams: { initialSupplyTo: initialSupplyTo, initialSupply:newBigNumber(initialSupply).shiftedBy(decimals).toFixed(), deployWalletValue:toNano(1), mintDisabled: disableMint, burnByRootDisabled: disableBurnByRoot, burnPaused: pauseBurn, remainingGasTo: zeroAddress, }, value:toNano(5), })console.log(`${name}: ${tokenRoot.address}`)}main().then(() =>process.exit(0)).catch(e => {console.log(e)process.exit(1) })
Finally, we can deploy a new token to local network. For this, make sure local node is running, if not follow the next command