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

refactor: combine ERC-20 and ERC-721 voting token implementations and turn adapter into minimal proxy #65

Merged
merged 24 commits into from
Dec 15, 2023

Conversation

AustinGreen
Copy link
Contributor

@AustinGreen AustinGreen commented Dec 15, 2023

Motivation:

This is a significant refactor of the entire token voting module. It simplifies the contracts and provides a powerful architecture that has broad token support and pushes complexity to the edges. Users can call the deploy function directly from their Llama instance with a config for the action creator, caster, and adapter, The adapter has a standardized interface but a generalized configuration similar to strategies. We have some standard checks that the adapter, creator, and caster are setup correctly

Modifications:

  • Removed ERC20 and ERC721 creator and caster contracts and moved everything into generalized creator and caster contracts
  • Turned the adapter into a minimal proxy that is initialized at deployment with a generalized config
  • Adds checks during deployment that the adapter was initialized correctly
  • Adds a LlamaTokenAdapterTimestamp logic contract that can be used for IVotes tokens that use timestamp based checkpointing

Result:

Closes #60 (note this issue is outdated)
Closes #61 (note this issue is outdated)
Closes #63

src/token-voting/LlamaTokenAdapter.sol Outdated Show resolved Hide resolved
src/token-voting/LlamaTokenAdapter.sol Outdated Show resolved Hide resolved
src/token-voting/LlamaTokenAdapter.sol Outdated Show resolved Hide resolved
src/token-voting/LlamaTokenActionCreator.sol Show resolved Hide resolved
@AustinGreen AustinGreen changed the title refactor: token adapter to provide support for non-standard token types refactor: combine ERC-20 and ERC-721 voting token implementations and turn adapter into minimal proxy Dec 15, 2023
script/DeployLlamaTokenVotingFactory.s.sol Outdated Show resolved Hide resolved
src/token-voting/LlamaTokenActionCreator.sol Outdated Show resolved Hide resolved
src/token-voting/LlamaTokenActionCreator.sol Outdated Show resolved Hide resolved
src/token-voting/LlamaTokenCaster.sol Outdated Show resolved Hide resolved
0xrajath
0xrajath previously approved these changes Dec 15, 2023
Copy link

Coverage after merging austin/adapter into main will be

90.73%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/token-voting
   LlamaTokenActionCreator.sol96%83.33%100%100%131–132, 271
   LlamaTokenCaster.sol85.59%85.14%84%86.13%215–216, 411, 416, 416, 416–418, 418, 418–422, 424, 442, 451, 451, 451–453, 453, 453–457, 459, 548–549
   LlamaTokenVotingFactory.sol85%50%100%100%94–96
src/token-voting/token-adapters
   LlamaTokenAdapterVotesTimestamp.sol95.65%50%100%100%71

@AustinGreen AustinGreen merged commit 9498130 into main Dec 15, 2023
5 checks passed
@AustinGreen AustinGreen deleted the austin/adapter branch December 15, 2023 20:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants