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

Commit

Permalink
latest code
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammad-Mubeen committed Apr 18, 2022
1 parent 52c1bf0 commit 81cb55b
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 78 deletions.
42 changes: 31 additions & 11 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ WCSPR=238834bc76aed9e18ad0260e65d2ef751999c97c13da92dee83bd511e31e2d2d
WCSPR_PACKAGE=afcaa550ebb63266fb2752b58ecd7e8fcd78e0a75777ecd57045213a013d9813
LIBRARY=a9513934697269b8448dec4c6dbd4841387e87b9b5bbf251a259bea474f5dc12
LIBRARY_PACKAGE=75a21a01e8c8d0f789e35b00efb9979b449f9d16941bd3ad846db8163310b717
PAIR_CONTRACT=3625d9882afe51423c8cee562feb4123a3583f2e6b91a4557d2d607a030ef1a9
PAIR_CONTRACT_PACKAGE=c956ddec09b725a217ac5480fc9cef2411c73b6aaac2e6215ca7255d20f77485
PAIR_CONTRACT=cdba28c1136debb97e650e9355a4495dfe67408968601c68951212abda067d4b
PAIR_CONTRACT_PACKAGE=cb0f9f291ae73928b739c90c03eca70cd610d945304ea606fe4adced3fa07060
CALLEE_CONTRACT=c981f2165686f3fa8ab77f89b3ac364987325e48a038f6fbdfd6bb46123f0e3c
CALLEE_PACKAGE=dec17bf68eeb83be7e96e5974981c64772a2f48e402fe95b63877bf50df7854e
TOKEN0_CONTRACT=5240db456a1a2cb63cabcdebb86a5177d0e9ceddab7a737b3bd90caeae33e80e
TOKEN0_CONTRACT_PACKAGE=bdcd8c9844cd2f98c81b3f98ce806f20c5a625f954d7b29bf70626fef060ff1f
TOKEN0_CONTRACT=238834bc76aed9e18ad0260e65d2ef751999c97c13da92dee83bd511e31e2d2d
TOKEN0_CONTRACT_PACKAGE=afcaa550ebb63266fb2752b58ecd7e8fcd78e0a75777ecd57045213a013d9813
TOKEN1_CONTRACT=9aef66efbac45daf71f92f3446422a00fd3adaaf206a1c29d80f26bc513c105d
TOKEN1_CONTRACT_PACKAGE=03e3e09b28dc4d41a4507b38073e7a1641becc0b40e79beb72733d2fb022defa

Expand All @@ -35,6 +35,13 @@ WETH_CONTRACT_PACKAGE=03e3e09b28dc4d41a4507b38073e7a1641becc0b40e79beb72733d2fb0
WISE_WETH_CONTRACT=3625d9882afe51423c8cee562feb4123a3583f2e6b91a4557d2d607a030ef1a9
WISE_WETH_CONTRACT_PACKAGE=c956ddec09b725a217ac5480fc9cef2411c73b6aaac2e6215ca7255d20f77485

WCSPR_WISE_CONTRACT=1360784852182e8aa0c83a3196afb058bfa5b36a17fa238c26f11208e401f013
WCSPR_WISE_CONTRACT_PACKAGE=a84382872d1402a5ec8d8453f516586166100d8252f997b0bcdeed8c4737588d

WCSPR_WETH_CONTRACT=cdba28c1136debb97e650e9355a4495dfe67408968601c68951212abda067d4b
WCSPR_WETH_CONTRACT_PACKAGE=cb0f9f291ae73928b739c90c03eca70cd610d945304ea606fe4adced3fa07060


GRAPHQL=https://casper-uniswap-v2-graphql.herokuapp.com/graphql
CHAIN_NAME=casper-test
NODE_ADDRESS=http://159.65.118.250:7777/rpc
Expand All @@ -57,9 +64,21 @@ ERC20_TOKEN_SYMBOL=WETH
ERC20_DECIMALS=9
ERC20_TOTAL_SUPPLY=0

