Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

AngleProtocol/angle-governance-old

Repository files navigation

Governance Angle Governance

Angle Governance CI

About this repository 🤔

Angle is a decentralized stablecoin protocol, ruled by the veANGLE token and natively deployed on multiple EVM compatible chains (including Ethereum, Polygon, Optimism, Arbitrum, ...).

This repository contains the smart contracts for the cross-chain governance system for Angle Protocol relying on LayerZero message passing infrastructure.

It also comes with some utils and scripts to facilitate the creation and execution of proposals on top of the deployed system.

Simulate a Proposal

  • Complete test/Proposal.sol
  • You can simulate the proposal's execution by running forge test -vvvv --match-contract Simulate
  • Eventually add tests to test/Simulate.t.sol

System Architecture 🏘️

Angle onchain governance works as follows:

  • veANGLE holders vote on Ethereum on an OpenZeppelin Governor implementation called AngleGovernor with a predetermined quorum, voting delay and proposal threshold.
  • On every chain where the protocol is deployed, there is a Timelock contract which is admin of all the protocol contracts (Borrowing module, Transmuter, direct deposit modules, ...) of its chain.
  • While only onchain votes can lead to payloads being included in the Timelock contract of a chain before execution, Angle 4/6 Governance multisig (deployed on all chains as well) has a veto power on the payloads in Timelock contracts, and can cancel rogue governance votes.
  • For successful votes on non-Ethereum proposals, payloads to execute are bridged to the chain of interest using LayerZero message passing technology before being sent to the Timelock contract of their chain.

Angle Governance Architecture Summary

Precisely speaking, once a vote succeeds (majority of positive votes + quorum), the flow is the following:

  • If the vote concerns an Ethereum action:
    • The payload to execute is sent to the Ethereum Timelock contract. The Ethereum Timelock contract only accepts payload from the AngleGovernor contract
    • After the timelock period ends, if the payload is not veto-ed by Angle Governance multisig on Ethereum, it can be executed on Ethereum.
  • If the vote concerns an action on another chain:
    • The payload to execute is sent to a ProposalSender contract on Ethereum which is a simple LayerZero message passing contract owned by the AngleGovernor contract.
    • This payload is to be received on the destination chain by a ProposalReceiver contract which role is to then send the payload to the Timelock contract of this chain. Timelock contracts of non-Ethereum chains only accept payloads from their respective ProposalReceiver contract.

It's worth noting that, setup like this, the Angle Governance system can be abstracted among a decision module (AngleGovernor contract) and an execution module. Both are modular, and so any could be changed at any time in the future.


Documentation 📚


Security ⛑️

Audits

Bug Bounty

For contracts deployed for the Angle Protocol, a bug bounty is open on Immunefi and Hats Finance. The rewards and scope of the Angle Immunefi are defined here.


Deployment Addresses 🚦

All Angle governance deployment addresses can be found in the developers documentation here.


Development 🛠️

This repository is built on Foundry.

Getting started

Install Foundry

If you don't have Foundry:

curl -L https://foundry.paradigm.xyz | bash

source /root/.zshrc
# or, if you're under bash: source /root/.bashrc

foundryup

To install the standard library:

forge install foundry-rs/forge-std

To update libraries:

forge update

Install packages

You can install all dependencies by running

yarn
forge i

Create .env file

In order to interact with non local networks, you must create an .env that has:

  • a MNEMONIC for each of the chain you
  • a network key
  • an ETHERSCAN_API_KEY

For additional keys, you can check the .env.example file.

Warnings

  • Always keep your confidential information safe
  • This repository uses ffi in its test suite. Beware as a malicious actor forking this repo may execute malicious commands on your machine

Compilation

Compilation of production contracts is done using the via-ir pipeline.

However, tests do not compile with via-ir, and to run coverage the optimizer needs to be off. Therefore for development and test purposes you can compile without optimizer.

yarn compile # without compiling tests files
yarn compile:dev # with test files compiling

Testing

Here are examples of how to run the test suite:

yarn test
yarn test --watch # To watch changing files
yarn test --match-path test/Test.t.sol
yarn test --match-test "testAbc*"
yarn test --fork-url <RPC_URL>

You can also list tests:

yarn test --list
yarn test --list --json --match-test "testXXX*"

Coverage

We recommend the use of this vscode extension.

yarn coverage

You'll need to install lcov brew install lcov to visualize the coverage report.


Gas report ⛽️

yarn gas

Contributing

If you're interested in contributing, please see our contributions guidelines.


Questions & Feedback

For any question or feedback you can send an email to [email protected]. Don't hesitate to reach out on Twitter🐦 as well.


License

This repository is released under the MIT License.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages