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

Commit

Permalink
prettier and BitInt work added and database created
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammad-Mubeen committed Jan 9, 2022
1 parent abfb71d commit 379f38b
Show file tree
Hide file tree
Showing 65 changed files with 2,705 additions and 2,549 deletions.
78 changes: 33 additions & 45 deletions .env
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
NODE_MODE=deployed
DATABASE_URL_LOCAL=mongodb://localhost:27017/V2-graphQL
DATABASE_URL_ONLINE=mongodb+srv://admin:[email protected]/V2-graphQL-backend-forinterface?retryWrites=true&w=majority
DATABASE_URL_ONLINE=mongodb+srv://admin:[email protected]/V2-graphQL-backend-forinterface1?retryWrites=true&w=majority
COIN_MARKET_CAP_API_KEY=35a7ebf7-894d-4b67-8d57-36a2b050cbc8

FACTORY_CONTRACT=E52D527b3E7d9818cEDb6484e0e51ED3550505465C454e4Bd5e95d9418f3f93a
FACTORY_CONTRACT_PACKAGE=8589bE2588adb1240B8D6C470b4F2DF05cAa0bcb737962D77E3B628E9960Db2a
WCSPR=d540e0435C6Be6E7f359e132a99566d8da9d4aDc6bF19254072F32cc62A922bB
LIBRARY=e9E973B4c2D228d50311e696b0aedDEd80313F474a668E56c8Db31af0951a83c
PAIR_CONTRACT=9c2AA298dc8f7bc10A7E57d005ED0A4C97597c963368246C51671c0794A48707
PAIR_CONTRACT_PACKAGE=4ed480e4d592852b515DeBDF7Af1301106F18649a314260A66DC29db743BCb1E
FACTORY_CONTRACT=32046b7f8ca95d736e6f3fc0daa4ef636d21fc5f79cd08b5e6e4fb57df9238b9
FACTORY_CONTRACT_PACKAGE=d2cc3ac0c9c364ec0b8e969bd09eb151f9e1b57eecddb900e85abadf2332ebef
WCSPR=b761da7d5ef67f8825c30c40df8b72feca4724eb666dba556b0e3f67778143e0
LIBRARY=8818a55ed42deda94f42ecb6e9f92a0f0f03c21ddf639175bd6eb2a018b48ee6
PAIR_CONTRACT=cabce28fc7f7bb496c47ea56ae6ce62b17c7b9149afc3b3b32d863e5885070f6
PAIR_CONTRACT_PACKAGE=ee4bc7fae72edec25c5734827dff63e400a36b76ea67968962742401b926581d
CALLEE_CONTRACT=fbfeda8b97f056f526f20c2fc2b486d9bdbfb3e46b9a164527e57c0c86e68612
TOKEN0_CONTRACT=d540e0435C6Be6E7f359e132a99566d8da9d4aDc6bF19254072F32cc62A922bB
TOKEN0_CONTRACT_PACKAGE=aC1C3c25f46af1Eb60FE6A3E3349898ff75958e44B92F4312edf0FB8124133ec
TOKEN1_CONTRACT=45825eA26146D81EC58b7566B25757cD03B4e4F447Af1573E22EBeF38D93a6c1
TOKEN1_CONTRACT_PACKAGE=97c882aC4C66b6c645C88416546699A1AeF6fd4b162A324da3e6D9f503BAb87d
TOKEN0_CONTRACT=b761da7d5ef67f8825c30c40df8b72feca4724eb666dba556b0e3f67778143e0
TOKEN0_CONTRACT_PACKAGE=a4c27e29288ef154be20158f4049b4f150333d96070b3727e6f4ec9ef5d3f875
TOKEN1_CONTRACT=6ab4a5bf100fb9f444a12e92c663e3cf65a8c3ef4523cb2f80bed4fd41f85706
TOKEN1_CONTRACT_PACKAGE=82645cc07bc18ca1b3e165a021180a4de65e2f76f312162c1fe45588b835090b

WCSPR_CONTRACT=d540e0435C6Be6E7f359e132a99566d8da9d4aDc6bF19254072F32cc62A922bB
WCSPR_CONTRACT_PACKAGE=aC1C3c25f46af1Eb60FE6A3E3349898ff75958e44B92F4312edf0FB8124133ec
WCSPR_CONTRACT=b761da7d5ef67f8825c30c40df8b72feca4724eb666dba556b0e3f67778143e0
WCSPR_CONTRACT_PACKAGE=a4c27e29288ef154be20158f4049b4f150333d96070b3727e6f4ec9ef5d3f875

