Comments (1)
The behavior you describe here is intentional. Any minting, including in the constructor, must call the tokensReceived
hook of the recipient if it is a contract.
Solutions 1 & 2 break the standard.
Solution 3 is what you want. If the recipient is the contract itself, in the constructor before the minting you have to register the token contract as a TokensRecipient
via the ERC1820 registry.
However depending on your use-case you might want to avoid pre-minting tokens. A better alternative could be to mint tokens using signed messages and provide those sign messages to users such that they can mint their own tokens. You could also have a whitelist of addresses each allowed to mint either a fixed amount of tokens or a variable amount of tokens based on how many ether they send, and using a fixed rate.
from erc777.
Related Issues (20)
- Add delegate & authorizer feature HOT 1
- Mint function calls `callRecipient` while burn doesn't HOT 1
- Implement `revokeAllOperators` HOT 3
- Add code coverage for the reference implementation HOT 5
- Organise and add more tests HOT 1
- Add Docs for the Reference Token
- Include the compiled solidity code in the npm package HOT 1
- Should truffle be moved into dev-dependencies? HOT 1
- Grant permission to Open Zeppelin to release derivative implementation on MIT license HOT 1
- Inconsistency with the standard for `operatorSend` and `operatorBurn` HOT 1
- Inconsistency with the standard for `burn` and `operatorBurn` HOT 1
- `event Minted` not updated in the reference implementation HOT 1
- burn does not call tokensToSend before decrementing the balance HOT 1
- burn does not call tokensToSend before state update
- Use pragma solidity ^ HOT 1
- how i can compile this project? HOT 3
- removed gas loops, does not deploy due "This contract does not implement all functions and thus cannot be created." HOT 4
- Update references to EIP 820 to EIP 1820. HOT 1
- Is ERC777 vulnerable from short address attack? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erc777.