您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import {toUtf8String,parseUnits,ContractFactory, parseEther,JsonRpcProvider, Contract, JsonRpcSigner, Wallet,ContractTransactionResponse, MaxInt256
  2. ,Transaction, AbiCoder,BigNumberish,ZeroHash
  3. } from 'ethers'
  4. import {upgrades, ethers} from 'hardhat';
  5. import {
  6. SecurityToken,
  7. SecurityToken__factory,
  8. } from '../typechain'
  9. import {
  10. DEFAULT_DOCUMENTS,
  11. DEFAULT_ERC20_DETAILS,
  12. DEFAULT_PARTITIONS,
  13. DEFAULT_VARIABLES,
  14. } from './defaultParameters';
  15. export class TokenIssuer {
  16. wallet: Wallet = null;
  17. provider:JsonRpcProvider = null;
  18. beaconAddress: string = null;
  19. rulesAddress: string = null;
  20. tokenOwner: string = null;
  21. constructor(wallet: Wallet, beaconAddress: string, rulesAddress: string, tokenOwner: string) {
  22. this.wallet = wallet;
  23. this.beaconAddress = beaconAddress;
  24. this.rulesAddress = rulesAddress;
  25. this.tokenOwner = tokenOwner;
  26. // console.log(`constructor: \r\nbeacon = ${this.beaconAddress}, \r\nrules = ${this.rulesAddress}, \r\nowner = ${this.tokenOwner}`);
  27. }
  28. async deploy(name:string, symbol:string,decimals: number, maxSupply: number, issuer: string, operators: string[], lockers: string[],controller: string[]): Promise<string> {
  29. console.log('deploying token....');
  30. const TokenContract = new SecurityToken__factory(this.wallet);
  31. const proxy = await upgrades.deployBeaconProxy(this.beaconAddress, TokenContract, [
  32. this.rulesAddress,
  33. issuer,
  34. controller,
  35. operators,
  36. lockers,
  37. {
  38. name,
  39. symbol,
  40. decimals,
  41. maxSupply
  42. },
  43. DEFAULT_PARTITIONS.map(p => p.toPartitionStruct()),
  44. ]);
  45. await proxy.waitForDeployment();
  46. const proxyAddress = await proxy.getAddress();
  47. return proxyAddress;
  48. }
  49. async issue(token: string, holder: string, amount: BigNumberish) {
  50. }
  51. }