current position:Home>Uniswap docking ethtokenswapinput displays false transaction mined but execution failed
Uniswap docking ethtokenswapinput displays false transaction mined but execution failed
2022-02-03 22:48:34 【Q & A of Denglian community】
Writing the same sol file , It has been imported uniswapfactroy and uniswapexchange Interface file of , Next, create a new one util File complete ethToTokenSwapInput, The code is as follows
contract UniswapUtils { // ropsten testnet address public constant UNISWAP_FACTORY_ADDRESS = 0x9c83dCE8CA20E9aAF9D3efc003b2ea62aBC08351; // DAI address address public constant DAI_ADDRESS = 0xaD6D458402F60fD3Bd25163575031ACDce07538D;function getUniswapExchange(address _tokenAddress) public view returns (address) { return IUniswapFactory(UNISWAP_FACTORY_ADDRESS).getExchange(_tokenAddress); }/** * @dev ETH=>DAI * @param _ethAmount amount of ETH sold * @return Amount of DAI bought */ function ethToDai(uint256 _ethAmount) public returns (uint256) { return ethToDai(_ethAmount, uint256(1)); } /** * @dev ETH=>DAI * @param _ethAmount amount of ETH sold * @param _minTokenAmount minimum DAI bought * @return Amount of DAI bought */ function ethToDai(uint256 _ethAmount, uint256 _minTokenAmount) public returns (uint256) { IUniswapExchange uniswapExchange=IUniswapExchange(getUniswapExchange(DAI_ADDRESS)); return uniswapExchange.ethToTokenSwapInput.value(_ethAmount)(_minTokenAmount, uint256(now + 60)); }}
stay remix Up test ethtoDai(), Display error , The reasons for the error are as follows :https://ropsten.etherscan.io/tx/0xe2d3af02a85a1135c88d33d4f94e98dcf1825fa9ffb6b48388d3d970ab380051
Take the answer 1:
msg.value Not for 0
Other answers 1:
copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032248328801.html
The sidebar is recommended
- May I ask, similar to the tendermint, hotstuff and pbft consensus, do they store the verification signature of each verifier on the block, and how? If stored in blocks, the received signatures may not be the same, resulting in inconsistent blocks
- What is the difference between transaction cost and execution cost consumed by gas in Remix?
- Geth deployment contract problem
- How do Ethereum -web3 and golang interact
- Error connecting orderer when fabric SDK go creates channel
- Please ask a question about voting to switch accounts
- Fabric SDK go instantiation chain code connection 7053 port waiting timeout
- What should I do if I transfer the currency to the contract address? I read it wrong
- How can DAPP be deployed on the server and accessed by others?
- How to solve the problem that a large amount of information is stored on the chain in the form of structure plus mapping, resulting in the phenomenon that the stack is too deep to compile?
guess what you like
-
There are still some questions about the specific interaction with the web app after the contract is written. I hope to see a complete demonstration.
-
If the two cryptocurrencies use the same algorithm, can they dig both currencies at the same time with their own computing power?
-
Has anyone sorted out the interview questions related to blockchain technology? thank
-
After the private chain is restarted, the Ethernet balance of the account is cleared
-
"Metamask RPC error with payload" occurs after deployment to the ropsten test chain, resulting in contract interaction failure
-
The account created by the Chain Wallet cannot be queried in the private chain built by geth
-
Solid contract execution
-
Centralized exchange recharge entry monitoring
-
Can Ethereum change addresses for each transaction
-
How to convert byte [] array into string array in solidity?
Random recommended
- How to write a smart contract for access control IOT devices?
- Blockchain in big data sharing
- There is no response after entering the following JS document of truss exec in the truss console, but manual input in the truss can be submitted successfully
- What should be the format of the input parameters when calling this function?
- Get all currencies held by erc20 address
- eosio. cdt1. 7. The smart contract cannot be compiled
- Ethereum develops DAPP's learning
- Analysis of eth transaction record input
- Sensor related smart contract
- Error: returned values are't valid, did it run out of gas?
- How to introduce the hash library keccak? I installed it according to NPM install keccak -- save, but the execution code will report an error
- Ethereum releases token and uploads contract code to Etherscan
- Transfer of Ethereum private chain
- seek help
- web3. JS send transaction
- solidity0. 5 how to convert string to uint
- According to teacher Xiong's video, on Web3 How to put JS into atom
- I want to ask if there is a problem with this tutorial
- Why is this displayed after I deploy Ethernet
- I don't know what to do when I encounter a problem
- Metamask external connection problem
- Mobile terminal (mobile phone) Wallet
- Mobile Wallet
- Failed to create a project with truss init, showing unbox failed
- Invalid JSON RPC response
- Development of Ethereum web Wallet
- Deployment of Ethereum Wallet
- The login jump cannot be realized during DAPP development
- Compilation of geth failed
- Chain Wallet
- Metamask transfer problem
- Server directory configuration
- Using Web3's methods myMethod. The send method cannot change the data in the smart contract
- PHP obtains the Ethereum keystore private key. The password is always wrong. There is a problem with the algorithm
- About blockchain soft bifurcation
- truffle unbox RequestError
- Error entering truss control
- DAPP deployment issues
- Metamask transfer error
- How to start gananche through websocket