PAIR_CONTRACT_NAME=WISER-WrappedEther1
PAIR_TOKEN_NAME=WISE-WETH
PAIR_TOKEN_SYMBOL=WISE-WETH
; PAIR_CONTRACT_NAME=WISER-WrappedEther1
; PAIR_TOKEN_NAME=WISE-WETH
; PAIR_TOKEN_SYMBOL=WISE-WETH
; PAIR_DECIMALS=9
; PAIR_TOTAL_SUPPLY=0

; PAIR_CONTRACT_NAME=WrappedCasper-WISER
; PAIR_TOKEN_NAME=WCSPR-WISE
; PAIR_TOKEN_SYMBOL=WCSPR-WISE
; PAIR_DECIMALS=9
; PAIR_TOTAL_SUPPLY=0

PAIR_CONTRACT_NAME=WrappedCasper-WrappedEther1
PAIR_TOKEN_NAME=WCSPR-WETH
PAIR_TOKEN_SYMBOL=WCSPR-WETH
PAIR_DECIMALS=9
PAIR_TOTAL_SUPPLY=0

Expand Down Expand Up @@ -115,15 +134,16 @@ MINT_COPIES_COUNT=20
MINT_MANY_META_SIZE=5
MINT_MANY_META_COUNT=5

TO = df245f53215c2e747c2db7a99d6dd4e20f6b30194565ab3ccc4d83bb73ac89f9
; TO = df245f53215c2e747c2db7a99d6dd4e20f6b30194565ab3ccc4d83bb73ac89f9
TO = 282fabb87a057d991937770223de98ae86f6e652a050825aa196dfd4f480029e
DEADLINE = 1739598100811
# add_liquidity

TOKEN_A = bdcd8c9844cd2f98c81b3f98ce806f20c5a625f954d7b29bf70626fef060ff1f
TOKEN_A = afcaa550ebb63266fb2752b58ecd7e8fcd78e0a75777ecd57045213a013d9813
TOKEN_B = 03e3e09b28dc4d41a4507b38073e7a1641becc0b40e79beb72733d2fb022defa

AMOUNT_A_DESIRED = 10000000000
AMOUNT_B_DESIRED = 1000000000
AMOUNT_A_DESIRED = 1000000000
AMOUNT_B_DESIRED = 10000000000
AMOUNT_A_MIN = 100000
AMOUNT_B_MIN = 100000

Expand Down
2 changes: 1 addition & 1 deletion JsClients/ERC20/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA1kpz9asuezN1wGCk2kH+2Vopt7dIq7TRrYPxYJUuUpw=
MCowBQYDK2VwAyEABlCsNxb/OaC2a+wgP6NAOREjfCfPs4+kOz2jnpCfw7Y=
-----END PUBLIC KEY-----
2 changes: 1 addition & 1 deletion JsClients/ERC20/keys/public_key_hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
01d64a73f5ab2e7b3375c060a4da41fed95a29b7b748abb4d1ad83f160952e529c
010650ac3716ff39a0b66bec203fa3403911237c27cfb38fa43b3da39e909fc3b6
2 changes: 1 addition & 1 deletion JsClients/ERC20/keys/secret_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIJ213TqwJjUU6Uv9cHuK3fGyxRnGANjLygW2FaoUdrNI
MC4CAQAwBQYDK2VwBCIEIPw2THQrmfrBz8VgHfmmuE04dGPwYmPuiBjT2bkgrXKo
-----END PRIVATE KEY-----
66 changes: 33 additions & 33 deletions JsClients/ERC20/src/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,44 +328,15 @@ class ERC20Client {
throw Error("Invalid Deploy");
}
}
// public async mint(
// keys: Keys.AsymmetricKey,
// to: RecipientType,
// amount: string,
// paymentAmount: string
// ) {

// const runtimeArgs = RuntimeArgs.fromMap({
// to:utils.createRecipientAddress(to),
// amount: CLValueBuilder.u256(amount)
// });

