Comments (3)
Hi!
Sorry but I don't speak Russian and it looks like Google translate did a poor job. But I'll leave here some ideas I think I undestood.
BEP20 is just a Binance (BSC) extension of ERC20 , so all the standard should be available. To transfer tokens from one address to another, you simply have to use the SWeb3_Contract::send()
function. There are some examples of send operations on the Example/example.send.php
script.
The ERC20 contract has some singularities as tokens are owned by addresses. So a "signer" can only transfer tokens from him to another address (Yes, you can approve 3rd parties, but that's another chapter).
I'll publish a full example featuring most common interaction in ERC20 contracts at Example/example.erc20.php
.
I hope this resolves your problems!
BTW, gitter may be more appropiate fot this type of questions: https://gitter.im/Simple-Web3-Php/community
from simple-web3-php.
Thanks, I sort of figured it out. Is it possible to make 1 transaction so that the commission is transferred from wallet 1 to wallet 2. And ERC20 is transferred from wallet 2?
from simple-web3-php.
If I got your problem, you want to make a transaction where (for example) you send 2 BNB to a contract, and the contract gives back to the sender 2 tokens. Something like a pair-token?
What you ask for should be done in the contract logic (Solidity) in order to be done in just one transaction, and to make sure all the process is atomic. You can do that extending the regular ERC20 or making a contract that can interact with ERC20 contracts externally (that would be my choice). Then, you would only need to call your new function, as it's done in the example.erc20.php script.
In another repository I have a "sale" contract with similar features. Check buyTokens()
there. Alert: It's a pretty old and outdated script and it's missing some basic features, but works as example.
This being said, If you are making a service, I would place all the actions triggered by the user on the client side (browser/javascript). So you don't need to hold, send nor receive any personal data like the private key.
from simple-web3-php.
Related Issues (19)
- Error on hex BN convert HOT 5
- 合约解析 数组元组模式出现错误 HOT 3
- 请问有 使用 eth.subscribe的方法吗? HOT 1
- null result from $sweb3->getTransactionReceipt($txHash);
- ERROR: estimateGas error: execution reverted: Ownable: caller is not an owner HOT 3
- error when call $result = $sweb3->send($sendParams); HOT 1
- countryBlocked! HOT 1
- Send array parameters HOT 1
- Attemps to read property "inputs" on null HOT 2
- \drlecks\simple-web3-php\Core\ABI.php:272 Error type HOT 6
- Tuple compilation data is not the same HOT 1
- Call to a member function toHex() on array HOT 11
- Signature is not correct for a complex contract HOT 2
- hello from somewhere in the world HOT 1
- [Conflicts] Can't install via composer require HOT 1
- Get Balance HOT 5
- How to estimate gas for contract method call HOT 1
- Add custom convert value HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-web3-php.