New answers tagged

0

Whenever you need to pass a contract instance (or an interface which describes an instance) you pass an address. So you just need to pass in the address of a contract which implements IERC20 . In your case I'm not sure if there are some extra requirements for what _sushi should exactly be - any IERC20 will be syntaxically correct but it probably has some ...


0

Tokens are commonly used to raise money for a crypto projects at the beginning. Many projects could run without their own token. Gas tokens are used to speculate on the price of gas. If the price of gas is low you can use cheap gas to mint a bunch of gas tokens. Once gas prices are higher you can either sell your gas tokens or use them yourself to reduce the ...


0

This variant can work with float: function strtodec(amount, dec){ var i = 0; if (amount.toString().indexOf('.') != -1) { i = amount.toString().length - (amount.toString().indexOf('.') + 1); } stringf = amount.toString().split('.').join(''); if (dec<i){ console.warn("strtodec: amount was truncated") ...


0

address _token, address _from, address _to, uint _amount ) public returns (bool _success) { require(tokenTransferPermissions.isAuthorized(msg.sender)); return ERC20(_token).transfer( _to, _amount); } }```


0

I think you need to compile from 0.4.9 to 0.4.26. pragma solidity ^0.4.9; ^0.4.9 means "greater than 0.4.9 as 0.4.x" And the latest version of 0.4.x is 0.4.26.


0

Token price is determined by supply and demand from the market. There's no such thing as an ideal supply. Every project is different. ERC20/ERC223 has nothing to do with mining they are about utility token functionality. There are several proposal like EIP 919 but it is still at draft stage after two years. No, you can't modify a contract bytecode once it ...


0

With: function allowance(address _owner, address _spender) You should change this: tokenContract.allowance(msg.sender, this) To this: tokenContract.allowance(msg.sender, address(this)) The type of the function's 2nd input parameter is address. Yet, you are passing a value of type TestContract. In terms of offchain interface (e.g. web3.js), these two types ...


1

this is a security check. actually there is no way for you to rapidly check the balance of the user without consuming gas. so you should have a logical security check before sending or spending or exchanging tokens in the SC. just put a assert,require, revert before using the balance of the user and if it failed due to insufficient balance, then update the ...


0

Some exchanges, such as the one you posted, require you to trade a minimum amount of ETH (or tokens). In this case, you are trying to send 0.00003111... WETH, but the exchange says you need to send a minimum of 0.001. In order to fix this, you will need to send more WETH to your account.


0

Here is the pair on uniswap WETH / ETH: https://app.uniswap.org/#/swap?inputCurrency=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 and the contract address https://etherscan.io/token/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2


0

approve its tokens for another address? This isn't very clear. "Its" could mean tokens the contract wants to spend or tokens the contract wants to receive. @Laurie is exactly right if it's the former case. The contract can spend its own money just like anyone include authorizing another contract to transferFrom(). If you want the latter case, e.g. ...


0

Even if the ERC20 standard doesn't dictate how the token contracts should be implemented, almost always the approve function approves spender to spend tokens from msg.sender. So if you use that function from a contract the msg.sender will be the contract - therefore, if I understood your question right, it works just as you wanted. So it's always the token ...


0

Well, I also noticed that when trying to connect to Remix IDE, I was not able to set the Injected Web3 method. It seems that Metamask came into an unstable state, so I finally had to reinstall it. Ensure to have your mnemonic phrase before!


0

My issue was that my event was called "TestEvent" and for this reason it was not firing. I renamed it to something else and it fired. Not sure why this but wasted half an hour scratching my head cause of this... Maybe this is some sort of expected truffle behaviour when the event is named "TestEvent"?


0

I usually write standalone JavaScript and Python snippets in Visual Studio Code and run them from command-line. Somewhat better than Truffle console, because you do the work in a professional code editor. With some effort, especially in the case of Python, you get nice autocompletion. However, I am not aware of any tool like Etherescan, which would generate ...


0

Your question does not mention how do you test it: what network, how token is being created and so on. Most likely you do not account in transaction delays.


0

For solidity > 0.6.0 use WETH.deposit{value : msg.value}();


0

So this dapp here. For sure this a dapp. So what is happening: Click on register: Dapp requests user for account access via Metamask, where user have to confirm so that Dapp can move forward. Once you have Registered, on the dashboard you see the smart contract address to which it is interacting i.e. "0x7abE2a84368af480fFd4Beb7676133C30F37DC05" ...


1

Yes, tokens are simple ledgers with some transfer functionalities. They are used to represent some things: typically something completely new (gaming tokens, voting tokens, utility tokens) or sometimes representing a real-world asset (a share of a house, a part of a painting). It's basically an easy way to represent ownership of very various things - with ...


0

Your second bullet shows the token (in this case, DAI) as an Ethereum address. Etherscan shows a page with the same properties for all Ethereum addresses, such as "Internal Txns", "Erc20 Token Txns", "Erc721 Token Txns", etc. This type of address page will display the same properties for any address, whether it is an EOA, a ...


Top 50 recent answers are included