Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
keys successfully removed and added to .gitignore
Browse files Browse the repository at this point in the history
now, to do deployment first create keys, fund them then add them to scripts ERC20, FACTORY, PAIR and ROUTER folders etherwise runn scripts command would throw errors. See all script commands from readme
  • Loading branch information
Hammad-Mubeen committed May 30, 2022
1 parent a7f84f5 commit 84053c6
Show file tree
Hide file tree
Showing 66 changed files with 700 additions and 1,325 deletions.
20 changes: 10 additions & 10 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ NODE_ADDRESS=http://159.65.118.250:7777/rpc
EVENT_STREAM_ADDRESS=http://159.65.118.250:9999/events/main
RECEIVER_ACCOUNT_ONE=017e82abcc9539a01cfd9d63ae8c9c8b3a752a6f75ba1ab148714eea03e9be69a7

ERC20_WASM_PATH=JsClients/ERC20/wasm/erc20-token.wasm
FACTORY_WASM_PATH=JsClients/FACTORY/wasm/factory.wasm
PAIR_WASM_PATH=JsClients/PAIR/wasm/pair-token.wasm
WASM_PATH=JsClients/ROUTER/wasm/uniswap-v2-router.wasm
ERC20_WASM_PATH=Scripts/ERC20/wasm/erc20-token.wasm
FACTORY_WASM_PATH=Scripts/FACTORY/wasm/factory.wasm
PAIR_WASM_PATH=Scripts/PAIR/wasm/pair-token.wasm
WASM_PATH=Scripts/ROUTER/wasm/uniswap-v2-router.wasm

ERC20_MASTER_KEY_PAIR_PATH=JsClients/ERC20/keys/
FACTORY_MASTER_KEY_PAIR_PATH=JsClients/FACTORY/keys/
PAIR_MASTER_KEY_PAIR_PATH=JsClients/PAIR/keys/
MASTER_KEY_PAIR_PATH=JsClients/ROUTER/keys/
ERC20_MASTER_KEY_PAIR_PATH=Scripts/ERC20/keys/
FACTORY_MASTER_KEY_PAIR_PATH=Scripts/FACTORY/keys/
PAIR_MASTER_KEY_PAIR_PATH=Scripts/PAIR/keys/
MASTER_KEY_PAIR_PATH=Scripts/ROUTER/keys/

ERC20_CONTRACT_NAME=Wrapper Ether1
ERC20_TOKEN_NAME=Wrapper Ether
Expand Down Expand Up @@ -124,8 +124,8 @@ TOKEN_SYMBOL=DRAG
TOKEN_META=origin fire,lifetime infinite
CONTRACT_NAME=UniSwapRouter1

CONTRACT_HASH=2bd3b33f9d0a137a5790ebf0091d6bb5e0f47df6b7ca783989df8490c35875c7
PACKAGE_HASH=ea048572fa8c13b56b58d512d9f3757823e42b74ad3273812ead895df6474d9d
ROUTER_CONTRACT_HASH=2bd3b33f9d0a137a5790ebf0091d6bb5e0f47df6b7ca783989df8490c35875c7
ROUTER_PACKAGE_HASH=ea048572fa8c13b56b58d512d9f3757823e42b74ad3273812ead895df6474d9d
INSTALL_PAYMENT_AMOUNT=300000000000
MINT_ONE_PAYMENT_AMOUNT=2000000000
MINT_COPIES_PAYMENT_AMOUNT=100000000000
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/node_modules
# /JsClients/ERC20/keys
# /JsClients/FACTORY/keys
# /JsClients/PAIR/keys
# /JsClients/ROUTER/keys
/Scripts/ERC20/keys
/Scripts/FACTORY/keys
/Scripts/PAIR/keys
/Scripts/ROUTER/keys
98 changes: 98 additions & 0 deletions JsClients/ERC20/erc20FunctionsForBackend/functions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { config } from "dotenv";
config();
import { ERC20Client} from "../src";

const {
NODE_ADDRESS,
EVENT_STREAM_ADDRESS,
CHAIN_NAME
} = process.env;

const erc20 = new ERC20Client(
NODE_ADDRESS!,
CHAIN_NAME!,
EVENT_STREAM_ADDRESS!
);

export const getName = async (contractHash:string) => {

// We don't need hash- prefix so i'm removing it
await erc20.setContractHash(contractHash);

//name
const name = await erc20.name();
console.log(contractHash +` =... Contract name: ${name}`);

return name;

};

export const getSymbol = async (contractHash:string) => {

// We don't need hash- prefix so i'm removing it
await erc20.setContractHash(contractHash);

//symbol
const symbol = await erc20.symbol();
console.log(contractHash +` =... Contract symbol: ${symbol}`);

return symbol;

};

export const getDecimals = async (contractHash:string) => {

// We don't need hash- prefix so i'm removing it
await erc20.setContractHash(contractHash);

//decimal
const decimal = await erc20.decimal();
console.log(contractHash +" =... Contract decimal: ", decimal);

return decimal;

};

export const getTotalSupply = async (contractHash:string) => {

// We don't need hash- prefix so i'm removing it
await erc20.setContractHash(contractHash);

//totalsupply
let totalSupply = await erc20.totalSupply();
console.log(contractHash +` = ... Total supply: ${totalSupply}`);

return totalSupply;

};

export const balanceOf = async (contractHash:string, key:string) => {

console.log(`... Contract Hash: ${contractHash}`);

// We don't need hash- prefix so i'm removing it
await erc20.setContractHash(contractHash);

//balanceof
let balance = await erc20.balanceOf(key);

console.log(`... Balance: ${balance}`);

return balance;

};

export const allowance = async (contractHash:string, ownerkey:string, spenderkey:string) => {

console.log(`... Contract Hash: ${contractHash}`);

// We don't need hash- prefix so i'm removing it
await erc20.setContractHash(contractHash);

let allowance = await erc20.allowance(ownerkey,spenderkey);

console.log(`... Allowance: ${allowance}`);

return allowance;

};
3 changes: 0 additions & 3 deletions JsClients/ERC20/keys/public_key.pem

This file was deleted.

1 change: 0 additions & 1 deletion JsClients/ERC20/keys/public_key_hex

This file was deleted.

3 changes: 0 additions & 3 deletions JsClients/ERC20/keys/secret_key.pem

This file was deleted.

Loading

0 comments on commit 84053c6

Please sign in to comment.