Git Product home page Git Product logo

Comments (3)

drlecks avatar drlecks commented on August 11, 2024

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.

webnatrix avatar webnatrix commented on August 11, 2024

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.

drlecks avatar drlecks commented on August 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.