Public kovan test net - ethereum

How to get Kovan public test net in metamask as I have tried all the recommended sites but did not get it.
These links do not work for me to get it.
https://faucet.kovan.network/
https://gitter.im/kovan-testnet/faucet

Please try this for kovan test network faucet:
1- https://ethdrop.dev/ (unlimited 0.001)
2- https://gitter.im/kovan-testnet/faucet (only for 0.001 once in 24 hours)

You can get some Kovan test ETH here https://linkfaucet.protofire.io/kovan

Related

ERC721 Contract: 1 ether = 1 token for network deployed on?

I am new to Solidity and looking over an ERC721 NFT contract.
I see in the code they set variables of prices to things like uint256 public MINT_PRICE = 1.5 ether;.
Does this mean that the price would be 1.5 of AVAX if were deploying this contract onto the Avalanche network whose base token is AVAX?
calculations are done in the base units for a token.
uint256 public MINT_PRICE = 1.5 avax;
People uses "ether" for placeholder
Note that gas fees are always paid in "ether" if your contract is on ethereum.

Error when trying to deploy standard OpenZeppelin ERC777 contract to ganache-cli using the brownie framework

I am familiarizing myself with smart contract development using the brownie framework and solidity. To start of I was using the brownie console to deploy some standard OpenZeppelin token contracts.
I did this by copying the code right from their documentation and adjusting the imports to work with brownie, like in this page: https://docs.openzeppelin.com/contracts/3.x/erc777
It works fine for the ERC20 and the ERC721 contracts. The ERC777 however always get reverted and gives me a transaction without error message, where none of the tracing methods work, because they are not implemented for a deployment transaction.
Code For ERC777 Token (Not Working)
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "OpenZeppelin/openzeppelin-contracts#3.0.0/contracts/token/ERC777/ERC777.sol";
contract GLDToken is ERC777 {
constructor(uint256 initialSupply, address[] memory defaultOperators)
public
ERC777("Gold", "GLD", defaultOperators)
{
_mint(msg.sender, initialSupply, "", "");
}
}
Code For ERC20 Token (Working)
// contracts/TestToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "OpenZeppelin/openzeppelin-contracts#3.0.0/contracts/token/ERC20/ERC20.sol";
contract TestToken is ERC20 {
constructor(uint256 initialSupply) public ERC20("Gold", "GLD") {
_mint(msg.sender, initialSupply);
}
}
Output In Brownie Console
>>> t1 = TestToken.deploy(1e21, {'from': accounts[0]})
Transaction sent: 0x33de3fadb7ccf2dd8b3841365ad88190c3486a803f6ea30c04ef8c0111ec9cbd
Gas price: 0.0 gwei Gas limit: 6721975 Nonce: 2
TestToken.constructor confirmed Block: 4 Gas used: 721166 (10.73%)
TestToken deployed at: 0x8c81630387e9507739fCeB6cbB14Ea1Da11D2339
>>> t2 = GLDToken.deploy(1e21, [], {'from': accounts[1]})
Transaction sent: 0xca91d510e7a54099182fe218ff0ec55c62ccb06227afbe9d9497790e35776651
Gas price: 0.0 gwei Gas limit: 6721975 Nonce: 0
GLDToken.constructor confirmed (reverted) Block: 5 Gas used: 260948 (3.88%)
I have also tried to enter a valid address (of deployed operator contract) in the list for a default token operator, that is passed as the second parameter to the deploy function of the GLDToken. Unfortunately it made no difference.
I have exhausted all possibilities with the deploy function and am getting no further debugging information. Has anyone experienced a similar problem, or knows how to debug this further? Any help would be much appreciated!
I was having a similar issue with the ERC777 contract from openzeppelin. I could not find a sufficient answer online so I wanted to share what worked for me. I rendered a flat file of the contract. On my line 772:
IERC1820Registry internal constant _ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
I deployed an ERC1820 registry locally and replaced that address.
Registry
I was then able to deploy the ERC777.
Hope that works and helps.
if you want to deploy it on local blockchain, you should at first deploy the ERC1820 contract and then deploy the ERC777, BUT on other blockchains ( including testnets and mainnets this 1820 contract is already deployed and you can just use that, its is my repository on github than I deployed a ERC777 contract with a function to check if 1820 not deployed (like on the local blockchain) I deploy it first, otherwise I continue with the deploying ERC777 , I used hardhat to deploy that, but its easy to change it with other lib that you like.
https://github.com/EhsanParsania/ERC777
-- read the readme.md first

how to swap Token for ETH with swapExactTokensForETH() using UniswapV2Router02 Contract

i'm traying to swap some DAI for ETH on the Ropsten Network using the UniswapV2Router02 on Etherscan (Ropsten Test Network).
DAI Address on Ropsten = 0xad6d458402f60fd3bd25163575031acdce07538d
WETH = 0xc778417E063141139Fce010982780140Aa0cD5Ab
in my Wallet i have 2000 DAI (Ropsten)
but when i put the data there. like this:
Metamask shows that there is an Error thrown by the Contract.
So i might be missing something or am'i doing it wrong.
can please someone help and show me how can i make a successful transaction there ?
i got this to work.
if someone is interested to know how, here is what i have done.
1- amountIn should be in 10^18, that means 100 was wrong, it should be 100x10^18 = 100000000000000000000
2- first i had to approve the UniswapRouterAddress to spend this 100 DAI.
so on the DAI contract Address i had to put the data like this:
after that i was able t swap the 100 DAI for ETH (as much as 100 DAI is worth of ETH)

Error: Unable to Verify Contract source code

I am a newbie in Solidity and Ethereum smart contract deployment. I have been trying to deploy some contract on Ethereum Testnet - Ropsten. I have successfully deployed and published
But, I received the error "Unable to Verify Contract source code." when trying to publish the following source code for this contract: https://ropsten.etherscan.io/address/0x811f7cf0f9534f54c4a56c383bbaed73dc88f609#code
I didn't know where did I do wrong.
pragma solidity ^0.4.0;
contract Test3 {
uint storageData;
function set(uint x) public {
storageData = x;
}
}
Any help would be appreciated.
Ok so I don't have enough reputation to comment otherwise I would have but there are very few things that could go wrong here so Ill just go over what you need to do. And you can chat with me on discord or something if you have any other questions. First I assumed you deployed with remix. So go to the settings tab and make sure that on etherscan you selected the same version that is displayed there, otherwise it will not work and then if the optimization box is not checked which is the third checkbox down then select no on etherscan otherwise again it wont work. then you just copy the exact source code into the box and type in the name of the contract and that is it.

Gas required exceeds limit

I'm trying to deploy the following contract on Ropsten using an injected web3 environment (i.e. metamask) on remix.ethereum.org/
pragma solidity ^0.4.16;
contract Coin {
// The keyword "public" makes those variables
// readable from outside.
address public minter;
mapping (address => uint) public balances;
// Events allow light clients to react on
// changes efficiently.
event Sent(address from, address to, uint amount);
// This is the constructor whose code is
// run only when the contract is created.
function Coin() public {
minter = msg.sender;
}
}
I've been able to create contracts with ease using remix before. I'm not sure what has changed, but I can't create contracts at all because of the gas limit thing. I've even gone as far as setting the gas limit to 2 full Ethers (i.e. value 1 ether with max of 2). I have close to 3 ethers in my metamask wallet. The remix "Account" dropdown also displays my metamask address correctly so it seems that the injected environment is connected.
When I try to create this contract I can't get past the gas required exceeds limit 2 error. I'm scratching my head as to why this simple contract would exceed the cost of 2 full Ethers.
Other parameters for remix in use:
optimize=false&version=soljson-v0.4.20+commit.3155dd80.js
Is there a setting on remix that I've forgotten? I'm Trying to deploy this from Chrome.
edit: I'm still scratching my head on this one. I was able to create the contract above for a brief moment after refreshing my page, but I came in today to try and run the code from https://www.ethereum.org/token and I can't get past the exceeds gas error with a value of 20 Gwei and a limit of 3000000. Note, I tried using the simple sample contract above and I'm back to where I was when I started - even the simple "Coin" contract above apparently exceeds the gas limit.
edit 2: Well, I think I'm getting somewhere. I've changed the compiler version from "soljson-v0.4.20+commit.3155dd80.js" to "soljson-v0.4.19+commit.c4cbbb05.js". Then I refresh the page 3 times. After that I wait a couple of minutes and things seem to be working again. There is something else happening here because when I reject the transaction in metamask and then return to remix to create again, I encounter the gas exceeded error. I don't believe the issue here is metamask as I've tried to connect locally using testrpc - localhost:8545 - and experience the same issue. All I can say is that the same code that I try to create fails to submit because of the gas error most of the time but occasionally works regardless of compiler version.