Hello,
This is my first post on OpenZeppelin, but I've been following the forum for a while, and have gotten a lot of useful information from it, so thank you to all of the contributors reading this.
My question pertains to how exchanges interact with ERC-20 contracts - both centralized and decentralized exchanges. Though I've noted some circumstantial evidence that exchanges use the approve and transferFrom functions of a token, I'd like to gain an in-depth understanding of the process.
So, let's take the simplest token possible, one built using the openezeppelin ERC20 contract:
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor() ERC20("MyToken", "MTK") {}
}
here are two scenarios:
Scenario A. Coinbase litsts MTK. Alice wants to buy some MTK from Coinbase. So Alice goes on Coinbase, and pays some fiat money for tokens. She then transfers the tokens into her personal wallet.
Scenario B. An MTK-ETH liquidity pool is set up on Uniswap. Bob acquires some MTK from that liquidity pool, and stores it in his wallet.
So how do Coinbase and Uniswap actually interact with the MTK contract? Do they somehow use the approve and transferFrom functions, or do they use the transfer function?
I am building a token with some unique features, and this info would help in my development process.
Feel free to ask for clarification if needed.
Thank you