-
Notifications
You must be signed in to change notification settings - Fork 11.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ERC20 minting from owner signature #983
Conversation
Looks like I missed the broken RBACMintableToken tests, I was only running |
Do you think it'd be better to abstract the minting signature logic using the pattern in #950 ? that way anyone with the minter permission could mint tokens, and if that happens to be a signature bouncer, that's cool too. also, for usedSignatures, I was able to get the same behavior down to storing a single nonce per-address; you can see how it's used in the |
Hey @shrugs thanks for the review π Concerning the usage of SignatureBouncer/RBAC, I thought about it, but I didn't want to change the way MintableToken worked. For the nonce, I agree it should be a little more efficient, but I don't know about using NonceTracker it seems relatively complex when I could simply do something like: require(_nonce == usedNonce[_to].add(1));
...
usedNonce[_to] = _nonce.add(1); This seems more optimized, what do you think? |
I'm down to keep it as I do think the minting signature logic should either be composed or inherited with the Actually, this is basically an Airdrop, but checked by signature bouncer (and now I'm remembering that we talked about this in #928), so it should definitely be abstracted from the token itself. I'd much prefer a composable approach like we've structured the crowdsales. So we can have different access-control layers:
And different emission layers:
|
e46c4f1
to
517988e
Compare
Updated. What do you think about this version @shrugs ? |
β¦ssage by the owner
You can replace most of the code in the Airdropper contract with
|
If you want multiple signers sure. If you want a single one, you end up paying higher deployment cost and a gas premium on every single minting. |
aye, but you're only storing one role, the delegate role for whomever is issuing the signatures. I'd expect that it's negligible, but I suppose it'd be worth profiling. I'll do a test |
For deploying, my airdrop using Bouncer costs 1555981 and this contract costs 1011145, a difference of 544k gas. For minting, there's a 10k gas difference probably due to the extra if condition in Bouncer that supports contract delegates. So deployment does have non-negligible gas costs if you inherit directly from Bouncer, although its hard to tell exactly where that gas cost is coming from. |
That said, I'm not convinced that duplicating code here, as opposed to following an existing pattern and library designed for this feature is a great idea for OZ itself. It could definitely make sense for a specific project, though, but once you start caring about $2 in deployment costs, you should have the bandwidth to build your own minimal bouncer-style contract. |
this is what ERC20Airdrop looks like, by the way: https://github.com/Shrugs/zeppelin-solidity/blob/feat%2Fairdrops/contracts/airdrop/ERC20/ERC20Airdrop.sol |
Thanks for taking the time! but if we replace this contract by your example I would argue this is probably not a great fit for the library directly either, maybe as an example of possibilities (like we were discussing about Maybe creating a Now that being said let's try to put some perspective on this and future possibilities and let me know if this makes any sense to you:
Or maybe that just too much speculation? π€ |
I pushed some updates to the #1024 branch, adding
let me know if that's what you were expecting |
closing in favor of tracking via #1272 |
π Description
This allows minting from any address as long as they have a valid signed message from the owner.
We discussed adding something like this with @shrugs in #928
npm run lint:all:fix
).