WISE_CONTRACT=bbe35d58c30e66e128f2AD83E4B2030441FDB5dA0227772ab7F277920F4482Ac
WISE_CONTRACT_PACKAGE=de46DA9475FD4ac3002A8eb74266589c65e48d0D55cC7cD0919b365B037D2Aa4
WISE_CONTRACT=1853ea67e80caaf81a8d96ff28ce3aaf105080f0299d9b7b7c0cb36064ee1fa9
WISE_CONTRACT_PACKAGE=fb5a4d8da9c112c68ffac693fece6ab3b3d1526ff97f491e398382a9fe9da6c8

USDC_CONTRACT=45825eA26146D81EC58b7566B25757cD03B4e4F447Af1573E22EBeF38D93a6c1
USDC_CONTRACT_PACKAGE=97c882aC4C66b6c645C88416546699A1AeF6fd4b162A324da3e6D9f503BAb87d
USDC_CONTRACT=6ab4a5bf100fb9f444a12e92c663e3cf65a8c3ef4523cb2f80bed4fd41f85706
USDC_CONTRACT_PACKAGE=82645cc07bc18ca1b3e165a021180a4de65e2f76f312162c1fe45588b835090b

WCSPR_WISE_CONTRACT=9c2AA298dc8f7bc10A7E57d005ED0A4C97597c963368246C51671c0794A48707
WCSPR_WISE_CONTRACT_PACKAGE=780490fe3dA633ed7b8A2A6f3dA04e4725F6Ef226eC9484Af1D7aB8e16a9B5de
WCSPR_WISE_CONTRACT=53a8121f219ad2c6420f007a2016ed320c519579112b81d505cb15715404b264
WCSPR_WISE_CONTRACT_PACKAGE=26526c30383e5c02d684ac68d7845e576a87166926f7500bdaa303cdab52aea7

WCSPR_USDC_CONTRACT=27982d94c019D7E51c43C5aA60b771f458DcEddC7CEFFcc6d120f62B7321a610
WCSPR_USDC_CONTRACT_PACKAGE=4ed480e4d592852b515DeBDF7Af1301106F18649a314260A66DC29db743BCb1E

DAI_CONTRACT=22b311471Fc4CeBA1b10204A4939A7772483C017CE74a1807f053D69F813714F
DAI_CONTRACT_PACKAGE=a05337e453FCeef5C75e8F85254B441Ec1BeC13AbEC9Cc9Ada0a7A2b9400Fb3f

USDT_CONTRACT=F8D63B789784e150018dEc41236BeaF018061AFa44AA85E4A6e3D3d7Eaa13B07
USDT_CONTRACT_PACKAGE=85A2a3144fD921732f90BC538a3457e04E329ea5Ac5976372cfC910f94D345bA

WCSPR_DAI_CONTRACT=F41eea03821F59de6a3d48161dA1ba267Fc4048B7d6761Cb18E80C5C68049388
WCSPR_DAI_CONTRACT_PACKAGE=f2Ae63407dea00ebD03cC7ff5DB5EC9f1e266f9C6A0e7890D6fC1940Cf5FD9c2

WCSPR_USDT_CONTRACT=d94b6EF6f2d47C7A054dfF699CB0B3A8294AE7221107aF837F9A78Fc3e795f72
WCSPR_USDT_CONTRACT_PACKAGE=7bf128904dD425CB9bCCD910A83dF6B7FAA565249f2CA77bFDFA06E8676bC940
WCSPR_USDC_CONTRACT=cabce28fc7f7bb496c47ea56ae6ce62b17c7b9149afc3b3b32d863e5885070f6
WCSPR_USDC_CONTRACT_PACKAGE=ee4bc7fae72edec25c5734827dff63e400a36b76ea67968962742401b926581d


GRAPHQL=https://casper-uniswap-v2-graphql.herokuapp.com/graphql
Expand All @@ -62,13 +50,13 @@ MASTER_KEY_PAIR_PATH=JsClients/ROUTER/keys/
ERC20_CONTRACT_NAME=erc20
ERC20_TOKEN_NAME=WISE
ERC20_TOKEN_SYMBOL=WISE
ERC20_DECIMALS=18
ERC20_DECIMALS=9
ERC20_TOTAL_SUPPLY=0

