Skip to content

llamaxyz/llama

Repository files navigation

Llama

CI License: MIT

Llama

Llama is an onchain governance and access control framework for smart contracts. It uses non-transferable NFTs to encode access control, features programmatic control of funds, and includes modular strategies to define action execution rules.

Prerequisites

Foundry must be installed. You can find installation instructions in the Foundry docs.

We use just to save and run a few larger, more complex commands. You can find installation instructions in the just docs. All commands can be listed by running just -l from the repo root, or by viewing the justfile.

VS Code

You can get Solidity support for Visual Studio Code by installing the Hardhat Solidity extension.

Installation

$ git clone https://github.com/llamaxyz/llama.git
$ cd llama
$ forge install

# Configure git to ignore commits that aren't relevant to git blame. Read the
# comments in the `.git-blame-ignore-revs` file for more information.
$ git config blame.ignoreRevsFile .git-blame-ignore-revs

Setup

Copy .env.example and rename it to .env. The comments in that file explain what each variable is for and when they're needed:

  • The MAINNET_RPC_URL variable is the only one that is required for running tests.
  • You may also want a mainnet ETHERSCAN_API_KEY for better traces when running fork tests.
  • The rest are only needed for deployment verification with forge scripts. An anvil default private key is provided in the .env.example file to facilitate testing.

Commands

  • forge build - build the project
  • forge test - run tests

Deploy and Verify

  • just deploy - deploy and verify payload on mainnet
  • Run just -l or see the justfile for other commands such as dry runs.

Deployments

Name Ethereum Optimism Arbitrum Base Polygon Blast Zora
Factory
LlamaFactory 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB
Main instance contracts
LlamaCore (logic contract) 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14
LlamaPolicy (logic contract) 0x19640A82e696f67F0d25307e19c4307321761d4d 0x19640A82e696f67F0d25307e19c4307321761d4d 0x19640A82e696f67F0d25307e19c4307321761d4d 0x19640A82e696f67F0d25307e19c4307321761d4d 0x19640A82e696f67F0d25307e19c4307321761d4d 0x19640A82e696f67F0d25307e19c4307321761d4d 0x19640A82e696f67F0d25307e19c4307321761d4d
LlamaPolicyMetadata (logic contract) 0xf2C61E275d48efA8a6556529F60cE1E376510e0F 0xf2C61E275d48efA8a6556529F60cE1E376510e0F 0xf2C61E275d48efA8a6556529F60cE1E376510e0F 0xf2C61E275d48efA8a6556529F60cE1E376510e0F 0xf2C61E275d48efA8a6556529F60cE1E376510e0F 0xf2C61E275d48efA8a6556529F60cE1E376510e0F 0xf2C61E275d48efA8a6556529F60cE1E376510e0F
Strategy logic contracts
LlamaRelativeQuantityQuorum 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc
LlamaRelativeHolderQuorum 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE
LlamaRelativeUniqueHolderQuorum 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb
LlamaAbsoluteQuorum 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631
LlamaAbsolutePeerReview 0x0092CD4044E1672c9c513867eb75e6213AF9742f 0x0092CD4044E1672c9c513867eb75e6213AF9742f 0x0092CD4044E1672c9c513867eb75e6213AF9742f 0x0092CD4044E1672c9c513867eb75e6213AF9742f 0x0092CD4044E1672c9c513867eb75e6213AF9742f 0x0092CD4044E1672c9c513867eb75e6213AF9742f 0x0092CD4044E1672c9c513867eb75e6213AF9742f
Account logic contracts
LlamaAccount 0x915Af6753f03D2687Fa923b2987625e21e2991aE 0x915Af6753f03D2687Fa923b2987625e21e2991aE 0x915Af6753f03D2687Fa923b2987625e21e2991aE 0x915Af6753f03D2687Fa923b2987625e21e2991aE 0x915Af6753f03D2687Fa923b2987625e21e2991aE 0x915Af6753f03D2687Fa923b2987625e21e2991aE 0x915Af6753f03D2687Fa923b2987625e21e2991aE
LlamaAccountWithDelegation 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b
Helper contract
LlamaLens 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB
Script contracts
LlamaGovernanceScript 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335
LlamaAccountTokenDelegationScript 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51

Testnet deployments

