hyperledger-labs / blockchain-carbon-accounting

This project implements blockchain applications for climate action and accounting, including emissions calculations, carbon trading, and validation of climate claims. It is part of the Linux Foundation's Hyperledger Climate Action and Accounting SIG.
https://wiki.hyperledger.org/display/CASIG/Carbon+Accounting+and+Certification+WG
Apache License 2.0
188 stars 102 forks source link

Move requires/modifiers of net-emissions-token-network transfer() to safeTransferFrom #378

Open brioux opened 2 years ago

brioux commented 2 years ago

https://github.com/hyperledger-labs/blockchain-carbon-accounting/blob/1c5bc0aced65f24fd1befd133700c0c82a85d8d4/net-emissions-token-network/contracts/NetEmissionsTokenNetwork.sol#L593

We should move the require statements/modifiers in the transfer() function to the _beforeTokenTransfer() hook. This will ensure they are not skipped by users directly calling safeTransferFrom() or safeBatchTransferFrom().

Note: I have prepared a fix for this that will be implemented in a PR that introduces a new carbon token for Issue 372

sichen1234 commented 2 years ago

Sure that sounds good.

Si Chen Open Source Strategies, Inc.

Please give me your feedback on my e-book Open Climate Investing https://climate-investing-book.opensourcestrategies.com/v/main/book

On Wed, Dec 29, 2021 at 7:45 AM Bertrand Rioux @.***> wrote:

https://github.com/hyperledger-labs/blockchain-carbon-accounting/blob/1c5bc0aced65f24fd1befd133700c0c82a85d8d4/net-emissions-token-network/contracts/NetEmissionsTokenNetwork.sol#L593

We should move the require statements/modifiers in the transfer() function to the _beforeTokenTransfer() hook. This will ensure they are not skipped by users directly calling safeTransferFrom() or safeBatchTransferFrom().

Note I have prepared a fix for this that will be implemented in a PR that introduces a new carbon token in response to Issue 372 https://github.com/hyperledger-labs/blockchain-carbon-accounting/issues/372

— Reply to this email directly, view it on GitHub https://github.com/hyperledger-labs/blockchain-carbon-accounting/issues/378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANAS4NMNBP7AEMKTFK7LQ3UTMUIBANCNFSM5K6FM5BA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>