PAIR_CONTRACT_NAME=pair
PAIR_TOKEN_NAME=PAIR
PAIR_TOKEN_SYMBOL=pair
PAIR_DECIMALS=18
PAIR_DECIMALS=9
PAIR_TOTAL_SUPPLY=0

FACTORY_CONTRACT_NAME=Factory
Expand All @@ -78,7 +66,7 @@ FACTORY_INSTALL_PAYMENT_AMOUNT=150000000000
PAIR_INSTALL_PAYMENT_AMOUNT=300000000000

MINT_PAYMENT_AMOUNT=5000000000
MINT_AMOUNT=1000000
MINT_AMOUNT=1000000000000

BURN_PAYMENT_AMOUNT=5000000000
BURN_AMOUNT=5
Expand Down Expand Up @@ -113,8 +101,8 @@ TOKEN_SYMBOL=DRAG
TOKEN_META=origin fire,lifetime infinite
CONTRACT_NAME=UniSwapRouter

CONTRACT_HASH=7BF6CabE546d56998Dd69A4A31E1ED10F01114E2D3a2064d9441275f68b68164
PACKAGE_HASH=67EFaF1aBf4e1786dC4510fE03bec0a4c5E47bdE0Dd0b12fC0A3EE3fa5e77Ce5
CONTRACT_HASH=9ead9647794274c32a54c40ef51e80b5be856851ea039a6f07a165806d240999
PACKAGE_HASH=8a74e1ae230936013f3b544182b8011435f4a457d9444fa879ab483fdf829dc8
INSTALL_PAYMENT_AMOUNT=200000000000
MINT_ONE_PAYMENT_AMOUNT=2000000000
MINT_COPIES_PAYMENT_AMOUNT=100000000000
Expand All @@ -125,16 +113,16 @@ MINT_COPIES_COUNT=20
MINT_MANY_META_SIZE=5
MINT_MANY_META_COUNT=5

TO = d540e0435C6Be6E7f359e132a99566d8da9d4aDc6bF19254072F32cc62A922bB
TO = 8b217a09296d5ce360847a7d20f623476157c5f022333c4e988a464035cadd80
DEADLINE = 1739598100811
# add_liquidity

TOKEN_A = d540e0435C6Be6E7f359e132a99566d8da9d4aDc6bF19254072F32cc62A922bB
TOKEN_B = 45825eA26146D81EC58b7566B25757cD03B4e4F447Af1573E22EBeF38D93a6c1
AMOUNT_A_DESIRED = 8000
AMOUNT_B_DESIRED = 1000
AMOUNT_A_MIN = 250
AMOUNT_B_MIN = 300
TOKEN_A = b761da7d5ef67f8825c30c40df8b72feca4724eb666dba556b0e3f67778143e0
TOKEN_B = 6ab4a5bf100fb9f444a12e92c663e3cf65a8c3ef4523cb2f80bed4fd41f85706
AMOUNT_A_DESIRED = 8000000000
AMOUNT_B_DESIRED = 1000000000
AMOUNT_A_MIN = 100000
AMOUNT_B_MIN = 100000

# add_liquidity_cspr
TOKEN = 301167268ec00eeb7edf7d12d9419921e15dbd7b145e454d94540aa91c260edb
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-----
MCowBQYDK2VwAyEAdAHEIxfo63Vd7xAcHgX7hvJEKHPG00EjSlKZwlwSqW4=
MCowBQYDK2VwAyEAWltK4eH/EP1hDH1jI9PDMUOKge73vNOqR4P28mT6OqQ=
-----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 @@
017401c42317e8eb755def101c1e05fb86f2442873c6d341234a5299c25c12a96e
015a5b4ae1e1ff10fd610c7d6323d3c331438a81eef7bcd3aa4783f6f264fa3aa4
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-----
MC4CAQAwBQYDK2VwBCIEILBFlQdHrxhOISa01o5a4Z7JF+/FtroCwFIQAA9XjOgP
MC4CAQAwBQYDK2VwBCIEIPoXHj1Ln9iB/pbHoB1DGVc0f11S422kDfAH5XD67EUa
-----END PRIVATE KEY-----
26 changes: 13 additions & 13 deletions JsClients/ERC20/test/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ const test = async () => {
EVENT_STREAM_ADDRESS!
);

