Closed sichen1234 closed 3 years ago
There is now a private var limitedMode (that only the deployer/admin can toggle through the setLimitedMode() function) that will enable these features. It is set by default to false.
Currently implemented:
Still working on:
Created hook called before transfers: https://github.com/opentaps/blockchain-carbon-accounting/commit/ee5b34cf8824de272dc4ab9dbc6a3e624433de08
If to address is not the admin and limitedMode is on, then the tokens being sent will be retired -- preventing the transfer. More testing required.
More tests added to test limited functionality. Instead of retiring tokens after the initial issuance, all transfers except those executed by the admin account are prevented when limitedMode = true.
Can you change some of these error messages:
Also please check toggling the limited mode on and off. I could turn it on but not off.
These work:
Need to fix:
Updated in commit https://github.com/opentaps/blockchain-carbon-accounting/commit/6f161dab45c0049a125f4cf97e6517d2746d43e
Retiring in limitedMode works now, though it cannot be done automatically after arbitrary transfers with the current design as we use the hook function _beforeTokenTransfer() the ERC-1155 standard provides us. This function is called before minting new tokens, burning tokens, and transferring tokens, and in limited mode it will check to make sure only the admin can transfer tokens, only the DAO can issue token types 1 and 2, only audited emissions dealers can issue tokens directly, and only dealers of type 1 and 2 can make DAO proposals.
Great. This all works well now. Thank you!
The open source code can stay as it is for testing/demonstration but for net emissions tokens network in production deployment, to avoid creating a security, we can make these changes (as settings or as a fork):