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

Commit

Permalink
router wasm changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammad-Mubeen committed Feb 2, 2022
1 parent d1892f0 commit 87fb140
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ TOKEN_SYMBOL=DRAG
TOKEN_META=origin fire,lifetime infinite
CONTRACT_NAME=UniSwapRouter

CONTRACT_HASH=9ead9647794274c32a54c40ef51e80b5be856851ea039a6f07a165806d240999
PACKAGE_HASH=8a74e1ae230936013f3b544182b8011435f4a457d9444fa879ab483fdf829dc8
CONTRACT_HASH=d94bf4c60244f127821ff12fe1f56299215d7056be3739e6c42c917768540a93
PACKAGE_HASH=3de805e07efbc2cd9c5d323ab4fe5f2f0c1c5da33aec527d73de34a1fc9d3735
INSTALL_PAYMENT_AMOUNT=200000000000
MINT_ONE_PAYMENT_AMOUNT=2000000000
MINT_COPIES_PAYMENT_AMOUNT=100000000000
Expand Down
7 changes: 3 additions & 4 deletions JsClients/PAIR/src/pair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,25 +260,24 @@ class PAIRClient {
const _spender = new CLByteArray(
Uint8Array.from(Buffer.from(spender, "hex"))
);

const keyOwner=new CLKey(new CLAccountHash(Uint8Array.from(Buffer.from(owner, "hex"))));
const keySpender = createRecipientAddress(_spender);
const finalBytes = concat([CLValueParsers.toBytes(keyOwner).unwrap(), CLValueParsers.toBytes(keySpender).unwrap()]);
const blaked = blake.blake2b(finalBytes, undefined, 32);
const encodedBytes = Buffer.from(blaked).toString("hex");

const result = await utils.contractDictionaryGetter(
this.nodeAddress,
encodedBytes,
this.namedKeys.allowances
);

const maybeValue = result.value().unwrap();
return maybeValue.value().toString();
} catch (error) {
return "0";
}

}


Expand Down
1 change: 0 additions & 1 deletion JsClients/PAIR/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export const contractDictionaryGetter = async (
seedUref
);

console.log(" storedValue: ", storedValue);
if (storedValue && storedValue.CLValue instanceof CLValue) {
return storedValue.CLValue!;
} else {
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
Binary file modified JsClients/ROUTER/wasm/uniswap-v2-router.wasm
Binary file not shown.

0 comments on commit 87fb140

Please sign in to comment.