Fail with error PancakeRouter: INSUFFICIENT_B_AMOUNT [closed] - ethereum

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 months ago.
Improve this question
In pancake swap, when we enter liquidity pool with any pair of tokens, i'm getting this error
after confirming the transaction through connected wallet
Fail with error 'PancakeRouter: INSUFFICIENT_B_AMOUNT

I am just going to be more detailed, so people who are new to this maybe able to understand the full flow.. I am learning too, so people who are already an expert are welcome to correct me or give more details if required.
Firstly, Pancake is a Decentralized Exchange (DEX) that operates on Binance Smart Chain (BSC) Network where you can do Decentralized Financing (DeFi) like Staking or Liquidity Mining with BSC tokens or Token Pair that are supported/popular in Pancake DEX respectively.
When you try to enter into Pancake Liquidity Pool (LP) with a token pair (example: BNB/BMON or BMON/BUSD),
you will be asked to enter how much of your tokens you wish to get into the LP from your non-custodial Wallet like Metamask Wallet.
Once you enter the values, the Pancake Liquidity interface will show the equivalent tokens for both the tokens selected as pair.
Then you should confirm to deposit the amount of both the tokens you selected to enter the token pair LP (called Cake-LP in Pancake).
Once you press 'Confirm' in Pancake, you will be given a message the approximate (~) number of Cake-LP tokens you may end up getting into that LP after transaction succeeds. It will also clearly state that "if the approximate number of LP token may not be available after trying the transaction, then the transaction would automatically fail.
This error "PancakeRouter: INSUFFICIENT_B_AMOUNT" is due to the above mentioned failure.
To avoid such errors, make sure to click/tap 'confirm' in Pancake DEX and subsequent authorize confirmation in your connected Wallet ASAP. So the transaction would end up giving you approximately the same no. of LP token and hence the transaction will be able to finish successfully.
If you still see the same issue, try 2 or 3 more times, then it will succeed.
Thanks!

Related

How to set a timer with solidity?

I'm writing a Defi project. What I want to do is to set an automatic payment. For example, when a lender asks to lend 10 eth, the money would be automaticly sent to him after a month. I have searched a lot but found nothing. Are there any possible remedy? THANKS!
I'm writing a Defi project. What I want to do is to set an automatic payment. For example, when a lender asks to lend 10 eth, the money would be automaticly sent to him after a month. I have searched a lot but found nothing.
You don't. In Ethereum, transactions are always initiated by the user, or Externally Owned Accounts (EOAs).
You program your smart contract in a way that after certain block.timestamp has passed the user can call claim() function that sends him any payment.
You would have to use chainlink keepers for that.
You can put a require statement that will ensure that the eth won't be sent before the 30 days but there is no way to call the function from solidity after 30 days.

Finding relevant smart contract information in Blockchain data

First of all apologies for probably poorly named question but the fact that I can't formulate it better is probably partially a reason why I've not been successful in finding the answer. I am trying to understand where in blockchain data can I find specific value of smart contract method. For instance, as in the screen below, this specific smart contract 0xF59D66c1d593Fb10e2f8c2a6fD2C958792434B9c holds information about the totalAssets and pricePerShare. I can see the values in the Etherscan but now, having access to logs/events and transactions from Ethereum blockchain- can I find these values in either logs/events/transactions? And how would I go about finding that value per block in the past? Any hints how to approach it would be very helpful
To get historical data, you can refer to the smart contract view function indicating the block number at the time of which you want to view the result. For example, for JSON RPC, such a request looks like:
{"jsonrpc":"2.0", "method":"eth_call", "params":[{"to":"contract", "data":"function signature and parameters"}, "block number"], "id":1}") ;

How do I prevent further theft from my compromised Ethereum address?

Background on the compromised address
I fell for a MEW phishing scam, and I use that particular eth address for airdrops, investments sites etc, I'm expecting eth to be paid to me through that address, and I can't change the address because I've already used it.
My approach
My intended approach is: a script that will perpetually check my address for any incoming ether, and automatically transfer it to another address. This needs to happen before the scammer transfers the ether out. I am willing to use a high gas price, so the transfer can be swiftly included in a block.
How to Implement?
From my little research, I've found out that this can only happen through webjs, and having the full eth node. Can I use infura and Nodejs to do this? If it's possible, how do I do it?
Racing the Scammer
You are unlikely to be able to out-compete the scammer in a race to withdraw. They are "professionals" at this, and can probably submit the withdrawal transactions faster than you.
Stop the Bleeding
Your best option is to find a way to change the location of any future dividends & withdrawals. For example, if you have an ERC20 token that sends you dividends (and the scammer didn't already drain the token from your account), then transfer that token to an uncompromised account. Dividends will start appearing in your new account, and the scammer cannot intercept them.
Prevention
I'm sorry for your loss. Many people have learned expensive lessons this way. It's worth reading up on prevention techniques to avoid phishing scams, to help protect yourself in the future.

How to get positive response for GETCHALLENGE request in EMV? [duplicate]

This question already has an answer here:
GETCHALLENGE issue(6D00) in EMV for MasterCard
(1 answer)
Closed 5 years ago.
In the case of GETCHALLENGE Request (0084000000), we are getting the positive response in the case of VISA\DEBIT card, but for AMEX and MASTERCARD we are getting the response as 6D00 (Instruction code not supported or invalid).
Not all instructions are supported by all card products. Different card products also support different transaction types, off the top of my head (so take my answer with a grain of salt) get challenge should online be necessary for offline transactions with asymmetric crypto where the terminal needs to identify itself to the card. It's possible (though not likely nowadays) that the card doesn't have a crypto coprocessor capable of handling this, so that code path is disabled. It's also possible that the MC and Amex EMV scheme specifics require a different transaction flow and you're not fulfilling the prerequisites for get challenge.
Without konw the sequence of commands you're sending to the card and the profile on the card, it's difficult to provide more information than the 6D00 is already providing.

Difference between bug and failure [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I want to ask about the difference between bug and failure and error, i read that the error is mistake made by people, but i conflicted between the difference between the bug and failure. I can't know the difference exactly. Can any one help please and give simple snippet for code represents the difference.
Thanks a lot.
Bug is a programming error - not checking array bounds, ignoring error codes, multiple deletions, memory leaks, etc. fall under this general category. Errors like this require code changes to fix (there may be work-arounds that do not require code changes, though)
Failure is a system error - disconnection of storage, lack of network connectivity, and hardware failures are in this category. Fixing failures usually requires configuring other parts of the system, not the program itself.
User errors are mistakes made by users - entering values incorrectly or providing incomplete data are in this category. Errors like that are fixed by the user who uses the program without anyone else's involvement.
By my definition I would say
An error is about my behavior, or my acting. so I make errors.
A bug is the the result of my error in the program code.
The failure is the malfunction of my buggy software.
but others may interpret this differently.
A fault or Bug is a defect within the system (Somewhere hidden in the code and maybe never detected!).
An error is a deviation of the required operation of the system or subsystem. (The fault detected during execution but no harm).
A failure occurs when the system fails to perform its required function. (System crash)
An Error is a manifestation of a fault in a system, which could lead to system failure.
(Singhal/Shivaratri)
Example:
If you multiply x with 4 instead of 2 in your code, but there is no way to affect any functionalists or is not visible. This is a bug or fault.
If user can see it, let's say with having a wrong text as subject of email, then this is an error but still system worked and no harmful event happened.
But if your system withdraw the wrong money to user in a bank or your robot cut the head of the lady instead of cutting the cake for her then this is a failure :)
Instead of code snippets, I gave your examples below. I hope examples help you to understand the term better.
Bug is a term used among testers to address faults in software.
Error is a value or state or operation that is varies from expected value or state or operation. For example, programmer makes a mistake like missing a semi-colon, calling a wrong function name.
Result from system != Expected Result from system
Fault is a error brought into a system during design or implementation stage that is capable of causing system failure. Imagine some company X gives discount to their loyal customer. Loyal customer is someone who shops 10 times in a month. In software, programmer enter 20 times instead of 10. This is a mistake introduced by programmer called error. then it turned to fault. In tester language, it is a bug.
System failure is an inability of a system to do, what is required of the system. For example, if a user tries to sign up for account in a social networking site if they site fails to register the user. Then, that is system failure.
Technically,
Error -----> Fault -----> Failure
The root cause of any failure is error.