If you notice some outdated information please let us know!
PASS
The final review score is indicated as a percentage. The percentage is calculated as Achieved Points due to MAX Possible Points. For each element the answer can be either Yes/No or a percentage. For a detailed breakdown of the individual weights of each question, please consult this document.
Very simply, the audit looks for the following declarations from the developer's site. With these declarations, it is reasonable to trust the smart contracts.
This report is for informational purposes only and does not constitute investment advice of any kind, nor does it constitute an offer to provide investment advisory or other services. Nothing in this report shall be considered a solicitation or offer to buy or sell any security, token, future, option or other financial instrument or to offer or provide any investment advice or service to any person in any jurisdiction. Nothing contained in this report constitutes investment advice or offers any opinion with respect to the suitability of any security, and the views expressed in this report should not be taken as advice to buy, sell or hold any security. The information in this report should not be relied upon for the purpose of investing. In preparing the information contained in this report, we have not taken into account the investment needs, objectives and financial circumstances of any particular investor. This information has no regard to the specific investment objectives, financial situation and particular needs of any specific recipient of this information and investments discussed may not be suitable for all investors.
Any views expressed in this report by us were prepared based upon the information available to us at the time such views were written. The views expressed within this report are limited to DeFiSafety and the author and do not reflect those of any additional or third party and are strictly based upon DeFiSafety, its authors, interpretations and evaluation of relevant data. Changed or additional information could cause such views to change. All information is subject to possible correction. Information may quickly become unreliable for various reasons, including changes in market conditions or economic circumstances.
This completed report is copyright (c) DeFiSafety 2023. Permission is given to copy in whole, retaining this copyright label.
This section looks at the code deployed on the relevant chain that gets reviewed and its corresponding software repository. The document explaining these questions is here.
1. Are the smart contract addresses easy to find? (%)
Alpaca's addresses are available at website https://docs.alpacafinance.org/transparency#contract-documentation, as indicated in the Appendix.
2. How active is the primary contract? (%)
3. Does the protocol have a public software repository? (Y/N)
Alpaca uses GitHubhttps://github.com/alpaca-finance.
4. Is there a development history visible? (%)
Alpaca sports an impressive development history at 1,777 commits and 253 branches.
5. Is the team public (not anonymous)?
Alpaca's team is public and contributors can be found on LinkedIn. However, team members displayed on Github are anonymous, cited under a variety of alpaca names. We are assuming these aren't real alpacas. Where we found the team is documented in our team appendix at the end of this report.
This section looks at the software documentation. The document explaining these questions is here.
6. Is there a whitepaper? (Y/N)
Location: https://docs.alpacafinance.org
7. Is the protocol's software architecture documented? (Y/N)
Alpaca's protocol's software architecture can be found documented in full here.
8. Does the software documentation fully cover the deployed contracts' source code? (%)
Alpaca's documentation provides full coverage of the key deployed contracts by software function documentation. Some elements are yet to be covered.
9. Is it possible to trace the documented software to its implementation in the protocol's source code? (%)
The software functions documented offer explicit and concise traceability between documentation and implemented code.
10. Has the protocol tested their deployed code? (%)
Code examples are in the Appendix at the end of this report.. As per the SLOC, there is 570% testing to code (TtC). This score is guided by the Test to Code ratio (TtC). Generally, a good test to code ratio is over 100%. However, the reviewer's best judgment is the final deciding factor.
11. How covered is the protocol's code? (%)
No code coverage report was found but evidence of extensive testing is clear.
12. Does the protocol provide scripts and instructions to run their tests? (Y/N)
Scripts/Instructions to run tests can be found here.
13. Is there a detailed report of the protocol's test results?(%)
No test report found.
14. Has the protocol undergone Formal Verification? (Y/N)
Alpaca has not undergone formal verification.
15. Were the smart contracts deployed to a testnet? (Y/N)
The smart contract addresses have been deployed to a BNB testnet. Proof of addresses can be found here.
This section looks at the 3rd party software audits done. It is explained in this document.
16. Is the protocol sufficiently audited? (%)
Alpaca Finance has been extensively audited, with 20 audits under their belt performed before and after deployment.
17. Is the bounty value acceptably high (%)
This section covers the documentation of special access controls for a DeFi protocol. The admin access controls are the contracts that allow updating contracts or coefficients in the protocol. Since these contracts can allow the protocol admins to "change the rules", complete disclosure of capabilities is vital for user's transparency. It is explained in this document.
18. Is the protocol's admin control information easy to find?
Alpaca's admin control information is documented at this location as well as their governance section which is documented here. These were quick to find.
19. Are relevant contracts clearly labelled as upgradeable or immutable? (%)
The relevant contracts are all identified as upgradeable, as identified here.
20. Is the type of smart contract ownership clearly indicated? (%)
Though not indicated explicitly, Alpaca's documentation outlines that contract functions are controlled by a core group of developers.
21. Are the protocol's smart contract change capabilities described? (%)
Alpaca's smart contract change capabilities are identified for all contracts that are upgradeable.
22. Is the protocol's admin control information easy to understand? (%)
This information is largely in software-specific language when relating to upgradeable contracts, however, design ethos information, as well as timelock information, is in non-software-specific language.
23. Is there sufficient Pause Control documentation? (%)
A pause capability is briefly mentioned here, but no additional technical details are provided.
24. Is there sufficient Timelock documentation? (%)
Alpaca's documentation sufficiently details their 24h timelock here. Applied contracts, timeframe as well as justification are evident and explained clearly.
25. Is the Timelock of an adequate length? (Y/N)
The timelock is of a 24h relevant length, as specified in this location.
This section goes over the documentation that a protocol may or may not supply about their Oracle usage. Oracles are a fundamental part of DeFi as they are responsible for relaying tons of price data information to thousands of protocols using blockchain technology. Not only are they important for price feeds, but they are also an essential component of transaction verification and security. These questions are explained in this document.
26. Is the protocol's Oracle sufficiently documented? (%)
Alpaca gathers data from two different price feeds: Chainlink and Band Protocol detailed here. Timeframes are identified, however, the contracts dependent are not identified.
27. Is front running mitigated by this protocol? (Y/N)
Details on how front-running is mitigated by Alpaca developers can be found here.
28. Can flashloan attacks be applied to the protocol, and if so, are those flashloan attack risks mitigated? (Y/N)
Alpaca's FAQ section confirms that flash loan attacks are impossible due to the protocol being externally owned.
1import { config as dotEnvConfig } from "dotenv";
2dotEnvConfig();
3
4import "@openzeppelin/hardhat-upgrades";
5import "@nomiclabs/hardhat-waffle";
6import "@typechain/hardhat";
7import "@nomiclabs/hardhat-ethers";
8import "hardhat-deploy";
9import "solidity-coverage";
10
11module.exports = {
12 defaultNetwork: "hardhat",
13 networks: {
14 hardhat: {
15 chainId: 31337,
16 gas: 12000000,
17 blockGasLimit: 0x1fffffffffffff,
18 allowUnlimitedContractSize: true,
19 timeout: 1800000,
20 accounts: { mnemonic: "test test test test test test test test test test test junk" },
21 },
22 testnet: {
23 url: "https://data-seed-prebsc-1-s2.binance.org:8545/",
24 accounts: [process.env.BSC_TESTNET_PRIVATE_KEY],
25 },
26 mainnet: {
27 url: process.env.BSC_MAINNET_RPC,
28 accounts: [process.env.BSC_MAINNET_PRIVATE_KEY],
29 },
30 },
31 namedAccounts: {
32 deployer: {
33 default: 0,
34 },
35 },
36 solidity: {
37 version: "0.8.10",
38 settings: {
39 optimizer: {
40 enabled: true,
41 runs: 1,
42 },
43 evmVersion: "istanbul",
44 outputSelection: {
45 "*": {
46 "": ["ast"],
47 "*": [
48 "evm.bytecode.object",
49 "evm.deployedBytecode.object",
50 "abi",
51 "evm.bytecode.sourceMap",
52 "evm.deployedBytecode.sourceMap",
53 "metadata",
54 ],
55 },
56 },
57 },
58 },
59 paths: {
60 sources: "./solidity/contracts/8.10",
61 tests: "./test",
62 cache: "./cache",
63 artifacts: "./artifacts",
64 },
65 typechain: {
66 outDir: "./typechain",
67 target: process.env.TYPECHAIN_TARGET || "ethers-v5",
68 },
69 mocha: {
70 timeout: 50000,
71 },
Tests to Code: 26051 / 4572 = 570 %