as most of the BEP20-Tokens-Contracts are online available on GitHub or BSCScan you should be able to just copy the code and paste it into remix.ethereum.org and deploy it. I did that and the contract deployed successfully to the BSC but the token information are missing. What do I do wrong?
Here is the code I copied: https://bscscan.com/address/0x0cF011A946f23a03CeFF92A4632d5f9288c6C70D#code
and here is my contract deployed to the BSC: https://bscscan.com/address/0xf5be6f7f00a4870b46f3ab6d16f5095731da97d7
I have just changed the name of the token, but the token information are not showing up on BscScan nor do I see the token in my Wallet. Any help is appreciated!
Your contract's bytecode contains just the Address contract bytecode. Since it's the first contract in the list (sorted alphabetically), I assume you simply forgot to select the contract that you wanted to compile.
You need to select the NyanCatToken contract (which effectively imports the Address as well) when compiling in Remix.
Related
For a number of reasons, Ethereum Remix is great for developing in Solidity. However, I need to integrate what I develop there into some other Web3 front end stuff. So after each time I deploy a smart contract in Remix I have to copy and paste the contracts address as well as the ABI into another IDE so it can interact with the Web3 frontend.
Is there some sort of way to do the step of copying the contract address and ABI from Remix into a text file on my local system? I couldn't find a Remix API. Was wondering if anyone has another idea.
I want to deploy my own ERC-20 token on different blockchains, so is there any possibility to deploy the same token contract on different blockchains. If we do that we can't give the same name and symbol for three blockchains. can anybody tell me what is the solution for this problem? Or can we deploy the contract with the same contract address on three blockchains?
can we deploy the contract with same contract address on three blockchains.
It depends on the network that you're deploying to and the address that you're deploying from. Assuming that the networks of your choice have the same 1) address format and 2) calculation of deployed contract address - then yes, you'll be able to deploy your contract on the same address on multiple networks.
For example Ethereum and BSC do have both of these features. But even though Tron network supports EVM-compatible smart contracts, it has a different way to calculate its addresses, so it won't be possible to deploy your contract on Tron network with the same address as on Ethereum or BSC.
The key to deploy the contract to the same address on multiple networks, is to deploy from the same address, and using the same params:
In case of the regular CREATE opcode, the transaction deploying the contract needs to have the same nonce (and the same from) value across all networks.
Or if you're using the CREATE2 opcode, you need to pass the same contract bytecode, the same salt (to the CREATE2), and again, you need to send the deploying transaction from the same address.
If we do that we can't give the same name and symbol for three blockchains
It is technically possible, so I'm assuming it's "just" a limitation of your business case or some tool that you're using, or a possible simple misunderstanding of how the ERC-20 standard works.
pragma solidity ^0.8;
contract MyToken {
string public constant name = "MyToken";
string public constant symbol = "MyT";
// TODO rest of your token contract source code
}
We have a smart contract factory which deploys smart contract instances. These smart contract instances use SafeMath.
We want verify code for these instance on Etherscan. But, Etherscan requires SafeMath library address to verify contract code.
How can I get the SafeMath library address for each instance?
SafeMath functions are all internal. There is no external library to link to. Hence no need to specify a library for Etherscan verification.
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol
https://solidity.readthedocs.io/en/latest/contracts.html#libraries
... code of internal library functions and all functions called from therein will at compile time be pulled into the calling contract, and a regular JUMP call will be used instead of a DELEGATECALL.
You can also ask questions about using OpenZeppelin on the Community Forum: https://forum.openzeppelin.com
Disclosure: I am the Community Manager at OpenZeppelin
I am trying to write upgradable smart contract in ethereum. Can anyone give an example of upgradable smart contract in ethereum and accessing data.
To write an upgradable smart contract I suggest you do the following (works for me):
Create a storage contract on which you will store all your map and variables. Add a modifier to the functions changing state. This modifier should require that an address must be present in a specific map (let’s call it authorized) to change the state of map or variable. Place the owner’s address in that map.
Write a function to authorize external address on the storage contract
Deploy another contract containing the logic of your app.
Autorise the logic contract on the storage contract.
Upon upgrade of the logic, deny access to the storage contract from the logic contract, deploy your upgraded logic and link the new contract to the storage.
Tadaa you now have an upgradable set of smart contracts.
Smart Contract cannot be replaced, but you can create a smart contract proxy to be able to replace the calling of all new Smart Contract functions (previous smart contracts cannot be removed on the main network ethereum).
Complete explanation and examples can be seen Here
You can implement follow Proxy Pattern
Blog
https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357
Smart contract upgradability is a state of the art area. Currently, there are a few solutions, but each of them has its own pros and cons. Here are the solutions with examples:
https://consensys.github.io/smart-contract-best-practices/software_engineering/
I am using Ethereum with testnet Rinkeby, I created a contract and deployed it. Is there a way to display the source code of that contract? I know that contact are immutable but I want just to have a look on the code.
There is currently no way to do this and probably will not be for a while, because the code is not published on the blockchain, just the byte code from the compilation. There are certain block explorers that can help like ether.camp that you can upload solidity code to then it can check against a given address to see if it matches. There is also a project that is scraping git to find the source code to match byte code.
http://etherscrape.com/about
So no once the code is deployed there is no easy way to see it.