0xProject / 0x-monorepo

0x protocol monorepo - includes our smart contracts and many developer tools
Other
1.41k stars 466 forks source link

[WIP] add protocol fees fixin #2736

Closed smarx closed 3 years ago

smarx commented 3 years ago

Description

This change adds FixinProtocolFees, code that collects protocol fees using per-pool FeeCollector contracts. Once per epoch, a function on each FeeCollector is called to transfer the held ether (first converted to WETH) to the staking contract. Delaying this transfer and associated accounting yields significant gas savings.

Testing instructions

yarn build && yarn test in contracts/zero-ex.

The basic happy path with WETH is tested, but all other tests are missing. Future commits will add more robust testing, including negative testing for failure modes.

Types of changes

Checklist: