How can I send test BAT or AAVE or any other token to myself?
As far as I'm aware, there are no "official" BAT or AAVE token contract on the testnets. By official, I mean - supported by the original token authors or their team.
So you can do what some people before you did as well. Copy-paste the BAT token source code, and deploy it on the testnet. Only in this case, you modify the constructor or other functions to mint the tokens to your address, or to give you some kind of authorization (owner
for example).
Or you can write and deploy a custom token contract. Either from scratch - or by extending the OpenZeppelin ERC-20.sol opensource implementation, you just call their constructor with your values.
pragma solidity ^0.8;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
contract MyToken is ERC20, Ownable {
// sets the token metadata such as name and symbol, also sets the `owner` to `msg.sender`
constructor() ERC20("MyToken", "MyT") {}
// effectively mints the `_amount` of new tokens to the `owner`
function mint(uint256 _amount) external onlyOwner {
_mint(msg.sender, _amount);
}
}
Can I reuse the same generated Eth address for all ETH Tokens?
The token balance of an address is stored on each token contract - not on the address alone. So there's no capacity limit of how many tokens can an address own, if that's your concern.
For some people it might be important to use separate address for each token for privacy reasons. If you separate the tokens that you own to multiple addresses, it's much harder to estimate how much you (as a person) own in total.
Another reason that some people use is redundancy. If you lose access to one of your addresses, you still have multiple others with balance.