Hot answers tagged

2

It is not possible, there isn't a centralized registry for token names or symbols.


1

If the contract owns some of its tokens, then it can do whatever it wants with them. If the contract never uses those tokens (i.e. there is no code in the contract for this), and doesn't have any upgrade mechanism, then the tokens are effectively burnt.


1

You should use Uniswap in your contract, it's the most popular decentralized exchange, and you can view their documentation https://uniswap.org/


1

Is there a way to provide liquidity to Uniswap-like contracts without initial funds on one side of the trade? No. Because by definition, this would not be liquidity. For example, if I create my own token called Token, I believe this token should be worth one dollar each. have one thousand tokens, but I don't have one thousand dollars. You cannot do such ...


1

I have two suggestions You can optimize your code to make it work more efficiently, here are some tips. You can enable the solidity optimizer, see more about it here.


1

You can always get the contract code from the Ethereum blockchain for any ERC20 token by using etherscan.io. Just pass the contract address. For WETH, the Mainnet contract address is 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2. To see the contract, go to https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#code.


1

You'll first have to await contract.callThatReturnsTheStruct and then access the desired property. This does answer a 3 and a half year old question. With solc > 0.8.0 you can do something like this: (await contract.mappingAttribute(key)).structAttribute to get the attribute of a struct that is in a mapping


Only top voted, non community-wiki answers of a minimum length are eligible