|
|
|
|
|
|
|
|
import * as dotevnv from "dotenv" |
|
|
import * as dotevnv from "dotenv" |
|
|
import {toUtf8String,parseUnits,ContractFactory, parseEther,JsonRpcProvider, Contract, JsonRpcSigner, Wallet,ContractTransactionResponse, MaxInt256 |
|
|
import {toUtf8String,parseUnits,ContractFactory, parseEther,JsonRpcProvider, Contract, JsonRpcSigner, Wallet,ContractTransactionResponse, MaxInt256 |
|
|
,Transaction,formatEther, |
|
|
,Transaction,formatEther, |
|
|
ZeroHash,ethers,keccak256 |
|
|
|
|
|
|
|
|
ZeroHash,ethers,keccak256,id |
|
|
} from 'ethers' |
|
|
} from 'ethers' |
|
|
import chalk from "chalk"; |
|
|
import chalk from "chalk"; |
|
|
import {Calulator} from "../inc/calc"; |
|
|
import {Calulator} from "../inc/calc"; |
|
|
|
|
|
|
|
|
return signed; |
|
|
return signed; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getOperatorGrantData(symbol:string,from: Wallet, to: Wallet, amount: number = 1): Promise<any> { |
|
|
|
|
|
|
|
|
async function getOperatorGrantData(symbol:string,signer:Wallet,tobeOperator: Wallet): Promise<any> { |
|
|
const proxy = getDeploymentAddresses(symbol).address; |
|
|
const proxy = getDeploymentAddresses(symbol).address; |
|
|
console.log(`토큰 주소 : ${proxy}`); |
|
|
console.log(`토큰 주소 : ${proxy}`); |
|
|
|
|
|
let nonce = await getNonce(signer.address); |
|
|
const token = new SecurityToken__factory(issuer).attach(proxy) as SecurityToken; |
|
|
const token = new SecurityToken__factory(issuer).attach(proxy) as SecurityToken; |
|
|
//ret = await adminToken.grantRole( id('OPERATOR_ROLE'),tobeOperator,{ gasLimit: 20000000}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tx = await token.grantRole.populateTransaction( |
|
|
|
|
|
id('OPERATOR_ROLE'),tobeOperator, |
|
|
|
|
|
{ |
|
|
|
|
|
gasLimit: 2100000, |
|
|
|
|
|
nonce: nonce, |
|
|
|
|
|
type: 2, |
|
|
|
|
|
chainId: 1337 |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const signed = await signer.signTransaction(tx); |
|
|
|
|
|
return signed; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const calc = new Calulator(); |
|
|
const calc = new Calulator(); |
|
|
|
|
|
|
|
|
const holder2 = new Wallet('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',provider); |
|
|
const holder2 = new Wallet('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',provider); |
|
|
|
|
|
|
|
|
async function main() { |
|
|
async function main() { |
|
|
const tx = await getTransferData('test001',holder2, holder1,1); |
|
|
|
|
|
|
|
|
// const tx = await getTransferData('test001',holder2, holder1,1); |
|
|
|
|
|
// console.log(tx); |
|
|
|
|
|
|
|
|
|
|
|
const tx = await getOperatorGrantData('test001',signer,holder2); |
|
|
console.log(tx); |
|
|
console.log(tx); |
|
|
|
|
|
|
|
|
} |
|
|
} |