tornado-instances/NOTE.md

2.1 KiB

InstanceProposer.sol and InstanceAdditionProposal.sol have been rewritten/added. The difference in logic is basically the following:

Old

The old proposal creator could create a multiple denomination addition proposal for only one token address. Ignoring all the dumb stuff like creation fees and parameters, the logic in InstanceProposalCreator.sol at line 129 had an issue where the protocol fee would not be checked if a Uniswap Pool instance was found beforehand.

After above checks this new Proposal would be created, but this new Proposal only supported addition of 4 denominations which is limiting, in my opinion. Meaning one token, 4 denominations.

New

With the new InstanceProposer.sol, a user can create as far as gas allows any amount of any token instances of any denomination as long as they fulfill the criteria specified in the contract.

Most importantly the user MUST specify a variable which represents the exponent of the number 10 taken to this exponent (10 ** exponent), because we will be packing the data and need to reduce the size of it to be able to fit all of the data for one instance into one struct (denomination / (10 ** exponent)).

This means that for a token, a user will choose a minimal denomination (with some assisted tooling, automatically, so they won't really be choosing it), and then the length of the trailing zeros is the value of the exponent which we are using. The denomination must be lower than uint40. This means that there is a 12 decimals window for the denominations. This means that the denominations can maximally look as such if we take a 4 instances example:

[1000000000000, 1000000000, 1000000, 1000]

Or to be more precise an example which covers the entire range in a 5 instance example:

[1099511627775, 1000000000, 1000000, 1000, 1]

As of yet, most important instances have varied their denominations by a factor of 10, so a factor of 1000 seems fine, especially when the only thing required is another proposal to add additional instances.

In any case the function is understandable enough for a user to enter it over etherscan, although it might be tedious.