{"id":189,"date":"2022-03-03T12:00:20","date_gmt":"2022-03-03T10:00:20","guid":{"rendered":"https:\/\/ackeeblockchain.com\/blog\/?p=189"},"modified":"2022-05-23T15:54:32","modified_gmt":"2022-05-23T14:54:32","slug":"ackee-blockchain-audited-trader-joe","status":"publish","type":"post","link":"https:\/\/ackee.xyz\/blog\/ackee-blockchain-audited-trader-joe\/","title":{"rendered":"Ackee Blockchain audited Trader Joe"},"content":{"rendered":"<h4>About Trader Joe<\/h4>\n<p><a href=\"https:\/\/traderjoexyz.com\/home#\/\">Trader Joe<\/a><span style=\"font-weight: 400;\"> is <strong>a<\/strong> <span data-slate-fragment=\"JTdCJTIyb2JqZWN0JTIyJTNBJTIyZG9jdW1lbnQlMjIlMkMlMjJkYXRhJTIyJTNBJTdCJTdEJTJDJTIybm9kZXMlMjIlM0ElNUIlN0IlMjJvYmplY3QlMjIlM0ElMjJibG9jayUyMiUyQyUyMnR5cGUlMjIlM0ElMjJwYXJhZ3JhcGglMjIlMkMlMjJpc1ZvaWQlMjIlM0FmYWxzZSUyQyUyMmRhdGElMjIlM0ElN0IlN0QlMkMlMjJub2RlcyUyMiUzQSU1QiU3QiUyMm9iamVjdCUyMiUzQSUyMnRleHQlMjIlMkMlMjJsZWF2ZXMlMjIlM0ElNUIlN0IlMjJvYmplY3QlMjIlM0ElMjJsZWFmJTIyJTJDJTIydGV4dCUyMiUzQSUyMm11bHRpLWZ1bmN0aW9uYWwlMjBEZUZpJTIwdHJhZGluZyUyMHBsYXRmb3JtJTIwb24lMjB0aGUlMjBBdmFsYW5jaGUlMjBCbG9ja2NoYWluLiUyMiUyQyUyMm1hcmtzJTIyJTNBJTVCJTVEJTJDJTIyc2VsZWN0aW9ucyUyMiUzQSU1QiU1RCU3RCU1RCUyQyUyMmtleSUyMiUzQSUyMjFlNDM2ODVhODg2NjRhMjE5ODliMGM1MzUyNTQ0NmE4JTIyJTdEJTVEJTJDJTIya2V5JTIyJTNBJTIyN2U2YzgzNDEzNGY5NDI2YTk5YmYxYjhjOWVmNTI1OWMlMjIlN0QlNUQlMkMlMjJrZXklMjIlM0ElMjI0ZTAzNjNiY2ZhNWI0ODg2OWU4M2RlMGEyMTAzZjA2OSUyMiU3RA==\"><strong>multi-functional DeFi trading platform<\/strong> on the Avalanche Blockchain.<\/span> Users can trade, lend, stake, and participate in launch events for newly issued tokens.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Trader Joe&#8217;s differentiates itself from classic decentralized exchanges such as Uniswap by combining DEX with lending and leveraged trading.<\/span><!--more--><\/p>\n<p><span style=\"font-weight: 400;\">At the time of writing this post, Trader Joe is offering users these features:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>trade<\/b><span style=\"font-weight: 400;\"> between tokens using AMM;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>farm<\/b><span style=\"font-weight: 400;\"> and earn rewards by staking LP tokens;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>stake<\/b><span style=\"font-weight: 400;\"> JOE tokens to earn rewards in the form of stablecoins or more JOE tokens;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>borrow<\/b><span style=\"font-weight: 400;\"> other token through Banker Joe platform;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">participate in the<\/span><b> launch<\/b><span style=\"font-weight: 400;\"> events for newly issued tokens.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">To learn more about <\/span>Trader Joe<span style=\"font-weight: 400;\">, read <strong>the official documentation<\/strong><\/span><strong> <a href=\"https:\/\/docs.traderjoexyz.com\/en\/welcome\/master\">here<\/a><\/strong><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4>About the audit<\/h4>\n<p><span style=\"font-weight: 400;\">Between <strong>February 7 and March 4, 2022<\/strong>, the <\/span><a href=\"https:\/\/ackeeblockchain.com\/\"><span style=\"font-weight: 400;\">Ackee Blockchain<\/span><\/a><span style=\"font-weight: 400;\"> security team performed an <a href=\"https:\/\/ackeeblockchain.com\/blog\/glossary\/audit\/\">audit<\/a> of Trader Joe&#8217;s following contracts:<\/span><\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/traderjoe-xyz\/joe-core\/blob\/210af8bf5db2a05bcab13d642b1903e38b804e95\/contracts\/MoneyMaker.sol#L19-L391\">MoneyMaker<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/traderjoe-xyz\/joe-core\/blob\/210af8bf5db2a05bcab13d642b1903e38b804e95\/contracts\/StableJoeStaking.sol#L21-L338\">StableJoeStaking<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/traderjoe-xyz\/joe-core\/blob\/9ae7edc7a7920995a2f920d7af1f67887577401a\/contracts\/VeJoeToken.sol#L16-L46\">VeJoeToken<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/traderjoe-xyz\/joe-core\/blob\/9ae7edc7a7920995a2f920d7af1f67887577401a\/contracts\/VeJoeStaking.sol#L18-L369\">VeJoeStaking<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/traderjoe-xyz\/joe-core\/blob\/9ae7edc7a7920995a2f920d7af1f67887577401a\/contracts\/BoostedMasterChefJoe.sol#L32-L486\"><span style=\"font-weight: 400;\">BoostedMasterChefJoe<\/span><\/a><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">During the audit, the Trader Joe and Ackee Blockchain teams agreed on the extension of the <a href=\"https:\/\/ackeeblockchain.com\/blog\/glossary\/audit-scope\/\">audit scope<\/a> based on issues found in the audit. The whole auditing process was performed with a total time donation of <strong>15 engineering days<\/strong>.\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>During the security review, <strong>special attention was paid to <\/strong>the following questions:<\/p>\n<ul>\n<li>Is the correctness of the two contracts ensured?<\/li>\n<li>Do the contracts correctly use dependencies or other contracts they rely on, namely JoePair?<\/li>\n<li>Are access controls not too relaxed or too strict?<\/li>\n<li>Are the upgradeable contracts subject to common upgradeability pitfalls?<\/li>\n<li>Is the code vulnerable to re-entrancy attacks, either through <a href=\"https:\/\/eips.ethereum.org\/EIPS\/eip-777\">ERC777<\/a>-style contracts, or maliciously supplied user input?<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The audit methodology for Trader Joe consisted of:<\/span><\/p>\n<ol>\n<li><b>Technical specification\/documentation<\/b><span style=\"font-weight: 400;\"> &#8211; a brief overview of the system is requested from the client, and the scope of the audit is defined. <\/span><\/li>\n<li><b>Tool-based analysis<\/b><span style=\"font-weight: 400;\"> &#8211; deep check with automated <a href=\"https:\/\/ackeeblockchain.com\/blog\/glossary\/solidity\/\">Solidity<\/a> analysis tools and <a href=\"https:\/\/ackeeblockchain.com\/blog\/glossary\/slither\/\">Slither<\/a> is performed. <\/span><\/li>\n<li><b>Manual code review<\/b><span style=\"font-weight: 400;\"> &#8211; the code is checked line by line for common vulnerabilities, code duplication, best practices and the code architecture is reviewed. <\/span><\/li>\n<li><b>Local deployment + hacking<\/b><span style=\"font-weight: 400;\"> &#8211; the contracts are deployed locally and we try to attack the system and break it.<\/span><\/li>\n<li><b>Unit and fuzzy testing<\/b><span style=\"font-weight: 400;\"> &#8211; run unit tests to ensure that the system works as expected, potentially write missing unit or fuzzy tests.<\/span><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">The Trader Joe development team is aware that the security of smart contracts is a crucial aspect of every cryptocurrency protocol, and that&#8217;s why Trader Joe engaged Ackee Blockchain <strong>to conduct a follow-up audit<\/strong> of the new <em>BoostedMasterChefJoe<\/em> contract. <\/span><span style=\"font-weight: 400;\">The follow-up audit was performed between <strong>March 14 and March 18, 2022<\/strong>.<\/span><\/p>\n<h4>Findings<\/h4>\n<p><span style=\"font-weight: 400;\">In the first audit,<\/span><span style=\"font-weight: 400;\"> we identified 18 <a href=\"https:\/\/ackeeblockchain.com\/blog\/glossary\/findings\/\">findings<\/a>: <strong>4 warning <\/strong>severity, <strong>3 informational <\/strong>severity, <strong>1 low<\/strong> severity, <strong>3 medium<\/strong> severity and <strong>7 high<\/strong> severity issues. The most critical was that <strong>a denial of service could occur<\/strong> in<em> BoostedMasterChefJoe<\/em> under relatively common circumstances (see H1 in the audit report).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It is worth mentioning that the contract was not deployed on the mainnet, and we at Ackee Blockchain are happy to contribute to the security of the Trader Joe protocol.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As mentioned above, based on the first audit report (especially on the critical issue), the Trader Joe team decided to re-write the whole <em>BoostedMasterChefJoe<\/em> smart contract, and then the <strong>follow-up audit<\/strong> was conducted. It resulted in 7 findings: <strong>2 warning <\/strong>severity, <strong>1\u00a0informational <\/strong>severity, <strong>1 low<\/strong> severity, <strong>1 medium<\/strong> severity and <strong>2 high<\/strong> severity issues.<\/span><\/p>\n<h4>Conclusion<\/h4>\n<p><strong>After the first audit<\/strong>, we recommended Trader Joe to:<\/p>\n<ul>\n<li>heavily test <em>BoostedMasterChefJoe<\/em> with our fuzzing model;<\/li>\n<li>address all reported issues;<\/li>\n<li>build on top of the fuzzing model during future development and use it to test the safety and correctness of any future code.<\/li>\n<\/ul>\n<p><strong>After the follow-up audit<\/strong>, we recommended\u00a0 Trader Joe to:<\/p>\n<ul>\n<li>expand on our earlier fuzzing model to heavily test the new BoostedMasterChefJoe contract;<\/li>\n<li>address all reported issues;<\/li>\n<li>build on top of the fuzzing model during future development and use it to test the safety and correctness of any future code.<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">We were delighted to audit <\/span><b>Trader Joe <\/b><span style=\"font-weight: 400;\">and<\/span><span style=\"font-weight: 400;\">\u00a0look forward to working with them again.\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<p class=\"p1\"><b>The full Ackee Blockchain audit<\/b> <b>report<\/b> <b>of Trader Joe with a more detailed description of all findings and recommendations can be found <\/b><a href=\"https:\/\/764859236-files.gitbook.io\/~\/files\/v0\/b\/gitbook-x-prod.appspot.com\/o\/spaces%2F-MYTkRFOHO4K48zVLh8x-2910905616%2Fuploads%2FZPtC0xhgnsXE8pxHSvL0%2Ftokenomicsv2_audit.pdf?alt=media&amp;token=cea969cb-ddbf-4bde-ac59-bc6526877224\"><span class=\"s1\"><b>here<\/b><\/span><\/a><b>. The follow-up audit of the new <em>BoostedMasterChefJoe <\/em><\/b><strong>can be found <\/strong><b><a href=\"https:\/\/764859236-files.gitbook.io\/~\/files\/v0\/b\/gitbook-x-prod.appspot.com\/o\/spaces%2F-MYTkRFOHO4K48zVLh8x-2910905616%2Fuploads%2F6p48zyJjNOyRuXVS6ul3%2Fbmcj_audit.pdf?alt=media&amp;token=474640a7-8025-46ac-b33d-26a51305281a\">here<\/a>.\u00a0<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>About Trader Joe Trader Joe is a multi-functional DeFi trading platform on the Avalanche Blockchain. Users can trade, lend, stake, and participate in launch events for newly issued tokens. Trader Joe&#8217;s differentiates itself from classic decentralized exchanges such as Uniswap by combining DEX with lending and leveraged trading.<\/p>\n","protected":false},"author":11,"featured_media":191,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,10],"tags":[31,21,59,30,24,33,60,135],"class_list":["post-189","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-audits","category-ethereum","tag-amm","tag-audit","tag-avalanche","tag-dex","tag-ethereum","tag-evm","tag-lp","tag-traderjoe"],"aioseo_notices":[],"featured_image_src":"https:\/\/ackee.xyz\/blog\/wp-content\/uploads\/2022\/04\/ABCH-Trader-Joe-600x400.png","featured_image_src_square":"https:\/\/ackee.xyz\/blog\/wp-content\/uploads\/2022\/04\/ABCH-Trader-Joe-600x600.png","author_info":{"display_name":"Andrea Nov\u00e1kov\u00e1","author_link":"https:\/\/ackee.xyz\/blog\/author\/andrea-novakova\/"},"_links":{"self":[{"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/posts\/189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/comments?post=189"}],"version-history":[{"count":0,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/media\/191"}],"wp:attachment":[{"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}