is it possibel to create a USDC liquidity pool with Solidity? - ethereum

I would like to develop a smart contract that can accept USDC deposits from users into a pool for further downstream activities and give them another token in return so that they can track their balance etc..
Has anyone any exampled/tutorials of something like this I could follow ?

Related

Send ether from one wallet to another with solidity smart contract?

I want to send ether from one walet to another…what technique to use and what is the safest method to do so?
wallet A(msg.sender)=10ether
wallet B=10ether
with the help of smart contract send 'x' ether from A to B.
I tried
where 'x' is the varaible ether at different times.
=>payable().transfer(msg.value);
here i am able to send ether in remix ide where i can provide the msg.value...i want to implement that it is able to change msg.value according to the value of x.
It is not possible to remove ether from someone's wallet on their behalf.
You can do something like this with ERC20 tokens, which have an approve functionality, but there is no API for this with native Ether.
To send ether out of a wallet, the owner of the wallet must sign a transaction specifying they want to send a certain amount of ether to a certain address.
Now, you can sign a transaction, and have someone else broadcast it. This is called relaying. But once you sign a transaction that sends ether from your wallet, you can basically consider the ether gone.
If you need to conditionally take ether from a user, having the user stake the ether in an escrow contract may make more sense.

Is ETH needed for all accounts to support gas fees

I would like to have some enlightment on ERC20 token: If i create a token (let's say MTK ) to be use by a community and i send some of the tokens to each member of the community, does those members have to get ETH in order to use the MTK or they Can use the token whitout the need of having ETH?
I am thinking about using the admin address to get the necessary amount of ETH ( or other ERC20 token compatible crypto currencies) so that if that the that admin account will pay all occuring transactions fees (if needed).Therefore members won't have to deal with ETH and just use the community token.
If it is an ERC20 token on the public mainnet network, someone (else) needs to pay for gas fees executing a transaction, there is no way to circumvent gas costs on L1/mainnet entirely.
What you are looking for are "meta-transactions" or "feeless" transactions: https://ethereum.stackexchange.com/questions/38479/how-to-make-someone-else-pay-for-gas

Transfer ERC20 token without ETH

I would like to transfer ERC20 tokens from a wallet who don't own ETH to another wallet who own ETH and who can pay gas fee.
Do you know if it is possible to made a transfer of ERC20 tokens and to let the receiver wallet pay fees ?
TLDR: Not possible, unless the token contract explicitly allows it. Or unless the token holder is also the block producer.
Transaction fees are paid in ETH (or generally, native currency of the network - for example BNB on Binance Smart Chain, MATIC on Polygon, ...). So in most cases, you need to pay ETH to execute either the transfer() function if you want to send the tokens from your address, or the approve() function if you want someone else to transfer tokens from your address.
Very few token contracts implement delegated transfer mechanism on top of the ERC20 standard. There's currently no standardized way to perform a delegated transfer, so each contract might have a different implementation. The token holder uses their private key to sign a predetermined message saying how many tokens they want to transfer to which address. The message also usually contains a nonce or a timestamp to prevent signature replay attack. Token holder passes the message offchain to the transaction sender, and then the transaction sender executes a function of the token contract built specifically for delegated transfers (note that the transaction sender pays the fee to execute this function). The contract validates the signature, and performs the transfer. Again, most token contracts do not implement this mechanism.
One more exception from the rule is a block producer. When you create a new block, you can fill it with transactions not only from the mempool but also with your own transactions. You can build a transaction with 0 gas price, and then include it in the block that you're producing. This way you're also able to send tokens for free.

How to deposit token-pair in pool (about uniswap code)

I am studying uniswapV2 contract code. And I deployed contracts on ropsten network. then I created a pool by createPool method. I wonder how to deposit tokens in the created pool contract. The created pool is a pair of DAI tokens and UNISWAP tokens. Below is the way I made a pool.
const pool = await FACTORY.methods.createPair(DAI_ADDR, UNI_ADDR).send({from: "0x53D18059f51eB2D1B73b7DA41f971fcF0c45f122"});
return pool address is 0xd6Ca8d671E7e96ED28F67cb196b1056EbDb550d9
here is code repository link.
https://github.com/Uniswap/v2-core
How to deposit a token-pair by contract method? Thanks.
The phrase you're looking for is "add liquidity" (and the opposite action is "remove liquidity"). You deposit the underlying tokens and mint the LP (liquidity provider) tokens representing your stake in the pair contract.
You can provide liquidity through the router's function addLiquidity() (docs).

Is it possible that sell NFT-Token by ERC20 token which is created by me?

I want to create a website for minting my NFT-TOKENS. It seems the websites sell NFT-tokens by minting ETH on Ethereum, Now I would use my token(ERC20) instead of ETH. Is it possible?
You can sell your NFT tokens for your ERC 20 tokens, but you will still need ETH to perform transactions on the network.