| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import {toUtf8String,parseUnits,ContractFactory, parseEther,JsonRpcProvider, Contract, JsonRpcSigner, Wallet,ContractTransactionResponse, MaxInt256
- ,Transaction, AbiCoder,BigNumberish,ZeroHash
- } from 'ethers'
- import {upgrades, ethers} from 'hardhat';
- import {
- SecurityToken,
- SecurityToken__factory,
- } from '../typechain'
-
- import {
- DEFAULT_DOCUMENTS,
- DEFAULT_ERC20_DETAILS,
- DEFAULT_PARTITIONS,
- DEFAULT_VARIABLES,
- } from './defaultParameters';
-
-
-
- export class TokenIssuer {
-
- wallet: Wallet = null;
- provider:JsonRpcProvider = null;
- beaconAddress: string = null;
- rulesAddress: string = null;
- tokenOwner: string = null;
- constructor(wallet: Wallet, beaconAddress: string, rulesAddress: string, tokenOwner: string) {
- this.wallet = wallet;
- this.beaconAddress = beaconAddress;
- this.rulesAddress = rulesAddress;
- this.tokenOwner = tokenOwner;
-
- // console.log(`constructor: \r\nbeacon = ${this.beaconAddress}, \r\nrules = ${this.rulesAddress}, \r\nowner = ${this.tokenOwner}`);
- }
-
- async deploy(name:string, symbol:string,decimals: number, maxSupply: number, issuer: string, operators: string[], lockers: string[],controller: string[]): Promise<string> {
-
- console.log('deploying token....');
-
- const TokenContract = new SecurityToken__factory(this.wallet);
-
- const proxy = await upgrades.deployBeaconProxy(this.beaconAddress, TokenContract, [
- this.rulesAddress,
- issuer,
- controller,
- operators,
- lockers,
- {
- name,
- symbol,
- decimals,
- maxSupply
- },
- DEFAULT_PARTITIONS.map(p => p.toPartitionStruct()),
- ]);
-
- await proxy.waitForDeployment();
-
- const proxyAddress = await proxy.getAddress();
- return proxyAddress;
- }
-
- async issue(token: string, holder: string, amount: BigNumberish) {
-
- }
- }
|