New answers tagged

0

If you are running the smart comtract in truffle, you will have a migrations file and a config file. The config file will have different networks that you configure. In the 2nd migrations file that you create yourself, you can log the current network being used. Something like this module.exports=function(deployer,network){ console.log(network); deployer....


1

Yes, you can check the Tuffle Box for that.


2

You can use the CHAINID opcode to get the current chain ID. AFAIK, Solidity does not have a built-in function for this, but you can use inline assembly to get the chain ID in a Solidity contract, e.g.: function getChainId() private view returns (uint256 chainId) { assembly { chainId := chainid() } } Then you can check if the chain ID is 1 for ...


0

Meanwhile I figured out the issue thanks to this blog post: https://forum.openzeppelin.com/t/truffle-tests-not-being-run-against-contract-deployed-to-ganache-instead-uses-another-contract-address/4402/15 Summary Truffle test always deploys a new contract to ensure tests run on a clean contract (however I couldn't make it visible in Ganache UI) Adding ...


0

The problem was because when using UniswapV2Factory, only the precompiled UniswapV2Factory contract in the build directories from @uniswap should be deployed as stated in docs https://uniswap.org/docs/v2/smart-contract-integration/quick-start/. So, even if I commented out something on my UniswapV2Pair contract, it had no effect, because UniswapV2Factory uses ...


0

It might be the case, that someone has manually configured truffle migrations directory in truffle.config.js file and now truffle is not able to detect the migrations directory properly: module.exports = { ... migrations_directory: "truffle-migraitons/", ... }


1

There are a number of things you need to change: Your pragma statement needs a space in it between the versions. Change it to pragma solidity >=0.4.21 <0.6.0; The OpenZeppelin contracts you are importing require Solidity 0.8.0 or greater. You will need to change your pragma statement to reflect this You have a closing bracket on line 13 after the ...


0

First of all, you need to specify the chainId that ganache uses. By default ganache uses 1337 for dev purposes, which is not recognised by Uniswap. Change the chainId to 1 (eth mainnet) (see here for a list of chainIds) E.g. if you're using ganache-cli, try: ganache-cli <your options> --chainId 1 Then, Uniswap should recognise this and let you connect ...


0

use: updated_card = magic_ideas.functions.get_card('731759').transact() instead of updated_card = magic_ideas.functions.get_card('731759').call()


0

Based on your comments, it looks that there are some formatting issues in your truffle config. I have done three changes that might help: require('babel-register'); require('babel-polyfill'); require('dotenv').config(); // you are missing the dot `.` between `require('dotenv')` and `config()` module.exports = { networks: { development: { ...


Top 50 recent answers are included