web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.16k stars 543 forks source link

How to use increaseAllowance from ERC20 #260

Open carlosalbertocruz opened 2 years ago

carlosalbertocruz commented 2 years ago

My code

$response = null; $this->contract->at( env('CONTRACT_ADDRESS') )->call('increaseAllowance', env('EARN_ADDRESS'), $amount, [ 'owner' => $toAddress, 'spender' => env('EARN_ADDRESS'), 'addedValue' => $amount, ], function($err, $success) use (&$response) { if ( $err !== null ){ return $response = array ( 'status' => false, 'error' => $err->getMessage() ); } return $response = array( 'status' => $success[0] ); } ); return $response;

My smact contract function: https://ibb.co/vwNQFmm