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

feat: account logic and script for delegating governance tokens from account #497

Merged
merged 24 commits into from
Dec 18, 2023

Conversation

AustinGreen
Copy link
Contributor

@AustinGreen AustinGreen commented Nov 24, 2023

Motivation:

Llama accounts can contain ERC20Votes and ERC721Votes tokens. These must be delegated to the instances LlamaExecutor for the instance to vote on governance proposals. This PR introduces a LlamaAccountTokenDelegationScript that can be used to delegate tokens custodied in a LlamaAccount to the instance's executor or any other address.

Modifications:

Created a LlamaAccountTokenDelegationScript.sol script that includes a function that uses the account's arbitrary execute function to call the delegate function on the voting token. It accepts an account, token, and delegatee address as parameters.

I also created an account logic called LlamaAccountWithDelegation.sol that inherits from LlamaAccount.sol. It extends LlamaAccount with a delegate and batchDelegate function.

Result:

Instances will be able to delegate tokens in their accounts for token voting.

@dd0sxx
Copy link
Contributor

dd0sxx commented Nov 30, 2023

we also might want to write a simple guard which checks to make sure actions are calling the delegation script and not anything else since this requires permissioning the arbitrary execution function on accounts

@AustinGreen AustinGreen marked this pull request as ready for review December 12, 2023 01:52
@AustinGreen AustinGreen changed the title feat: create script for delegating governance tokens in LlamaAccount to instance's executor feat: account logic and script for delegating governance tokens from account Dec 12, 2023
@AustinGreen AustinGreen merged commit d54a09b into main Dec 18, 2023
5 checks passed
@AustinGreen AustinGreen deleted the austin/account-token-delegation branch December 18, 2023 17:17
Copy link

Coverage after merging austin/account-token-delegation into main will be

88.52%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   LlamaCore.sol99.31%97.44%100%100%299, 399
   LlamaExecutor.sol80%50%100%100%33
   LlamaFactory.sol100%100%100%100%
   LlamaLens.sol72.09%20%100%82.61%174–175, 178, 178, 178–179, 179, 179–180, 180, 180, 188
   LlamaPolicy.sol91.53%88.89%94.59%91.38%353, 392, 392, 392–394, 394, 394, 396–399, 401, 419
   LlamaPolicyMetadata.sol100%100%100%100%
src/accounts
   LlamaAccount.sol100%100%100%100%
   LlamaAccountWithDelegation.sol100%100%100%100%
src/lib
   ERC721NonTransferableMinimalProxy.sol70.42%72.73%72.73%68.42%102, 104, 106, 118–120, 190, 88, 88, 88, 90, 90, 90, 92, 92, 92, 97, 99
   LlamaUtils.sol100%100%100%100%
   PolicyholderCheckpoints.sol55.88%50%81.82%53.62%130, 184–186, 186, 186–187, 189, 192, 222, 229, 229–231, 233, 233–235, 237, 237–239, 241, 241–243, 262, 265–271, 278, 46, 46–48, 48, 48–49, 51
   SupplyCheckpoints.sol57.14%50%83.33%54.93%131, 183–185, 185, 185–186, 188, 191, 235, 242, 242–244, 246, 246–248, 250, 250–252, 254, 254–256, 275, 278–284, 291, 50, 50–52, 52, 52–53, 55
src/llama-scripts
   LlamaAccountTokenDelegationScript.sol100%100%100%100%
   LlamaGovernanceScript.sol96.24%64.29%100%100%131, 133, 160, 171, 228
   LlamaInstanceConfigBase.sol100%100%100%100%
   LlamaInstanceConfigScriptTemplate.sol100%100%100%100%
src/strategies/absolute
   LlamaAbsolutePeerReview.sol100%100%100%100%
   LlamaAbsoluteQuorum.sol100%100%100%100%
   LlamaAbsoluteStrategyBase.sol94.81%87.50%90.91%98%248, 251, 301
src/strategies/relative
   LlamaRelativeHolderQuorum.sol91.67%75%100%100%52, 59
   LlamaRelativeQuantityQuorum.sol0%0%0%0%28, 28, 28–30, 42, 42, 42–44, 51–52, 52, 52–53, 58–59, 59, 59–60
   LlamaRelativeStrategyBase.sol97.62%90.91%100%100%208, 310
   LlamaRelativeUniqueHolderQuorum.sol93.33%83.33%100%100%54, 61

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants