Solidity How to implement fees when we buy or sell token from pancakeswap - ethereum

I wouldike to know how can I implement 4% of fees when I sell or buy from Pancakeswap ?

PancakeSwap itself implements its fee schedule. Note that tokens can trade on multiple Uniswap v2 compatible exchanges outside PancakeSwap.
To have your own market, with your own rules, you need to start your own exchange.
You can in theory try to hack special fees into your token smart contract code, but none of the past attempts have been successful and/or they all have been scams.

Related

Is there a way to verify that is possible to sell token?

Is there a way to verify that it is possible to sell a token?
There are a lot of honeypots, so you can buy a token, but then you will be not able to sell it.
I have found that there is a possibility to estimate gas for the swap transaction e.g. on the Uniswap, but in this solution, there are some conditions. The token has to be approved and you have to own some number of the token, so it could be expensive. Do you know any other method to verify that? For example, interacting with the token contract?
Example contract: https://etherscan.io/address/0x419d0d8bdd9af5e606ae2232ed285aff190e711b#readContract
There are also tokens with 100% sell fee, but it is not easy to define the contract internal fee (there is not one method to do that).

Understanding the sales fee for NFT erc721 secondary transaction

I am developing a solidity contract to upload Ethereum-based erc721 NFT to opensea.
As a result, there is a way to create a collection in opensea and charge a secondary fee.
Also, I know that there is a way to configure eip-2981 by combining it with erc721.
I am trying to minting using erc721A and minting to buyers through the minting page. Do I have to write a contract with eip-2981 because OpenC is not making a collection? Even after reading articles on the web, I don't quite understand which method to use and why. I wish someone could sort it out.
Your collection will not show up on OS until at least 1 NFT has been minted. I would recommend testing this out on their test site using the Rinkeby network. Also to answer your main question, secondary sales goes something like this:
You as the collection owner can choose how much of a fee you would like to charge up to 10%. You must also know that OS takes 2.5% off the top of any sale regardless as well. So say someone wanted to sell their NFT for 1 ETH, and the collection royalty was set to 10%. When that NFT sells, the collection owner would get 0.1 ETH and OS would take 0.025 ETH. The total royalties collected would be 0.125 and the seller would receive 0.875 ETH.

Solidity : question about ERC20 token creation and pre sales (crowdsales)

I'm working on a new project that I'm launching soon. The dapp is almost ok, I'm writing the contracts.
But I'm not sure I understood everything, if someone can help me :(
I would like to create a token contract with a supply fix (like 1 million), then make two pre-sales (one with and without whitelist), then a contract to sell on DEX with rewards, staking system, etc.
What is the best way to do this?
Is it possible to :
create the tokens with the first contract
transfer them to the pre sale whitelist contract
make the pre-sale
transfer the remaining tokens to the pre-sale contract without withelist
make the pre-sale
transfer the remaining tokens on the last contract, which will manage all the features of my token + put on a dex
am I right in the way I do it or am I completely wrong ?
If I'm wrong, do I have to do everything in one contract, with specific functions and flags like for the beginning and the end of a pre-dirty ?
if I do everything in one, will some smart guy be able to put the contract on a DEX and add liquidity?
I looked for several ohm/nodes project contracts, I saw the pre-sale contracts but I didn't understand when they create the token because their pre-sale contracts are just sell contracts
and I didn't understand how after the pre sale the main contract takes over
i would like a final contract like that, once the sales are finish
https://snowtrace.io/address/0xf2cfc11093edb5a2dc7f49e70a3a3a9cd4f4fee4#code
if someone can help me, thanks :)
ps : last question, in the contract i dont understand what are payees, shares, addresses and balances variables
This question covers a few different things so I'm going to split my answer up.
Answers:
I looked for several ohm/nodes project contracts, I saw the pre-sale contracts but I didn't understand when they create the token because their pre-sale contracts are just sell contracts
Presale contracts by nature are selling contracts the token contract and the presale contract are generally not the same but there are a thousand ways to do that. They receive x amount of tokens and take payment in say ETH for x tokens.
if I do everything in one, will some smart guy be able to put the contract on a DEX and add liquidity?
Anybody will pretty much always be able to add liquidity for a token because that is external to the token but there are certain ways you can prevent adding liquidity until a certain condition is met say a certain timestamp you just need to detect operations that are swaps/adding liquidity and throw an error.
ps: last question, in the contract I don't understand what are payees, shares, addresses, and balances variables
I am not entirely sure what the purpose of these are for because I am not very familiar with the BRIG protocol.
and I didn't understand how after the pre-sale the main contract takes over
The main contract does not need to take over from the presale contract because the presale contract just runs until all of the tokens are sold and then it just becomes an empty husk.
Other stuff:
In the future please split up your questions across multiple StackOverflow posts.

Why transactions inside binance are not visible on the ethereum network

How then does the purchase take place and how does the purchase and sale of tokens on binance affect token prices and how?
Binance holds some amount of each token traded on their site, and manages the user balances and trades in their own orderbook and databases.
Only when someone withdraws the tokens from the site, Binance performs the withdrawal from one of their addresses, which is recorded on the blockchain. Same goes the other way around for token deposits.
Note: This post is valid for the widely-used Binance (centralized) exchange. There's also Binance DEX that uses the Binance Chain (predecessor of the currently widely used Binance Smart Chain) to manage all orders and trades.

How to show withdraw payment amount in MetaMask?

I'm using OpenZeppelin's PullPayment to handle payouts from my eth smart contracts. While withdrawing the coins with MetaMask, MetaMask shows 0 ETH when withdrawing for instance 2 ETH:
Is it possible for the payout amount to appear in MetaMask?
It is not possible, due to the design of MetaMask. There are a couple of ERCs to show human-readable transaction data fields, but as far as I know none of them have been adopted yet.