Name Sepolia Holesky Base Sepolia
Factory
LlamaFactory 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB 0xFf5d4E226D9A3496EECE31083a8F493edd79AbEB
Main instance contracts
LlamaCore (logic contract) 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14 0x676ca05Fd577FCA8fddb4605d4992Bc7EfbCff14
LlamaPolicy (logic contract) 0x19640A82e696f67F0d25307e19c4307321761d4d 0x19640A82e696f67F0d25307e19c4307321761d4d 0x19640A82e696f67F0d25307e19c4307321761d4d
LlamaPolicyMetadata (logic contract) 0xf2C61E275d48efA8a6556529F60cE1E376510e0F 0xf2C61E275d48efA8a6556529F60cE1E376510e0F 0xf2C61E275d48efA8a6556529F60cE1E376510e0F
Strategy logic contracts
LlamaRelativeQuantityQuorum 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc 0x81F7D26fD7d814bFcEF78239a32c0BA5282C98Dc
LlamaRelativeHolderQuorum 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE 0xE7EE15321bAD254dAC7495867Ea2C8C9c77Ee4eE
LlamaRelativeUniqueHolderQuorum 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb 0xa5B2B5Ae8F278530270f44D7CFC2440292583BEb
LlamaAbsoluteQuorum 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631 0x68f153D5F50e66CC0c6D9802362137BCF2aE5631
LlamaAbsolutePeerReview 0x0092CD4044E1672c9c513867eb75e6213AF9742f 0x0092CD4044E1672c9c513867eb75e6213AF9742f 0x0092CD4044E1672c9c513867eb75e6213AF9742f
Account logic contracts
LlamaAccount 0x915Af6753f03D2687Fa923b2987625e21e2991aE 0x915Af6753f03D2687Fa923b2987625e21e2991aE 0x915Af6753f03D2687Fa923b2987625e21e2991aE
LlamaAccountWithDelegation 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b 0x28CeeDA47db26612882a56BaC9EFc0B6DeA2C91b
Helper contract
LlamaLens 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB 0x1D74803D4939aFa3CC9fF1B8667bE4d119d925cB
Script contracts
LlamaGovernanceScript 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335 0x21f45e61213a13Dc6B7Ba2eC157c4e95810cD335
LlamaAccountTokenDelegationScript 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51 0xC60Ab709CA5BbD73fC2b46D232344740A8903b51

Documentation

To read all of our documentation, visit https://docs.llama.xyz. To view Llama framework documentation only, visit the docs directory.

Smart contract reference

Run the following command to generate smart contract reference documentation from our NatSpec comments and serve those static files locally:

$ forge doc -o reference/ -b -s

Security

Audits

We've received three audits from Spearbit and one from Code4rena. You can find links to the reports below:

Bug bounty program

All contracts in the src/ directory except src/LlamaLens.sol are in scope for the bug bounty program. The root lib/ directory (not the src/lib/ directory) and acknowledged findings from our Spearbit and Code4rena audits are out of scope.

Llama policyholders are trusted participants of a Llama instance based on what their roles and permissions allow them to do. Any findings that require policyholders to take malicious action are out of scope for this program.

We adapted the Immunefi Vulnerability Severity Classification System to determine classification.

Level Example Maximum Bug Bounty
5. Critical - Unauthorized action state transitions
- Major manipulation of approval or disapproval results
- Vulnerabilities in the roles and permissions system that result in unauthorized ability to create, approve, or disapprove actions
- Permanent freezing of funds in accounts
Up to 100,000 USDC
4. High - Minor manipulation of approval or disapproval results that are unlikely to affect outcomes
- Minor vulnerabilities in the roles and permissions system that are unlikely to affect outcomes
- Temporary freezing of funds in accounts
Up to 20,000 USDC
3. Medium - Griefing that disrupts an instance's action flow Up to 5,000 USDC
2. Low - Contract fails to deliver promised returns, but doesn't lose value Up to 1,000 USDC
1. None - Best practices
Not sure? Email us

Email us at security@llama.xyz to get in contact.

Slither

Use our bash script to prevent slither from analyzing the test and script directories. Running slither . directly will result in an AssertionError.

$ chmod +x slither.sh
$ ./slither.sh

About

Llama is an onchain governance and access control framework for smart contracts.

Resources

License

Stars

Watchers

Forks

Languages