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

Commit

Permalink
allowanceagainstownerandspenderpaircontract updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammad-Mubeen committed Apr 14, 2022
1 parent f42ffb6 commit 7aaf5d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
1 change: 0 additions & 1 deletion JsClients/ERC20/src/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ class ERC20Client {
// amount: CLValueBuilder.u256(amount)
// });


// const deployHash = await contractCall({
// chainName: this.chainName,
// contractHash: this.contractHash,
Expand Down
22 changes: 11 additions & 11 deletions 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!);
await erc20.setContractHash(TOKEN0_CONTRACT!);
//getTotalSupply(TOKEN1_CONTRACT!);
// // //name
// // const name = await erc20.name();
Expand Down Expand Up @@ -133,16 +133,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);

await getDeploy(NODE_ADDRESS!, approveDeployHash);
console.log("... Token approved successfully");
// 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");

// // //transfer
// // const transferDeployHash = await erc20.transfer(
Expand Down
12 changes: 10 additions & 2 deletions routes/pairroutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,17 @@ router
message: "spender not found in request body",
});
}

let data = await AllcontractsData.findOne({
packageHash: req.body.contractHash,
});
if (data == null) {
return res.status(400).json({
success: false,
message: "pair not found against this package hash ",
});
}
let allowance = await pair.allowance(
req.body.contractHash,
data.contractHash,
req.body.owner,
req.body.spender
);
Expand Down

0 comments on commit 7aaf5d7

Please sign in to comment.