// const deployHash = await contractCall({
// chainName: this.chainName,
// contractHash: this.contractHash,
// entryPoint: "mint",
// keys,
// nodeAddress: this.nodeAddress,
// paymentAmount,
// runtimeArgs,
// });

// if (deployHash !== null) {

// return deployHash;
// } else {
// throw Error("Invalid Deploy");
// }
// }
public async mint(
keys: Keys.AsymmetricKey,
to: string,
to: RecipientType,
amount: string,
paymentAmount: string
) {
const tobytearray = new CLByteArray(Uint8Array.from(Buffer.from(to, 'hex')));

const runtimeArgs = RuntimeArgs.fromMap({
to: CLValueBuilder.key(tobytearray),
to:utils.createRecipientAddress(to),
amount: CLValueBuilder.u256(amount)
});

Expand All @@ -380,12 +351,41 @@ class ERC20Client {
});

if (deployHash !== null) {

return deployHash;
} else {
throw Error("Invalid Deploy");
}
}
// public async mint(
// keys: Keys.AsymmetricKey,
// to: string,
// amount: string,
// paymentAmount: string
// ) {
// const tobytearray = new CLByteArray(Uint8Array.from(Buffer.from(to, 'hex')));
// const runtimeArgs = RuntimeArgs.fromMap({
// to: CLValueBuilder.key(tobytearray),
// amount: CLValueBuilder.u256(amount)
// });

// const deployHash = await contractCall({
// chainName: this.chainName,
// contractHash: this.contractHash,
// entryPoint: "mint",
// keys,
// nodeAddress: this.nodeAddress,
// paymentAmount,
// runtimeArgs,
// });

// if (deployHash !== null) {

