Hot answers tagged

4

1) Matching the ERC777TokensRecipient interface is optional. More specifically, one single ERC1820 registry is deployed on most Ethereum networks, always at the same address: 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24. The ERC1820 registry contains a mapping from addresses to contract addresses verifying the ERC777TokensRecipient interface. Those ...


4

From Weenus 💪 ERC20 FaucetAnnouncing the Weenus 💪 ERC20 token faucets on the Ethereum mainnet, and Ropsten, Kovan, Rinkeby and Görli testnets: Search in your Ethereum blockchain explorer for WEENUS (18 decimals), XEENUS (18 decimals), YEENUS (8 decimals) or ZEENUS (0 decimals). Send a 0 value transaction from your account to the token contract addresses ...


4

Etherscan will recognize your contract once it will log its first Transfer event. This is how it works. Though, even before the first Transfer event was logged, you may view your contract in token tracker: https://rinkeby.etherscan.io/tokens?q=0x5238fFeAEdfc9481bd635B6E0e5eF3b05b19762a


4

The output you receive is in hex format. You need to conver hex to an int. Here is the full code you need to use: const contractInstance = web3.eth.contract(contractAbi).at(contractAddress); const total_supply = parseInt(contractInstance.totalSupply.getData()); console.log(total_supply); I added parseInt() to convert your hex number into a human readable ...


3

If you're referring to Wrapped BTC (WBTC), it has nothing to do with the Bitcoin Network. 1 WBTC is equal to 1 BTC purely through a custodial pegging system. To mint a WBTC ERC-20 token, you must lock-up a BTC. This lets BTC be 'represented' on the Ethereum blockchain and can be used in different dApps, commonly financial ones. If you're familiar with ...


3

This sounds like a perfect use case for the now finalized ERC-1155 token standard, which allows one to manage any number of fungible and non fungible tokens in a single contract.


3

Since you do not have control over the address, the tokens have been lost. If your contract does not have a burn function, unfortunately you can not update it. Perhaps what can be done is to create a new contract that copies the current contract state and includes the burn function, but I do not know if this is so simple for your case.


3