const installDeployHash = await erc20.install(
KEYS,
ERC20_TOKEN_NAME!,
ERC20_TOKEN_SYMBOL!,
ERC20_DECIMALS!,
ERC20_TOTAL_SUPPLY!,
ERC20_CONTRACT_NAME!,
ERC20_INSTALL_PAYMENT_AMOUNT!,
ERC20_WASM_PATH!
);
// const installDeployHash = await erc20.install(
// KEYS,
// ERC20_TOKEN_NAME!,
// ERC20_TOKEN_SYMBOL!,
// ERC20_DECIMALS!,
// ERC20_TOTAL_SUPPLY!,
// ERC20_CONTRACT_NAME!,
// ERC20_INSTALL_PAYMENT_AMOUNT!,
// ERC20_WASM_PATH!
// );

console.log(`... Contract installation deployHash: ${installDeployHash}`);
// console.log(`... Contract installation deployHash: ${installDeployHash}`);

await getDeploy(NODE_ADDRESS!, installDeployHash);
// await getDeploy(NODE_ADDRESS!, installDeployHash);

console.log(`... Contract installed successfully.`);
// console.log(`... Contract installed successfully.`);

let accountInfo = await utils.getAccountInfo(NODE_ADDRESS!, KEYS.publicKey);

Expand Down
2 changes: 1 addition & 1 deletion JsClients/ERC20/test/installed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const erc20 = new ERC20Client(
const test = async () => {

await erc20.setContractHash(TOKEN1_CONTRACT!);

//getTotalSupply(TOKEN1_CONTRACT!);
// // //name
// // const name = await erc20.name();
// // console.log(`... Contract name: ${name}`);
Expand Down
Binary file modified JsClients/ERC20/wasm/erc20-token.wasm
Binary file not shown.
22 changes: 11 additions & 11 deletions JsClients/FACTORY/test/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ const test = async () => {
EVENT_STREAM_ADDRESS!
);

const installDeployHash = await factory.install(
KEYS,
FACTORY_CONTRACT_NAME!,
KEYS.publicKey!,
// KEYS.publicKey,
FACTORY_INSTALL_PAYMENT_AMOUNT!,
FACTORY_WASM_PATH!
);
// const installDeployHash = await factory.install(
// KEYS,
// FACTORY_CONTRACT_NAME!,
// KEYS.publicKey!,
// // KEYS.publicKey,
// FACTORY_INSTALL_PAYMENT_AMOUNT!,
// FACTORY_WASM_PATH!
// );

console.log(`... Contract installation deployHash: ${installDeployHash}`);
// console.log(`... Contract installation deployHash: ${installDeployHash}`);

await getDeploy(NODE_ADDRESS!, installDeployHash);
// await getDeploy(NODE_ADDRESS!, installDeployHash);

console.log(`... Contract installed successfully.`);
// console.log(`... Contract installed successfully.`);

let accountInfo = await utils.getAccountInfo(NODE_ADDRESS!, KEYS.publicKey);

Expand Down
Binary file modified JsClients/FACTORY/wasm/factory.wasm
Binary file not shown.
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-----
MCowBQYDK2VwAyEAz4Em841i4YEWHO1DKdEks1sqMz6Q0qUSWbUVQMqXCdU=
MCowBQYDK2VwAyEA+do3V4WYtns0Fo1Pf515rpcb13KxTZ2CqE0fO2EwLI0=
-----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 @@
01cf8126f38d62e181161ced4329d124b35b2a333e90d2a51259b51540ca9709d5
01f9da37578598b67b34168d4f7f9d79ae971bd772b14d9d82a84d1f3b61302c8d
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-----
MC4CAQAwBQYDK2VwBCIEIOWIxnHwe+sv0SCiB2UB8EMclilV5mOBlEUxEJ0MVhE/
MC4CAQAwBQYDK2VwBCIEIFRzYRkz4v3gXo9Y6NyX4tfnwCXMpPxcC5NY7hcIlih/
-----END PRIVATE KEY-----
2 changes: 1 addition & 1 deletion JsClients/PAIR/test/installed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const test = async () => {

// We don't need hash- prefix so i'm removing it
//await pair.setContractHash(contractHash.slice(5));
await pair.setContractHash(PAIR_CONTRACT!);
await pair.setContractHash("53a8121f219ad2c6420f007a2016ed320c519579112b81d505cb15715404b264");
console.log("... Contract Hash:", PAIR_CONTRACT!);
//name
const liquidity = await pair.liquidity();
Expand Down
Binary file modified JsClients/PAIR/wasm/pair-token.wasm
Binary file not shown.
13 changes: 5 additions & 8 deletions JsClients/ROUTER/src/uniswap-router-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,20 +474,17 @@ class UniswapRouterClient {
paymentAmount: string
) {
console.log("Path : ", path);


// MAPPED THIS ACCORDING TO UTIL createRecipientAddress function
let _paths: CLKey[] = [];
for (let i = 0; i < path.length; i++) {
const p = new CLByteArray(Uint8Array.from(Buffer.from(path[i], "hex")));
_paths.push(utils.createRecipientAddress(p));
}

const tokena = new CLByteArray(Uint8Array.from(Buffer.from(path[0], "hex")));
const tokenb = new CLByteArray(Uint8Array.from(Buffer.from(path[1], "hex")));
const _to = CLPublicKey.fromHex(to);

const runtimeArgs = RuntimeArgs.fromMap({
amount_in: CLValueBuilder.u256(amount_in),
amount_out_min: CLValueBuilder.u256(amount_out_min),
path: new CLList(_paths),
token_a:utils.createRecipientAddress(tokena),
token_b:utils.createRecipientAddress(tokenb),
to: utils.createRecipientAddress(_to),
deadline: CLValueBuilder.u256(deadline),
});
Expand Down
40 changes: 20 additions & 20 deletions JsClients/ROUTER/test/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,26 @@ const test = async () => {
EVENT_STREAM_ADDRESS!
);

const installDeployHash = await uniswapRouter.install(
KEYS,
FACTORY_CONTRACT!,
WCSPR!,
LIBRARY!,
'UniSwapRouter',
INSTALL_PAYMENT_AMOUNT!,
WASM_PATH!
);

console.log("Passed Parameters: \nfactory: \t", FACTORY_CONTRACT,
"\nwcspr: \t", WCSPR,
"\nlibrary: \t", LIBRARY,
"\ncontract_name: \t", CONTRACT_NAME, "\n");

console.log(`... Contract installation deployHash: ${installDeployHash}\n`);

await getDeploy(NODE_ADDRESS!, installDeployHash);

console.log(`... Contract installed successfully.`);
// const installDeployHash = await uniswapRouter.install(
// KEYS,
// FACTORY_CONTRACT!,
// WCSPR!,
// LIBRARY!,
// 'UniSwapRouter',
// INSTALL_PAYMENT_AMOUNT!,
// WASM_PATH!
// );

// console.log("Passed Parameters: \nfactory: \t", FACTORY_CONTRACT,
// "\nwcspr: \t", WCSPR,
// "\nlibrary: \t", LIBRARY,
// "\ncontract_name: \t", CONTRACT_NAME, "\n");

// console.log(`... Contract installation deployHash: ${installDeployHash}\n`);

// await getDeploy(NODE_ADDRESS!, installDeployHash);

// console.log(`... Contract installed successfully.`);


let accountInfo = await utils.getAccountInfo(NODE_ADDRESS!, KEYS.publicKey);
Expand Down
4 changes: 2 additions & 2 deletions JsClients/ROUTER/test/installed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,13 @@ const test = async () => {
await uniswapRouter.setContractHash(CONTRACT_HASH!);

// Test add_liquidity
//await add_liquidity(uniswapRouter);
await add_liquidity(uniswapRouter);

// Test add_liquidity_cspr
//add_liquidity_cspr(uniswapRouter);

// Test remove_liquidity
remove_liquidity(uniswapRouter);
// remove_liquidity(uniswapRouter);

// Test remove_liquidity_cspr
//remove_liquidity_cspr(uniswapRouter);
Expand Down
Binary file modified JsClients/ROUTER/wasm/uniswap-v2-router.wasm
Binary file not shown.
Loading

0 comments on commit 379f38b

Please sign in to comment.