Simon Lee 1 year ago
parent
commit
9f820b509f
4 changed files with 35 additions and 20 deletions
  1. 10
    10
      .env
  2. 2
    2
      TC2/start.ts
  3. 3
    3
      TC3/start.ts
  4. 20
    5
      TC9/start.ts

+ 10
- 10
.env View File

@@ -5,20 +5,20 @@
# CHAINID=1337

#OCI
# RPCURL=http://193.123.252.127:80
# CHAINID=1337
# GATE_WAY=https://api.stopulse.co.kr/main/v1/
# GATE_WAY_RAW=https://api.stopulse.co.kr/
# AUTHTOKEN=580c6006687220df84f83d7c345c00ad9829de0694bd00c09e211d8c810b7510
RPCURL=http://193.123.252.127:80
CHAINID=1337
GATE_WAY=http://api.stopulse.co.kr/main/v1/
GATE_WAY_RAW=http://api.stopulse.co.kr/
AUTHTOKEN=580c6006687220df84f83d7c345c00ad9829de0694bd00c09e211d8c810b7510



#dev
RPCURL=http://193.123.252.127:80
CHAINID=1337
GATE_WAY=http://172.25.1.108/main/v1/
GATE_WAY_RAW=http://172.25.1.108/
AUTHTOKEN=18851850e4237cc34ea0a7a1de7cb5af362ee854363b60983ed4c18d9b12cb27
# RPCURL=http://193.123.252.127:80
# CHAINID=1337
# GATE_WAY=http://172.25.1.108/main/v1/
# GATE_WAY_RAW=http://172.25.1.108/
# AUTHTOKEN=18851850e4237cc34ea0a7a1de7cb5af362ee854363b60983ed4c18d9b12cb27




+ 2
- 2
TC2/start.ts View File

@@ -194,7 +194,7 @@ async function transfer(signer: Wallet,symbol:string,from: Wallet, to: Wallet, a

let proms = [];
for(let i = 0; i < count; i++) {
console.log(`sending ${i} , nonce : ${signedData[i].nonce}`);
//console.log(`sending ${i} , nonce : ${signedData[i].nonce}`);
proms.push(send(signedData[i].sig));
}

@@ -262,7 +262,7 @@ console.log(`목적 서버 : ${gateWay}`);

async function main() {
//spareToken('BCG_TEST');
transfer(holder1,'BCG_TEST',holder2, holder1,1, 4);
transfer(holder1,'BCG_TEST',holder2, holder1,1, 1000);
}

main();

+ 3
- 3
TC3/start.ts View File

@@ -138,10 +138,10 @@ const holder2 = new Wallet('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae
console.log(`목적 서버 : ${gateWay}`);

async function main() {
//await readHealth('BCG_TEST',holder1,1000);
await readTest('BCG_TEST',holder1,5000);
// await readHealth('BCG_TEST',holder1,1000);
await readTest('BCG_TEST',holder1,1000);
}

main();



+ 20
- 5
TC9/start.ts View File

@@ -1,7 +1,7 @@
import * as dotevnv from "dotenv"
import {toUtf8String,parseUnits,ContractFactory, parseEther,JsonRpcProvider, Contract, JsonRpcSigner, Wallet,ContractTransactionResponse, MaxInt256
,Transaction,formatEther,
ZeroHash,ethers,keccak256
ZeroHash,ethers,keccak256,id
} from 'ethers'
import chalk from "chalk";
import {Calulator} from "../inc/calc";
@@ -53,12 +53,24 @@ async function getTransferData(symbol:string,from: Wallet, to: Wallet, amount: n
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;
console.log(`토큰 주소 : ${proxy}`);
let nonce = await getNonce(signer.address);
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();
@@ -74,7 +86,10 @@ const holder1 = new Wallet('0xae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c
const holder2 = new Wallet('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',provider);

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);

}

Loading…
Cancel
Save