19
votes
Understand price impact and liquidity in pancakeswap
Disclaimer: I don't think this is the correct method to calculate the price impact but it's almost 100% accurate for price impacts of less than 1%. This calculation method assumes that multi-hop is ...
18
votes
Accepted
How do I get the implementation contract address from the proxy contract address?
Most proxy contracts typically have a public variable defined as a:
address public implementation;
Which defines the address of the implementation contract. You could then call it as a view function ...
16
votes
Accepted
Binance Smart Chain tokens: What are tTotal, rTotal, tSupply, rSupply, rOwned, tOwned which I see everywhere?
It' a bit of an algorithm, or really just some math, to to the balance of an account. Instead of using the default "tokenSupply".
Constants
Fee is 1% (assuming no burn, just a general 1% ...
15
votes
Accepted
Is there an Infura equivalent for BSC?
If you are looking for a fully managed third party RPC provider for BSC, you can use:
Quiknode
Ankr
If you want complete chain data, you can use their snapshots
14
votes
Accepted
ethers gasLimit gasPrice
Let's break this into two parts, with the caveat that you should look at the second before doing anything about the first.
Setting the gasLimit and gasPrice in Ethers
Here's the relevant part in the ...
9
votes
Accepted
Fail with error 'TransferHelper: TRANSFER_FROM_FAILED' even approved in contract
The issue is that you need to approve the pair and not the router. Looking at the transaction you linked you can see that it revert on the transfer from 0xa89C6f52Ce3Ce1BFF6CAac1E1c98b4f9b3AA5f63 (...
8
votes
Accepted
Binance Smart Chain RPC Rate Limit
Since these are public endpoints, they are probably monitoring your usage by your IP address. So you can only do 10K requests/5min from your IP. It doesn't matter if you have more applications or ...
7
votes
Accepted
How to point web3j to other networks such as BSC?
If you are using the smart contact wrapper then you usually need to give one of the available transaction managers as a parameter and then give the chain Id when you initialize it
Web3j web3 = Web3j....
6
votes
tx fee (2.11 ether) exceeds the configured cap (1.00 ether), how to bypass default cap?
The --rpc.txfeecap param on node should be changed to 0:
--rpc.txfeecap value Sets a cap on transaction fee
(in ether) that can be sent via the RPC APIs (0 = no cap) (default: 1)
info ...
5
votes
Accepted
Ensuring correct block order with subscribe on "newHeads"
Basically, what you want is to have a confirmation that a given block was included in the canonical chain. I assume that you do not need very high security because based on your examples a ...
5
votes
Accepted
Token Price from pancakeswap
You do not need to go through this hassle, you can use getAmountsOut on the PancakeSwap router contract to make this a lot simpler. You provide a path&amount of the first token in the path to use, ...
5
votes
Accepted
What is the BNB decimal on BSC
BNB has 18 decimals on Binance Smart Chain (like other EVM native token) and 8 decimals on Binance Chain.
Based on your use of ethers, I’m guessing your interacting with BNB on BSC (and therefore use ...
4
votes
Get list of tokens balances from wallet address via web3?
You cannot do this through regular JSONRPC calls, but it is possible to limit the number of calls needed by using a smart contract. You can use the library eth-scan to do this for you. Simply pass in ...
4
votes
How to fork the binance chain?
it's seems ganache-cli suport forking bsc network.
ganache-cli -f https://bsc-dataseed.binance.org
https://www.reddit.com/r/ethdev/comments/nih0zx/how_to_fork_bsc_mainet/gz3vhex?utm_source=share&...
4
votes
tx fee (2.11 ether) exceeds the configured cap (1.00 ether), how to bypass default cap?
What is your setup environment? Hardhat? Truffle? Using ethers.js or web3.js?
Anyway, I just solved it.
I am using Hardhat with ethers.js
For the error message: 'ProviderError: exceeds the configured ...
4
votes
Accepted
contract.QueryFilter(Filter) Giving me errors in Ethers.js
In the screenshot provided, the actual error beneath the huge error text is "exceed maximum block range 5000".
When you use queryFilter, by default it chooses 0 to 'latest'.
Querying for ...
4
votes
Accepted
how to get full info of a transaction hash? Web3.py or Web3.js
Method web3.eth.getTransaction(<TX_HASH>); will return an object which will have property value and this is the value parameter passed to the transaction, but represented as wei. To convert it ...
4
votes
Why chi token save 50% and not more?
Gas refund cap is a limitation of the Ethereum protocol.
Since London update the 1/2 gas cost refund cap was changed to 1/5 max refund.
go-ethereum/params/protocol_params.go -
// The Refund Quotient ...
4
votes
Accepted
How to add reflections to my basic token
If you are new to solidity and looking to develop tokens, you should definitely look at ERC20 standards. It is the most adopted and accepted standard for fungible tokens by the community. To ...
3
votes
Load Contract From Address Remix
Let me cite from the documentation:
To use AtAddress, you need to have the source code or ABI of the
deployed contract in the active tab of the editor. When using the
source code, it must be compiled ...
3
votes
Binance Smart Chain tokens: What are tTotal, rTotal, tSupply, rSupply, rOwned, tOwned which I see everywhere?
Well _rTotal is simply Total Reflections and _rOwned refers to number of reflection a user owns.
think of this way:
we could set initial _rTotal to 100 to represent 100%
and if your _rOwned value is ...
3
votes
Is there an Infura equivalent for BSC?
There are some RPC providers for Binance Smart Chain, BSC.
You can read BSC docs for RPC
I think this will be the best curated (and official) list for RPC in BSC.
3
votes
Accepted
How can we get the current spot price for a BEP20 token used web3?
How would we get the price data points from web3?
Web3 has no concept of token value, as the value is speculative and differs between different markets.
You can either get the price from a particular ...
3
votes
Running BSC node in light mode?
You can't. BSC does not "officially" support light mode.
However, BSC 1.1.3 implemented something called diffsync, which has security characteristics of light mode.
Diffsync, when activated ...
3
votes
Accepted
Why I am not able to decompile this contract?
You can decompile it here. Simply paste the bytecode from here. You must remove the leading 0x before decompiling.
3
votes
Retrieve price data from PancakeSwap [BSC]
Pancake Swap uses the same formula as Uniswap, but they have a 0.2% fee instead of 0.3% fee, which affects the calculation.
3
votes
Ensuring correct block order with subscribe on "newHeads"
Proof-of-work chains like Ethereum are probabilistic. The "longest chain" rule helps nodes determine the canonical chain but much ambiguity exists at the head of the chain. Uncertainty ...
3
votes
Web3: Get token address from pair address
You get the tokens that make up the trading pair by calling following lines on the pair contract:
token0 = contract.functions.token0().call()
token1 = contract.functions.token1().call()
I used the ...
3
votes
Check valid slippage before sending transaction using web3
Currently, ERC-20 tokens do not expose interface expose transaction fees. Only thing you can find these out is by checking them by hand.
Also, taking fee on transfer() does not fit to ERC-20 token ...
3
votes
Accepted
How can I register my NFTs on opensea
Opensea did not supports the BSC network. But you can mint the NFTs on Polygon for cheaper fees. Polygon is supported by Opensea platform.
Reference: Which blockchains does OpenSea support?
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
bsc × 445solidity × 99
web3js × 70
pancakeswap × 63
tokens × 42
remix × 35
binance × 33
bscscan × 33
web3.py × 30
blockchain × 27
ether × 26
go-ethereum × 25
ethers.js × 25
erc-20 × 24
contract-development × 21
transactions × 21
binance-smart-chain × 19
etherscan × 16
python × 16
uniswap × 15
nodejs × 14
gas × 13
javascript × 13
metamask × 11
testnets × 11