Описание изменений
This commit is contained in:
@@ -1,23 +1,29 @@
|
||||
const hre = require('hardhat');
|
||||
const logger = require('../utils/logger');
|
||||
|
||||
async function main() {
|
||||
const AccessToken = await hre.ethers.getContractFactory('AccessToken');
|
||||
const accessToken = await AccessToken.deploy();
|
||||
await accessToken.waitForDeployment();
|
||||
try {
|
||||
const AccessToken = await hre.ethers.getContractFactory('AccessToken');
|
||||
const accessToken = await AccessToken.deploy();
|
||||
await accessToken.waitForDeployment();
|
||||
|
||||
const address = await accessToken.getAddress();
|
||||
console.log('AccessToken deployed to:', address);
|
||||
const address = await accessToken.getAddress();
|
||||
logger.info('AccessToken deployed to:', address);
|
||||
|
||||
// Создаем первый админский токен для владельца контракта
|
||||
const [owner] = await hre.ethers.getSigners();
|
||||
const tx = await accessToken.mintAccessToken(owner.address, 0); // 0 = ADMIN
|
||||
await tx.wait();
|
||||
console.log('Admin token minted for:', owner.address);
|
||||
// Создаем первый админский токен для владельца контракта
|
||||
const [owner] = await hre.ethers.getSigners();
|
||||
const tx = await accessToken.mintAccessToken(owner.address, 1); // 1 = ADMIN
|
||||
await tx.wait();
|
||||
logger.info('Admin token minted for:', owner.address);
|
||||
} catch (error) {
|
||||
logger.error('Deployment error:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
logger.error('Unhandled error:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user