Giter VIP home page Giter VIP logo

Comments (3)

ericyzhu avatar ericyzhu commented on September 25, 2024

假设我有一个代币合约,其中有一个用来转移代币的 transfer 方法,它接受两个参数(接收方地址,代币数量)

transfer(address to, uint256 amount);

先添加合约:

$client->contracts
    ->add(
        // 为该合约自定义的别名
        'MyToken',
        // 合约地址
        '0x98a50658e10679147e92e58371788586b67f896f',
        // ABI
        '[...略...{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},...略...]'
    );

然后调用 MyToken 的 transfer 方法向 0x971de58a3b6661aea148e66d806c22399436dd09 转移 1000 个代币:

$transactionHash = $client->contracts->MyToken->call('transfer', '0x971de58a3b6661aea148e66d806c22399436dd09', 1000);

from ethereum-php.

jianhuihi avatar jianhuihi commented on September 25, 2024

方便加你个人联系方式吗

from ethereum-php.

ericyzhu avatar ericyzhu commented on September 25, 2024

Q:100110282

from ethereum-php.

Related Issues (6)

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.