If you want to call a function of your contract by sending a new transaction, you have to use myFunction.transact(transactionObject). The transactionObject is a dictionnary where you can specify the values for value, gas, from, etc... Using web3py 4.9.1, it should be the following for your case : instance.functions.setProperty(user_address,country_byte_32,...


3

Just don't use BN. You need to convert ETH to WEI. This is a very simple proccess. Web3 has some buildt in functions for this: const val = 0.15; // this guy var weiAmount = web3.toWei(val);


3

There's no way for you to get them back, tokens sent to that particular contract that you're referring to, are stuck there forever. The contract that you link to has no way to withdraw tokens mistakenly sent to it. Perhaps your best chance is to reach out to the MWAT team and explain your situation, perhaps they can try to resolve it in someway.


3

Decentralized Finance (DeFi) is the movement that leverages decentralized networks to transform old financial products into trustless and transparent protocols that run without intermediaries. Some may prefer to call DeFi as Open Finance, Distributed Finance, or EthFi(referring to the fact that at the moment most of existing DeFi products built on Ethereum....


3

An ERC20 contract must exactly implement the specification described here: https://eips.ethereum.org/EIPS/eip-20. This makes the critical behavior predictable so it will be compatible with wallets and exchanges. A contract may implement additional behaviour provided it doesn't interfere with the minimum functionality. It's worth noting that exchanges and ...


2

The error message is a bit misleading (which is typical with any blockchain tool). The main point in the error message is "transact to browser/test.sol:MyToken.transfer errored: VM error: invalid opcode". The point about payable was completely a guess by remix compiler, which is not accurate all the time. So the problem is that your Invalid Opcode. It ...


2

Here's json result from your api call: { jsonrpc: "2.0", id: 1, result: { blockHash: "0x8fe66b0c15a1c1155338bb5628db55f05cfe72d1194931134b4721cd07e9eda7", blockNumber: "0x416850", from: "0x167a9333bf582556f35bd4d16a7e80e191aa6476", gas: "0x13880", gasPrice: "0x4e3b29200", hash: "...


2

Ended up with an ERC223 implementation :) Thanks ! pragma solidity ^0.5.2; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { ...


2

You don't have to add function keyword in front of constructor. it won't show up during deployment because you are declaring it as contract function. Remove function keyword and try. definitely it will work. constructor (uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) public { balances[msg.sender] = _initialAmount; //...


2

Stablecoins - regardless of the platform on which they've been implemented - generally fall into three broad categories: Centralised / IOU : A centralised controller holds an asset and creates IOUs that can be traded back in for the asset at a later date. Collateralised: Coin is issued in response to collateral being pledged. Value is kept stable by various ...


2

It depends on what you mean by "safe". You can confidently derive the source code of this contract by the source code of the deployer. It will normally happen from a statement in the form of new Contract(arguments) and analysis of the deployer contract will leave no doubt about what it does. It does not mean that the quality of the contract or the intent ...


2

Take a look at ERC-1155, https://github.com/ethereum/EIPs/issues/1155. This was designed by the Gnosis Team to address the problem of using ERC20 and ERC721 tokens in a case where when unique tokens would emerge. You can do that, and decompose/recompose according to rules to configure you will have the problem of gas cost for deploying a new contract each ...


2

On web3.js v1.x, you should fix the following: Change web3.eth.Contract to new web3.eth.Contract Change omisegoContract.balanceOf to await omisegoContract.methods.balanceOf Of course, the 2nd bullet implies that this line should be executed from an async function.


2

Most use-cases can be solved by inverting control. Rather than having the contract run something at a certain time, interested parties claim entitlements when appropriate. The contract decides if the requests are permissible. So, a delayed entitlement would go: Buyers sends ETH. Contract records future entitlement to tokens. When (not before) and how much....


2

When a contract B is calling another contract A, msg.sender in contract A will always be B. There is no way around that. You haven't given a lot of information. Depending on the rest of your code, here are some things to consider: Move someMethod() to contract B Call someMethod() directly, instead of through wrapper_someMethod() Use tx.origin in contract ...


2

I voted for Jesse's answer. For the benefit of others who come across this, a little example of the last option mentioned: contract A { function someMethod(address sender) public{ // Something happens here // proceed using "sender" the msg.sender says the transaction is for. } } contract B { A instance = new A(); ...


2

Because Solidity only supports integer numbers, there's no natural way to represent a value like "half a token" (0.5 tokens). To work around this, ERC20 tokens use a multiplier. For US dollars, you might use a multiplier of 100, or 10^2, for 2 decimal places. In code, you'd store the number of pennies rather than the number of dollars. So $1 becomes 100 ...


2

You can check with the code below that this line: uint256 roundValue = SafeMath.ceil(_value, basePercent); If your value _value is higher than basePercent, roundValue will be the number rounded on the hundred, otherwise the _value will be basePercent always. Example: input = 1--> roundValue = 100 Example: input = 4111--> roundValue = 4200 Code: ...


2

The EVM bytecode (compiled form) is available/observable to all users at all times. The data in contract states, including variables explicitly marked private, is available/observable to all users at all times. private describes visibility to other contracts but it is a misunderstanding to assume it implies protection for confidential information. ...


2

The target contract is a non standard ERC20 token. It should have three topics, two indexed parameters and the event id and the transfer value in the data field. But it has four topics instead. "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x000000000000000000000000c5ec6937d3278311e2ace517df214717310c0820", "...


2

pragma solidity ^0.5.0; //import ERC20 functionality ... contract Example { ERC20 public token; //@param _token the address of the DAI smart contract constructor(ERC20 _token) public { token = ERC20(_token); } function () external payable {} ...


2

You need to send the tokens at least once first. Otherwise this will not work. Etherscan only recognises a contract as an token after its first Transfer event. After sending the tokens once it should work perfectly!


2

In web3.js v0.x: The expression contractInstance.totalSupply.getData() would get you the encoded ABI data (byte-code) of a call to function totalSupply. In order to actually call the function and retrieve the return-value asynchronously, you should use: contractInstance.totalSupply.call().then(total_supply => { console.log(total_supply); }); In ...


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