// return deployHash;
// } else {
// throw Error("Invalid Deploy");
// }
// }
public async burn(
keys: Keys.AsymmetricKey,
from: RecipientType,
Expand Down
44 changes: 22 additions & 22 deletions JsClients/ERC20/test/installed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,9 @@ const test = async () => {
// console.log(`... Allowance: ${allowance}`);

// //mint
// const mintDeployHash = await erc20.mint(
// ROUTERKEYS,
// ROUTERKEYS.publicKey,
// MINT_AMOUNT!,
// MINT_PAYMENT_AMOUNT!
// );
// console.log("... Mint deploy hash: ", mintDeployHash);

// await getDeploy(NODE_ADDRESS!, mintDeployHash);
// console.log("... Token minted successfully.");

//mint
const mintDeployHash = await erc20.mint(
ROUTERKEYS,
"386859a25c3f8355d663fe7bb8a2cad36efa65292ef073b2fbadef8da8f976f2",
ROUTERKEYS.publicKey,
MINT_AMOUNT!,
MINT_PAYMENT_AMOUNT!
);
Expand All @@ -126,6 +114,18 @@ const test = async () => {
await getDeploy(NODE_ADDRESS!, mintDeployHash);
console.log("... Token minted successfully.");

//mint
// const mintDeployHash = await erc20.mint(
// ROUTERKEYS,
// "70629f295bebdff4f09073a35946e56720f7aeb0214a9b7f59222b19a9297295",
// MINT_AMOUNT!,
// MINT_PAYMENT_AMOUNT!
// );
// console.log("... Mint deploy hash: ", mintDeployHash);

// await getDeploy(NODE_ADDRESS!, mintDeployHash);
// console.log("... Token minted successfully.");

// balanceof
// let balance = await erc20.balanceOfcontract(PAIR_CONTRACT!);
// console.log(`... Balance: ${balance}`);
Expand All @@ -147,16 +147,16 @@ const test = async () => {
// // console.log(`... Total supply: ${totalSupply}`);

//approve
// const approveDeployHash = await erc20.approve(
// ROUTERKEYS,
// PACKAGE_HASH!,
// AMOUNT_B_DESIRED!,
// APPROVE_PAYMENT_AMOUNT!
// );
// console.log("... Approve deploy hash: ", approveDeployHash);
const approveDeployHash = await erc20.approve(
ROUTERKEYS,
PACKAGE_HASH!,
AMOUNT_B_DESIRED!,
APPROVE_PAYMENT_AMOUNT!
);
console.log("... Approve deploy hash: ", approveDeployHash);

// await getDeploy(NODE_ADDRESS!, approveDeployHash);
// console.log("... Token approved successfully");
await getDeploy(NODE_ADDRESS!, approveDeployHash);
console.log("... Token approved successfully");

// // //transfer
// // const transferDeployHash = await erc20.transfer(
Expand Down
2 changes: 1 addition & 1 deletion JsClients/FACTORY/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA1kpz9asuezN1wGCk2kH+2Vopt7dIq7TRrYPxYJUuUpw=
MCowBQYDK2VwAyEABlCsNxb/OaC2a+wgP6NAOREjfCfPs4+kOz2jnpCfw7Y=
-----END PUBLIC KEY-----
2 changes: 1 addition & 1 deletion JsClients/FACTORY/keys/public_key_hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
01d64a73f5ab2e7b3375c060a4da41fed95a29b7b748abb4d1ad83f160952e529c
010650ac3716ff39a0b66bec203fa3403911237c27cfb38fa43b3da39e909fc3b6
2 changes: 1 addition & 1 deletion JsClients/FACTORY/keys/secret_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIJ213TqwJjUU6Uv9cHuK3fGyxRnGANjLygW2FaoUdrNI
MC4CAQAwBQYDK2VwBCIEIPw2THQrmfrBz8VgHfmmuE04dGPwYmPuiBjT2bkgrXKo
-----END PRIVATE KEY-----
2 changes: 1 addition & 1 deletion JsClients/PAIR/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA1kpz9asuezN1wGCk2kH+2Vopt7dIq7TRrYPxYJUuUpw=
MCowBQYDK2VwAyEABlCsNxb/OaC2a+wgP6NAOREjfCfPs4+kOz2jnpCfw7Y=
-----END PUBLIC KEY-----
2 changes: 1 addition & 1 deletion JsClients/PAIR/keys/public_key_hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
01d64a73f5ab2e7b3375c060a4da41fed95a29b7b748abb4d1ad83f160952e529c
010650ac3716ff39a0b66bec203fa3403911237c27cfb38fa43b3da39e909fc3b6
2 changes: 1 addition & 1 deletion JsClients/PAIR/keys/secret_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIJ213TqwJjUU6Uv9cHuK3fGyxRnGANjLygW2FaoUdrNI
MC4CAQAwBQYDK2VwBCIEIPw2THQrmfrBz8VgHfmmuE04dGPwYmPuiBjT2bkgrXKo
-----END PRIVATE KEY-----
2 changes: 1 addition & 1 deletion JsClients/ROUTER/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA1kpz9asuezN1wGCk2kH+2Vopt7dIq7TRrYPxYJUuUpw=
MCowBQYDK2VwAyEABlCsNxb/OaC2a+wgP6NAOREjfCfPs4+kOz2jnpCfw7Y=
-----END PUBLIC KEY-----
2 changes: 1 addition & 1 deletion JsClients/ROUTER/keys/public_key_hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
01d64a73f5ab2e7b3375c060a4da41fed95a29b7b748abb4d1ad83f160952e529c
010650ac3716ff39a0b66bec203fa3403911237c27cfb38fa43b3da39e909fc3b6
2 changes: 1 addition & 1 deletion JsClients/ROUTER/keys/secret_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIJ213TqwJjUU6Uv9cHuK3fGyxRnGANjLygW2FaoUdrNI
MC4CAQAwBQYDK2VwBCIEIPw2THQrmfrBz8VgHfmmuE04dGPwYmPuiBjT2bkgrXKo
-----END PRIVATE KEY-----

0 comments on commit 81cb55b

Please sign in to comment.