We changed our privacy policy. Read more.

New answers tagged

0

https://github.com/cryptowhale9/FlashSniperBot This is an example of sniper bot. Not frontrunner. Sadly the code is not on github, but is free to use.


0

I'm happy to be able to help you as I fixed this a few days ago. const sendERC20Transaction = async (receiver, amount) => { var Tx = require('ethereumjs-tx') const Web3 = require('web3') const web3 = new Web3('https://mainnet.infura.io/v3/your-project-id') web3.eth.accounts.wallet.add('privateKey of fromwallet'); var contractAbi =[]; var tokenAddress =...


0

Since the token hasnt been distributed yet id DEFINITELY update it to 0.8. Now you can still build in 0.8 a contract that interacts with a 0.4 contract without too many issues, but i dont see why you would do that, newer version = better in most cases anyways


0

JS lets you evaluate expressions, call functions and all kinds of stuff inside templates. sol strings won't even give you their length! So templates aren't around now. Relevant reading: https://hackernoon.com/working-with-strings-in-solidity-c4ff6d5f8008 I wonder how much you could develop a library for these type of features, like handlebars for .sol ...


1

I'm happy to be able to help you as I fixed this a few days ago. const sendERC20Transaction = async (receiver, amount) => { var Tx = require('ethereumjs-tx') const Web3 = require('web3') const web3 = new Web3('https://mainnet.infura.io/v3/your-project-id') web3.eth.accounts.wallet.add('privateKey of fromwallet'); var contractAbi =[]...


0

You should create a smart contract for managing it. Then transfer the ownership of your ERC token to that contract so that the smart contract can mint your token. When someone tries to buy your ERC token from your manager contract, it should mint the ERC tokens and transfer them to the sender. Let me know if there is anything unclear to you.


1

Yes, check tokenlists, a community-led initiative to improve discoverability, reputation and trust in ERC20 token


0

all the fees are paid by the from address of the transaction, in this case 0x4d25634945b207a67282aa0b213e6f4f44ee36c3, . there's nothing as "multiple party sharing the fee"


0

I assume you're getting error from your third function. Before calling it (TransferTokens) you need to call ERC20.approve() from the caller's address. Your second function here doesn't help the third function. your second function is basically just approving another address to use its ERC20 balance, which doesn't make much sense, cuz the the contract itself ...


0

This is a wild guess but from the little understanding i have of safemoon contract this looks like it allows a user (not excluded from fees) to give away tAmount of tokens as reflections. Edit : yeah actually maybe someone can confirm but im almost 100% sure thats it


2

There are a couple of standards looking to replace ERC-20, though these are a few years old already and haven't gotten much traction. A few examples are ERC-223 and ERC-777, both created in 2017. Both standards are looking to solve the issues of ERC-20 in different ways. One of the biggest problems of ERC-20 is contracts not being aware of incoming token ...


2

There is no "advantage". The reason most DeFi apps ask users to "allow" the transfer of their funds is that those funds are represented as ERC-20 tokens. The Ethereum community is confronted with an instance of the classical path dependence problem. Here's a guide that dives deep into ERC-20 allowances. And here are some practical ...


2

Generally, there are two ways to transfer (ERC20) tokens: Direct transfer with transfer. You can call this function to transfer your tokens directly to another address. Indirect transfer with approve and transferFrom. This way you do two different transaction: first you give approval for the receiver to withdraw your tokens. Then you call some ...


0

You will be the owner of the contract, this does not mean you will own the initial supply or future supplies. This only means you get the perks of the owner for some functions most likely. Regarding funds, if not already, those need to be sent to your wallet. With new minting, a minting address is specified, so any tokens minted will have a destination ...


1

This kind of rounding issues are quite typical in crypto projects. You have two options: 1) Try to decide who should get more (or less) 2) Do something else with the leftovers (also called dust). Often it's simply not worth it to start calculating who should get more - especially as calculations are not accurate in Solidity (due to no decimal numbers). So ...


1

An ERC20 token is transferred by calling the token contract's transfer function (or approve + transferFrom). That modifies the contract's token balances and should emit a Transfer event. Therefore, to monitor for token transfers, you should be monitoring the token contract for a Transfer event. However, there are no guarantees that an ERC20 token contract ...


1

