Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm sorry, did you test it at all? #1

Open
CryptoPayFood opened this issue Jan 22, 2023 · 7 comments
Open

I'm sorry, did you test it at all? #1

CryptoPayFood opened this issue Jan 22, 2023 · 7 comments

Comments

@CryptoPayFood
Copy link

You must have a mistake somewhere.
If the value is 1 or more when you dipit, there will be an error.
And if the value is 0, then you just can't deposit coins

@shortdoom
Copy link
Owner

shortdoom commented Jan 22, 2023

Nope, this project was just a mock and there never was a plan to make it into production ready code. There's only a simulation script running against forked state which checks for sucessfull execution with deposit/fund. You can deposit and fund fine.

image

@CryptoPayFood
Copy link
Author

CryptoPayFood commented Jan 23, 2023

I'm sorry I misinterpreted the error.
The mistake is that a person must first allow a contract such as ETH to spend his money to that contract.

This can only be done personally by the person through the ETH contract.
It won't go through the transaction if you don't do this.

If you don't do this, the contract will give an error in the gas calculation and the amount of gas will be high,
If you specify a small amount of gas yourself and execute the transaction, then the commission for debiting ETH will not pass and the stabel coin will be credited.

@CryptoPayFood
Copy link
Author

More precisely, the eth coin will not be credited, but your contract coins will be credited.

@CryptoPayFood
Copy link
Author

I tested on the BSC network, but they are the same.
Both there and there for external coin entry. confirmation for coin withdrawal must be done personally by the wallet on the contract of that coin.

@CryptoPayFood
Copy link
Author

The only thing that happens in tranzation is that it allows you to spend coins that are on the contract, not on a person's wallet.

@CryptoPayFood
Copy link
Author

he problem with sending ERC-20 to any contract is that the contract is not aware of that transaction. There's no function that's called when the tokens are received, so it's not possible to assign that balance to a specific sender. This is why things like decentralised exchanges use approve and transferFrom. In this case a contract can transfer user's tokens itself, in which case it knows that the user has that number of tokens.

More recent token standards like ERC-721 (non-fungible tokens), and ERC-777 solve this problem with hooks. An ERC-777 token contract for example calls the receiving contract before the tokens are sent. If the receiving contract does not implement the token receiver hook, the transaction is reverted. This way it's possible to: 1) assign a token balance to a user on transfer and 2) prevent tokens being sent to a contract that does not support it.

@CryptoPayFood
Copy link
Author

i.e. before sending ERC-20 coins to the contract the person has to do it himself:
( your contract )
amount ( the amount he will transfer)

and only after that transferFrom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants