# Smart Treasury - Peer Review

**URL:** <https://gov.pareto.credit/t/smart-treasury-peer-review/193>\
**Category:** 📑 Formal Proposals\
**Created:** [January 19, 2021, 3:32pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193 "2021-01-19T15:32:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![8bitporkchop](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/8bitporkchop/32/24_2.png) [@8bitporkchop](https://gov.pareto.credit/u/8bitporkchop)\
**Post date:** [January 19, 2021, 3:32pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/1 "2021-01-19T15:32:57Z")

</div>

# Peer Review

Hi All,

The snapshot vote for an audit vs peer review has closed with peer review having ~72% of the vote. [Snapshot vote](https://snapshot.page/#/idlefinance.eth/proposal/QmZmhFPUqjAriF5YESmsitQbZhDRxABqQTjAYvkPK3ky1H)

With the vote out of the way, I would now like to invite members from the community to review the github repo [[[here]]](https://github.com/AsafSilman/idle-smart-treasury).

The code has been internally reviewed by @gravityblast and @william .

As a high level overview to reviewers, there are two contracts which have been developed for the smart treasury

1. Bootstrap contract - `SmartTreasuryBootstrap.sol`
2. FeeCollector contract - `FeeCollector.sol`

The purpose of the boostrap contract is to correctly configure the smart treasury with the parameters agreed upon by governance, and to deposit the correct amount of IDLE and WETH into the initial pool.

The purpose of the fee collector is to route fees which are generated by the IDLE protocol into WETH and send it to the smart treasury, and the fee treasury based on an allocation parameter. In the future, more accounts can be added to this list (such as the community treasury etc).

The initial configuration of the smart treasury is probably the most technical part of the contract, and the deployment is summarised here. Post reference: [Progress Update 1](https://gov.pareto.credit/t/update-smart-treasury-progress-update/145)

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/idle/original/1X/8de4e9910a4c61c64b49322acb12c856cb55c60d.png)

Once the smart treasury is created, the address must be set in the fee collector. After which

More details on the proposal spec can be found here [Progress Update 2](https://gov.pareto.credit/t/update-smart-treasury-propsal-code-review/179)

The repo has unit tests and integration tests which are located under the `tests/` directory. The steps to replicate the full end-end proposal process is under `migrations/`

In order to run the tests, a local ganache main-net fork may need to be run with further instructions on the README.

The peer-review will close on 2021-01-24T00:00:00Z. After which (If there are no outstanding issues) I will proceed with the IIP.

@emilianobonassi @endymionjkb @Fernando @MickdeGraaf

Thanks,  
Asaf

---

<div class="post-metadata">

**Author:** ![unicorn](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/unicorn/32/48_2.png) [@unicorn](https://gov.pareto.credit/u/unicorn)\
**Post date:** [January 19, 2021, 3:45pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/2 "2021-01-19T15:45:12Z")

</div>

Fantastic job @8bitporkchop !  
Impressive!

---

<div class="post-metadata">

**Author:** ![william](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/william/32/10_2.png) [@william](https://gov.pareto.credit/u/william)\
**Post date:** [January 19, 2021, 4:45pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/3 "2021-01-19T16:45:19Z")

</div>

Amazing job @8bitporkchop !

I think we can structure the peer review in the same way we structured the ‘internal’ review so each reviewer should open up one issue with his findings in the public github repo and we can then discuss most of the code related things there

---

<div class="post-metadata">

**Author:** ![gravityblast](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/gravityblast/32/83_2.png) [@gravityblast](https://gov.pareto.credit/u/gravityblast)\
**Post date:** [January 19, 2021, 9:24pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/4 "2021-01-19T21:24:06Z")

</div>

great job @8bitporkchop !

---

<div class="post-metadata">

**Author:** ![Fernando](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/fernando/32/306_2.png) [@Fernando](https://gov.pareto.credit/u/Fernando)\
**Post date:** [January 20, 2021, 3:12pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/5 "2021-01-20T15:12:58Z")

</div>

Thanks @8bitporkchop ! I asked @endymionjkb to prioritize this and though he’s extremely busy he already reviewed it!

Cheers and looking forward to seeing this live =)

---

<div class="post-metadata">

**Author:** ![patitonar](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/patitonar/32/140_2.png) [@patitonar](https://gov.pareto.credit/u/patitonar)\
**Post date:** [January 20, 2021, 11:01pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/6 "2021-01-20T23:01:17Z")

</div>

Hi everyone, I’m just a random user and solidity dev. I started taking a look at the contracts. I just created one issue with some gas optimization on the state variables [Use immutable keyword for state variables only set in constructor · Issue #8 · AsafSilman/idle-smart-treasury · GitHub](https://github.com/AsafSilman/idle-smart-treasury/issues/8)

---

<div class="post-metadata">

**Author:** ![idal](https://avatars.discourse-cdn.com/v4/letter/i/ba8739/32.png) [@idal](https://gov.pareto.credit/u/idal)\
**Post date:** [January 20, 2021, 11:27pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/7 "2021-01-20T23:27:42Z")

</div>

Hey @8bitporkchop, congratulations on all the progress 🎉

I’ve had a quick look at the repo and commit history, but couldn’t tell whether you’ve already ran it through static analyzers like slither and mythril. If not - could be a cheap way to get some extra review by bots.

---

<div class="post-metadata">

**Author:** ![8bitporkchop](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/8bitporkchop/32/24_2.png) [@8bitporkchop](https://gov.pareto.credit/u/8bitporkchop)\
**Post date:** [January 21, 2021, 1:24am UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/8 "2021-01-21T01:24:15Z")

</div>

Thank you @patitonar, this is very useful information, thank you for your input 😃 I have updated the code with your recommendations.

---

<div class="post-metadata">

**Author:** ![8bitporkchop](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/8bitporkchop/32/24_2.png) [@8bitporkchop](https://gov.pareto.credit/u/8bitporkchop)\
**Post date:** [January 21, 2021, 1:24am UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/9 "2021-01-21T01:24:39Z")

</div>

I haven’t yet, this sounds like a good idea

---

<div class="post-metadata">

**Author:** ![Davide](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/davide/32/3_2.png) [@Davide](https://gov.pareto.credit/u/Davide)\
**Post date:** [January 21, 2021, 10:20am UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/10 "2021-01-21T10:20:39Z")

</div>

Hey @patitonar, thanks for sharing those inputs with us!  
We are glad to receive more feedback on the Smart Treasury.

As mentioned in the [discussion](https://gov.pareto.credit/t/update-smart-treasury-propsal-code-review/179/3), the Treasury Committee should tip volunteers for their efforts 🙂

---

<div class="post-metadata">

**Author:** ![emilianobonassi](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/emilianobonassi/32/134_2.png) [@emilianobonassi](https://gov.pareto.credit/u/emilianobonassi)\
**Post date:** [January 23, 2021, 6:15pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/11 "2021-01-23T18:15:50Z")

</div>

Great job @8bitporkchop !

Taking a look and provide my feedback shortly.

---

<div class="post-metadata">

**Author:** ![patitonar](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/patitonar/32/140_2.png) [@patitonar](https://gov.pareto.credit/u/patitonar)\
**Post date:** [January 23, 2021, 8:01pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/12 "2021-01-23T20:01:33Z")

</div>

Thanks for the warm welcome! I created this new issue with more notes from my review [Minor improvements from review · Issue #10 · AsafSilman/idle-smart-treasury · GitHub](https://github.com/AsafSilman/idle-smart-treasury/issues/10)

---

<div class="post-metadata">

**Author:** ![emilianobonassi](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/emilianobonassi/32/134_2.png) [@emilianobonassi](https://gov.pareto.credit/u/emilianobonassi)\
**Post date:** [January 23, 2021, 11:05pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/13 "2021-01-23T23:05:46Z")

</div>

I’ve created too this new issue for my review

> <https://github.com/AsafSilman/idle-smart-treasury/issues/11>
>
> Thank you @AsafSilman for the time dedicated to this important contribution for IdleFinance!
> Overall the code is good, SmartTreasuryBootstrap has good quality...

Thanks again for your contribution @8bitporkchop !

---

<div class="post-metadata">

**Author:** ![MickdeGraaf](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/mickdegraaf/32/133_2.png) [@MickdeGraaf](https://gov.pareto.credit/u/MickdeGraaf)\
**Post date:** [January 23, 2021, 11:11pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/14 "2021-01-23T23:11:33Z")

</div>

Edit: Converted into issue.

Well done! Although I’m no auditor I would be comfortable in having funds in these contracts.

> <https://github.com/AsafSilman/idle-smart-treasury/issues/12>
>
> The contracts look good, some small points:
> FeeCollector
> Unneeded functions for adding from and to the whitelist
> Since the FeeCollector uses the AccesControl contract...

---

<div class="post-metadata">

**Author:** ![8bitporkchop](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/8bitporkchop/32/24_2.png) [@8bitporkchop](https://gov.pareto.credit/u/8bitporkchop)\
**Post date:** [January 23, 2021, 11:25pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/15 "2021-01-23T23:25:31Z")

</div>

Thank you @MickdeGraaf a GitHub issue will be super handy. Thanks for your time to review 😄

---

<div class="post-metadata">

**Author:** ![8bitporkchop](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/8bitporkchop/32/24_2.png) [@8bitporkchop](https://gov.pareto.credit/u/8bitporkchop)\
**Post date:** [January 23, 2021, 11:26pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/16 "2021-01-23T23:26:43Z")

</div>

Thank you @emilianobonassi , I will be going through your recommendations thoroughly. Thank you for your time to review 😃

---

<div class="post-metadata">

**Author:** ![8bitporkchop](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/8bitporkchop/32/24_2.png) [@8bitporkchop](https://gov.pareto.credit/u/8bitporkchop)\
**Post date:** [January 23, 2021, 11:28pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/17 "2021-01-23T23:28:23Z")

</div>

Thanks @patitonar , glad to have you as part of the community 🚀

---

<div class="post-metadata">

**Author:** ![8bitporkchop](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/8bitporkchop/32/24_2.png) [@8bitporkchop](https://gov.pareto.credit/u/8bitporkchop)\
**Post date:** [January 24, 2021, 3:16pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/18 "2021-01-24T15:16:19Z")

</div>

Hi All,

I’ve gone through each issue from the github by members of the community with the commit at [7cb28e](https://github.com/AsafSilman/idle-smart-treasury/commit/7cb28e9bc7bdae444e77abfa6ec0fd9bf2c898f4) being the most up-to date version of the code. Please review the comments on the relevant issue. I will be extending the review for two more days 2021-01-27T00:00:00Z for anyone else to contribute some feedback on the code, after which I will be using this version of the code in the IIP. 😃

@emilianobonassi, @EndymionJkb | @Fernando , @MickdeGraaf, @patitonar

---

<div class="post-metadata">

**Author:** ![emilianobonassi](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/emilianobonassi/32/134_2.png) [@emilianobonassi](https://gov.pareto.credit/u/emilianobonassi)\
**Post date:** [January 25, 2021, 9:05pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/19 "2021-01-25T21:05:12Z")

</div>

Great @8bitporkchop !

Taking another look before deadline 💪

---

<div class="post-metadata">

**Author:** ![emilianobonassi](https://yyz1.discourse-cdn.com/flex031/user_avatar/gov.pareto.credit/emilianobonassi/32/134_2.png) [@emilianobonassi](https://gov.pareto.credit/u/emilianobonassi)\
**Post date:** [January 26, 2021, 9:36pm UTC](https://gov.pareto.credit/t/smart-treasury-peer-review/193/20 "2021-01-26T21:36:21Z")

</div>

@8bitporkchop LGTM

Ready to go!
