minor updates

This commit is contained in:
Shriya Tyagi 2022-06-07 15:04:42 +05:30
parent 86e2058b48
commit 1d51933806
2 changed files with 10 additions and 6 deletions

View File

@ -11,7 +11,7 @@ import { Basic } from "../../common/basic.sol";
import { TokenInterface } from "../../common/interfaces.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./events.sol";
import "hardhat/console.sol";
abstract contract SocketConnector is Basic {
struct BridgeParams {
@ -43,9 +43,12 @@ abstract contract SocketConnector is Basic {
? _tokenContract.balanceOf(address(this))
: _params.amount;
_tokenContract.approve(_params.to, _params.amount);
console.log("address this balance: ", _tokenContract.balanceOf(address(this)));
console.log("_params.allowanceTarget: ", _params.allowanceTarget);
console.log("_params.amount: ", _params.amount);
_tokenContract.approve(_params.allowanceTarget, _params.amount);
(bool success, ) = _params.to.call(_params.txData);
console.log("success: ", success);
require(success);
}

View File

@ -187,13 +187,13 @@ describe("Socket Connector", function () {
const quote = await getQuote(fromChainId, DAI_ADDR_ETH, toChainId, DAI_ADDR_POLYGON, "10000000000000000000", dsaWallet0.address, recipient, "true");
console.log("quote: ", quote)
const route = quote.result.routes[0];
console.log("route: ", route[0])
console.log("route: ", quote.result.routes[0])
const apiReturnData = await getRouteTransactionData(route);
console.log("build-tx: ", apiReturnData)
const { allowanceTarget, minimumApprovalAmount } = apiReturnData.result.approvalData;
const dsa_signer = await ethers.getSigner(dsaWallet0.address)
const _params: any = [recipient, apiReturnData.result?.txData, DAI_ADDR_ETH, allowanceTarget, "10000000000000000000"];
const _params: any = [apiReturnData.result.txTarget, apiReturnData.result?.txData, DAI_ADDR_ETH, allowanceTarget, "10000000000000000000"];
const spells = [
{
@ -209,8 +209,9 @@ describe("Socket Connector", function () {
if (allowanceTarget !== null) {
const allowanceCheckStatus = await checkAllowance(fromChainId, dsaWallet0.address, allowanceTarget, DAI_ADDR_ETH)
console.log("allowanceCheckStatus: ", allowanceCheckStatus);
const allowanceValue = allowanceCheckStatus.result?.value;
console.log("allowanceValue: ", allowanceValue);
// console.log("allowanceValue: ", allowanceValue);
if (minimumApprovalAmount > allowanceValue) {
const approvalTransactionData = await getApprovalTransactionData(fromChainId, dsaWallet0.address, allowanceTarget, DAI_ADDR_ETH, minimumApprovalAmount);