The best you can do is create a mapping between the getAirdrop function and the user's address. Then add a method into the getAirdrop fuction that if the airdrop is successful, the Boolean goes to true. Check if the address have done it before //has the user gotten airdrop before? mapping(address => bool) public hasClaimed; Incorporate the logic into ...


5

No. It's never safe to put your private keys in any code. Your keys should be in a hardware wallet or a HSM or a Vault. As soon as you paste write it on a computer or smartphone, assuming your are not on an air gapped computer but you would know it, then your keys are compromised.


0

I figured it out. I was trying to have const maxInt = new BN(2^256 - 1); You need to make each number a new BN and perform the arithemetic to make it work. Also the numbers have to be in quotations I think. const maxInt= new BN("2").pow(new BN("256").sub(new BN("1"))); // Will pass into solidity as uint 2**256 - 1


2

No, you can't make it with just smart contracts. Contracts are deterministic, which means they can't access outside resources directly. You will need some sort of off-chain functionality, which acts as the bridge. So you need contracts at both ends of the bridge and the actual bridge which listens to events in the contracts to call the other end of the ...


1

JavaScript can't handle big numbers natively. That's where various BigNumber libraries come to play. To be consistent, it's best to always use BigNumber when dealing with integers in web3 projects. There are tons of different libraries out there, but I recommend using the one which your web3 library uses under the hood - you'll probably get utils for it ...


1

The ERC20 is simply a token standard. It says what functionality the token contract should have. That functionality enables basically to have a ledger of owners and to transfer ownership of X amount of tokens. The standard doesn't say anything about trading or prices. Those are done with different means - for example trading is often done though a (de)...


0

Yes, it is possible. All thing you need to do is remove this condition if(recipient==pairAddress&&takeFee) the fee will apply for all transfer


0

Yes. If the crowdsale contract sells tokenA, and accepts tokenB, it could work like this: User adds approval for the crowdsale contract to withdraw X of his tokenB User calls a specific function in the crowdsale, for example buy(uint amount) The function uses transferFrom to withdraw tokenB from the user, using the given allowance. Then the function sends ...


0

This should work function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 senderBalance = _balances[...


0

You can't do that, that's 2 separate transactions, you'll have to pay the gas fee for each one.


1

When you provide liquidity to a pool you will receive LP tokens for that specific pool (with a contract address unique to that pair). You can check the contract address for your tokens LP token and only provide rewards to users holding those LP tokens. However, here you need to know the platforms that allow liquidity pool creation for your token, take note ...


1

The process for manually adding a contract address for ERC20 (ETH) tokens will depend on your particular wallet. If using Metamask, you can select "Assets" tab, scroll all the way to the bottom and click "Add Token". Select "Custom Token" and there you are able to input the token contract address and symbol. After clicking next, ...


0

Ok I found the Answer. Instead of just doing transfer in the code, I create an object out of the IERC20 Interface. This is needed for a smart contract to transfer its own tokens: IERC20(this).transfer(msg.sender, amountToBuy);


0

I solved my problem, problem was in bscTestnet_url wrong node url.


0

Yes, it is quite common, unfortunately. Even though the BEP20 token has your project name and symbol, you can still create a BEP20 with same name and symbol. They are not exclusive. For this reason it's important to keep your community aware of fake tokens regularly and make sure they are aware of the correct token contract address they should interact with. ...


0

Yes, it is possible and common. Token names are just a string variable in smart contracts. So there can be even millions of tokens with same name of your token.


0

in most cases there is only one approved USDC contract, so you can easily hard code that for your network inside your own smart contract and not reply on external calls to provide the address unless it's part of your design to do so.


0

If you have the contract ABI and address, you can use web3.py to call the contract and fetch its past emitted events. Based on this information, you can construct on the Python side what has happened and what is the current contract state. More information in Web3.py documentation how to interact with the contracts.


1

In general Ethereum does not support the event-driven paradigm. There needs to be a transactional trigger (most likely you calling a function) that releases the tokens. Or in a withdraw function called by the investors function withdraw() external { if(block.timestamp < vestingPeriodEnd) return; // do nothing if(eventOccurred) // return amount A ...


0

The code explicitly reverts when the sender it not the owner. Unless that part is removed there's no way for a user to approve a third party to use transferFrom. if (msg.sender != _owner) { revert ("Sender not authorized"); } else { A user can discard the Metamask warning and send the transaction but it will fail.


Top 50 recent answers are included