What exactly is the proposal code?

I have been reading the docs and it says a proposal is executable code that modifies the governance contract or treasury, and that this code is executed in the timelock contract.

But is the proposal code another contract which then calls the uniswap’s contracts? Or is it code that’s written directly inside a function in the Timelock contract? How does the proposal code interact with Uniswap’s contracts?

If anyone could provide some insight, I would appreciate it.

UNI borrows the COMP contracts - Compound | Docs - Governance

but also check out fish.vote, it’s a UI for simple proposals and funded by UNI grants program

2 Likes

When someone creates a proposal, they basically create a set of contract functions to call and the inputs to pass to those functions. All that data gets packed together into an array of bytes that is submitted with the proposal. Then, when a proposal gets passed and “executed,” UNI’s governance contracts can basically just read the data in the proposal and call the appropriate functions with the right inputs.

fish.vote has a UI that allows you to construct such a proposal, but only supports “Autonomous Proposals” right now.

3 Likes

Thank you for the reply. However there is something that is still not entirely clear to me. When you say “they basically create a set of contract functions to call and the inputs to pass to those functions”, where are those functions executed? Do they need to be deployed in a new smart contract ? Or does the gov or timelock contract take these functions and execute them?

I checked the fish.vote site and I could see as @kenneth said, you can create simple proposals there where you directly call some functions in the governance contracts. But it was limited to a couple of functions. What if someone wanted to change something else? Do they do it by directly calling the propose() function in the governor bravo contract?

Yes, that’s simply a UI limitation. Technically, literally any smart contract function call can be made. A proposal consists of the data related to which contracts and function calls should be made. When the proposal is executed, the Timelock contract reads that data and calls the appropriate functions on whatever smart contract addresses were included.

Check out this code I’ve linked below. There should be enough there to piece together how the system works and illustrate the (excellent) description from @jcp.

Proposals enter the system via Governor#propose

proposals are then executed by Governor#execute

which calls out to Timelock#executeTransaction

1 Like