OpenZeppelin / cairo-contracts

OpenZeppelin Contracts written in Cairo for Starknet, a decentralized ZK Rollup
https://docs.openzeppelin.com/contracts-cairo
MIT License
797 stars 322 forks source link

Remove non-standard increase_allowance and decrease_allowance from ERC20 #881

Closed TAdev0 closed 4 months ago

TAdev0 commented 5 months ago

Fixes #728

This PR removes increase_allowance and decrease_allowance functions in ERC20 contracts (token and mocks)

PR Checklist

TAdev0 commented 5 months ago

@martriay oh yes I still need to modify the doc , I forgot to do it. Same for the other PR.

TAdev0 commented 5 months ago

@martriay now it should be good :)

martriay commented 5 months ago

Thanks! Please complete all items in the PR checklist.

TAdev0 commented 5 months ago

@martriay am i suppose to ''try the feature'' on a public network? If yes what should i do exactly?

martriay commented 5 months ago

Since this is a feature removal PR, we need to deploy the ERC20 preset and verify:

Note that this PR modifies a preset, so we need to update the class hashes as indicated in the CONTRIBUTING guide.

TAdev0 commented 5 months ago

Thank very much for all explanations 🙏

TAdev0 commented 5 months ago

@martriay

Class hash: 0x7c9b5a246fe83b0cd81de65daddb94b3803f94950db99bf2431bbfecf284642

ERC20 preset deployed on Goerli at: 0x1ceea6ba0ad2015c13cdca03185f615127523d8ece2293975354163479db3e9

If you try to run, for example :

sncast --url https://free-rpc.nethermind.io/goerli-juno --account [your_account] --contract-address 0x1ceea6ba0ad2015c13cdca03185f615127523d8ece2293975354163479db3e9 --function "increase_allowance" --calldata 0x0 0x1 0x0

You will get the following error:

command: invoke
error: Transaction execution error = TransactionExecutionErrorData { transaction_index: 0, execution_error: "reverted: Error in the called contract (0x039ccf2f422488ac967891266df98cbf293e6dcafe6cf42ba603d2821fd9e247):\nError at pc=0:81:\nGot an exception while executing a hint: Custom Hint Error: Entry point EntryPointSelector(StarkFelt(\"0x01d13ab0a76d7407b1d5faccd4b3d8a9efe42f3d3c21766431d4fafb30f45bd4\")) not found in contract.\nCairo traceback (most recent call last):\nUnknown location (pc=0:731)\nUnknown location (pc=0:677)\nUnknown location (pc=0:291)\nUnknown location (pc=0:314)\n" }

This means `increase_allowance' entrypoint doesn't exist anymore.

Same applies for

sncast --url https://free-rpc.nethermind.io/goerli-juno --account [your_account] --contract-address 0x1ceea6ba0ad2015c13cdca03185f615127523d8ece2293975354163479db3e9 --function "decrease_allowance" --calldata 0x0 0x0 0x0
error: Transaction execution error = TransactionExecutionErrorData { transaction_index: 0, execution_error: "reverted: Error in the called contract (0x039ccf2f422488ac967891266df98cbf293e6dcafe6cf42ba603d2821fd9e247):\nError at pc=0:81:\nGot an exception while executing a hint: Custom Hint Error: Entry point EntryPointSelector(StarkFelt(\"0x03b076186c19fe96221e4dfacd40c519f612eae02e0555e4e115a2a6cf2f1c1f\")) not found in contract.\nCairo traceback (most recent call last):\nUnknown location (pc=0:731)\nUnknown location (pc=0:677)\nUnknown location (pc=0:291)\nUnknown location (pc=0:314)\n" }
TAdev0 commented 5 months ago

@andrew-fleming PR updated, now it should be good!

TAdev0 commented 4 months ago

@martriay docs updated!

martriay commented 4 months ago

@TAdev0 please fix the merge conflicts and this is good to go.

TAdev0 commented 4 months ago

@martriay now it should be good!

martriay commented 4 months ago

Thanks!