This might be a basic question, but I was walking through how to interact with the DAI (an ERC20 token) smart contract in Web3.js which led to this:
const daiTokenAddress = "0x6b175474e89094c44da98b954eedeac495271d0f"; // Replace DAI Address Here (can be the actual smart contract) const daiTokenMock = new web3.eth.Contract(DaiTokenMock.abi, daiTokenAddress);
But then I switched the daiTokenAddress with the smart contract of the USDC token (a different ERC20 token) and grabbed that contract instead and it works fine.
So my question is, can I switch the contract address in the above function to any smart contract? And then what's the point of passing in an ABI?