People who code: we want your input. Take the Survey
1

In the case where the calls are inside a solidity function function foo() public { uint256 amountx = 100 tokenOneContract(tokenOneAddress).transfer(address(this), to, amountx) tokenTwoContract(tokenTwoAddress).transfer(to, address(this), amountx); } Then either both functions will succeed or if any of them fails the whole transaction will revert....


1

address(x) converts x to an hexadecimal address. The value in here is obviously not a address. When you try to convert 11114889284228470791650712165908704041153102605 to hexadecimal, you will see that it corresponds to this address 0xc2b0e326e80c39891fD501d645cA1B8c5d58830d, which looks like an address. Edit: Also this approach is not very great. Instead, ...


1

The concept of whitelisting is something that is custom-built. Yes, there exist some templates for the functionality, but in the end it simply depends on how you implement it. If you add whitelisting to token transfers, then the token can't be transferred unless you are in the whitelist. The tokens don't disappear anywhere, they appear in the user's wallet ...


1

Unfortunately, there is no way to recover the funds from a smart contract if there isn't any function to do so. The only way to recover the funds is to contact the token creator. Tether (USDT) for example, would help you recover funds stuck in a contract. Not all tokens have such support though. All the best


1

Two things you can do change _safeMint behavior Override _safeMint and call its parrent contract MyToken is ERC721 { function _safeMint(address to, uint256 tokenId, bytes memory _data) internal override { /* Can do something here and modify input parameters */ super._safeMint(to, tokenId, _data); /* Can do something else here */ ...


1

Starting from solidity 0.8.0 you can return a struct directly. Here is a simple example contract: pragma solidity ^0.8.0; contract Example { struct Store { string id; uint time; } mapping (address => Store) public purchases; function set(string memory _id, uint _time) public returns(bool) { ...


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