0

So I am getting this: Error: resolver or addr is not configured for ENS name (argument="name", value="", code=INVALID_ARGUMENT, version=contracts/5.7.0)

I know everything's well configured, I triple checked, the contract's has been deployed on Goerli testnet, however, what am I missing? Help appreciated. Here is my react app:

import React, {useState, useEffect} from 'react';
import { ethers } from "ethers";

const contractAddress = "0x4193f089C9e41135329c989a0899B60B101C3994"
const USDCAddress = "0x07865c6E87B9F70255377e024ace6630C1Eaa37F"

const ERC20ABI = ["function balanceOf(address _owner) public view returns (uint256 balance)"]

const ABI = [
  "function safeTransfer(IERC20 _token, address _seller, uint256 _amount) external payable",
  "event Transfer(address buyerAddress, address sellerAddress, uint depositAmount, uint256 counter)"
];

function App() {

const [amount, setDepositValue] = useState('')
const [_seller, setSellerAddress] = useState('')

const provider = new ethers.providers.Web3Provider(window.ethereum)
const signer = provider.getSigner()

const contract = new ethers.Contract(contractAddress, ABI, signer);

async function isConnected() {
  const accounts = await window.ethereum.request({method: 'eth_accounts'});       
  if (accounts.length) {
     console.log(`You're connected to: ${accounts[0]}`);
  } else {
     console.log("Metamask is not connected");
  }
}

useEffect(() => {
  async function connectWallet() {
  await provider.send("eth_requestAccounts", []);
  }
  connectWallet()
    .catch(console.error)
  isConnected()
})


function handleDepositChange(e) {
  setDepositValue(e.target.value);
}

function handleAddressChange(e) {
  setSellerAddress(e.target.value);
}
const providerContract = new ethers.Contract(contractAddress, ABI, provider);

const depositMade = async () => {

  provider.once("block", () => {
  providerContract.on("Transfer", (buyerAddress, sellerAddress, depositAmount, counter, event) => {

  console.log(
  "Buyer address: "+buyerAddress,
  "Seller address: "+sellerAddress,
  "Escrow amount: "+JSON.stringify(depositAmount.toString()),
  "Escrow ID: "+counter, 
  "Transaction hash: "+event.transactionHash)
})
})
}


function blockchainTalk(e) {
  e.preventDefault();

  if (contract.safeTransfer(USDCAddress, _seller, amount)) {
  depositMade();
}
  
}
return (
          <div className="col">
            <form onSubmit={blockchainTalk}>
              <div className="mb-3">
                <input type="number" className="form-control" placeholder="Value to deposit" step="any" defaultValue={101} onChange={handleDepositChange} />
              </div>
              <div className="mb-3">
                <input type="text" className="form-control" placeholder="Seller address" defaultValue={"0xF025B4AC25D5DC1FfD77B099a31ddc269D55c039"} onChange={handleAddressChange} />
              </div>
              <button type="submit" className="btn btn-primary">Transfer</button>
)
}

And this is my smart contract function:


  function safeTransfer(IERC20 _token, address _seller, uint256 _amount) external payable {
    //need to be checked against re-entrancy attack

    require(_amount > 100, "Escrow value must be above 100 USDC.");

    require(address(_token) == 0x07865c6E87B9F70255377e024ace6630C1Eaa37F, 
    "You can only transfer USDC to the escrow");

    require(token.balanceOf(_seller) >= _amount, 
    "You should have at least the same amount of USDC in your wallet as the amount you want to escrow.");

    Deposit storage _deposit = ids[counter];

    counter++; 

    _deposit.buyer = msg.sender;
    
    _deposit.seller = _seller; 

    token = _token;

    emit Transfer(msg.sender, _seller, _amount, counter);
}                   

Please help me figure this out, am I silly or what?

1 Answer 1

0

Reviewning it, safeTransfer()shouldn't be payble.

1
  • It returns nothing because you put in /token/ instead of /address/, try this: goerli.etherscan.io/address/… Also I did post the human readable ABI of the contract function in the OP: const ABI = [ "function safeTransfer(IERC20 _token, address _seller, uint256 _amount) external payable", "event Transfer(address buyerAddress, address sellerAddress, uint depositAmount, uint256 counter)" ];
    – sunsakis
    Jan 16 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.