-
Notifications
You must be signed in to change notification settings - Fork 7
Smart contract holding taxes (and fees) #3
Description
Smart contract holding taxes (and fees)
Because there are some drawbacks of coding auto-buying LRC into the protocol, we could still achieve the same goals and more by creating a special contract for handling taxes and/or fees.
It could be beneficial to send the tax to a contract which locks all tokens but implements some functionality which ANYONE can trigger. The Loopring foundation does not control the funds in this smart contract. Anyone willing to pay the gas cost can trigger the behavior coded into the smart contract. LRC holders in particular will be incentivized to pay a bit of gas to ensure the functionality gets executed.
We could even add some governance functionality for LRC holders by letting them decide what to do with these funds. The decision on what to do can be left to the LRC token holders, but anyone can pull the trigger and execute the chosen functionality. This is the only way funds can get out of the contract.
Some examples of what LRC holders could decide to do with some of the taxes:
Example A: LRC buying and burning
Token holders can decide to burn all LRC tokens. It could also be possible to buy LRC using Kyber from non-LRC tokens and burn them.
Example B: Send funds to an external address
Token holders can decide funds are sent to an external address that somehow improves the Loopring ecosystem.
Optional: Send ALL fee payments to this contract to limit the number of token transfers
We could use the same contract to hold ALL fees. Because the fees can be split between multiple addresses it's pretty expensive to do all these token transfers every time. We could send all fees to the contract and do some bookkeeping to ensure the fee recipients can withdraw their part of the fee from this contract whenever they want.
This should save quite some gas. Let's say the fee payments gets split between 3 parties (miner, wallet and tax):
- 3 ERC20 token transfer: ~60.000 gas (at ~20.000 gas / transfer, I think that's about right?)
- 1 ERC20 token transfer to the fee contract + bookkeeping: ~35.000 gas (~20.000 gas for the token transfer to the contract + 3x ~5000 gas to add balances to storage variables for the miner, wallet and taxes).
Decentralized token price updating
The same mechanism of functions that can be executed by anyone can be used to update token prices. Querying the price of tokens every time it's used by the protocol through an oracle is expensive to do. We could allow anyone to update the price in the smart contract by executing a function which queries an oracle (Kyber for example) for the price. Anyone willing to pay the gas cost can trigger the update function. All parties using Loopring will be incentivized to keep the price up to data:
If the price increases the party selling the LRC would be willing to pay the gas cost to get more money for LRC.
- If the price decreases the ones buying the LRC would be willing to spend the gas to get cheaper LRC
- The protocol could use these prices for balancing different fee payment options much cheaper than directly querying an oracle.
The Loopring foundation could guarantee prices are updated at least one time every day until the protocol is more widely used and all parties using the Loopring protocol have a lot to gain that the prices are updated to their current market value.