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

Commit 7aaf5d7

Browse files
committed
allowanceagainstownerandspenderpaircontract updated
1 parent f42ffb6 commit 7aaf5d7

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

JsClients/ERC20/src/erc20.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ class ERC20Client {
369369
// amount: CLValueBuilder.u256(amount)
370370
// });
371371

372-
373372
// const deployHash = await contractCall({
374373
// chainName: this.chainName,
375374
// contractHash: this.contractHash,

JsClients/ERC20/test/installed.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const erc20 = new ERC20Client(
7070

7171
const test = async () => {
7272

73-
await erc20.setContractHash(TOKEN1_CONTRACT!);
73+
await erc20.setContractHash(TOKEN0_CONTRACT!);
7474
//getTotalSupply(TOKEN1_CONTRACT!);
7575
// // //name
7676
// // const name = await erc20.name();
@@ -133,16 +133,16 @@ const test = async () => {
133133
// // console.log(`... Total supply: ${totalSupply}`);
134134

135135
//approve
136-
const approveDeployHash = await erc20.approve(
137-
ROUTERKEYS,
138-
PACKAGE_HASH!,
139-
AMOUNT_B_DESIRED!,
140-
APPROVE_PAYMENT_AMOUNT!
141-
);
142-
console.log("... Approve deploy hash: ", approveDeployHash);
143-
144-
await getDeploy(NODE_ADDRESS!, approveDeployHash);
145-
console.log("... Token approved successfully");
136+
// const approveDeployHash = await erc20.approve(
137+
// ROUTERKEYS,
138+
// PACKAGE_HASH!,
139+
// AMOUNT_B_DESIRED!,
140+
// APPROVE_PAYMENT_AMOUNT!
141+
// );
142+
// console.log("... Approve deploy hash: ", approveDeployHash);
143+
144+
// await getDeploy(NODE_ADDRESS!, approveDeployHash);
145+
// console.log("... Token approved successfully");
146146

147147
// // //transfer
148148
// // const transferDeployHash = await erc20.transfer(

routes/pairroutes.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,17 @@ router
7070
message: "spender not found in request body",
7171
});
7272
}
73-
73+
let data = await AllcontractsData.findOne({
74+
packageHash: req.body.contractHash,
75+
});
76+
if (data == null) {
77+
return res.status(400).json({
78+
success: false,
79+
message: "pair not found against this package hash ",
80+
});
81+
}
7482
let allowance = await pair.allowance(
75-
req.body.contractHash,
83+
data.contractHash,
7684
req.body.owner,
7785
req.body.spender
7886
);

0 commit comments

Comments
 (0)