Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Wrong Decimal Points Used in `makeMerkle.js`

[M-1] Wrong Decimal Points Used in makeMerkle.js

Description: in makeMerkle.js file the value for usdc decimals is set to 25 * 1e18 but because usdc has 6 decimal points, the final proof and even root will be diffrent.

const { StandardMerkleTree } = require("@openzeppelin/merkle-tree")
const fs = require("fs")
/*//////////////////////////////////////////////////////////////
INPUTS
//////////////////////////////////////////////////////////////*/
@> const amount = (25 * 1e18).toString()
const userToGetProofOf = "0x20F41376c713072937eb02Be70ee1eD0D639966C"

Impact: This will cause users to fail to claim their airdrops.

Proof of Concept: Add this test to existing test suit:

function testMerkleJsIsWrong() public {
vm.deal(collectorOne, airdrop.getFee());
vm.startPrank(collectorOne);
vm.expectRevert();
airdrop.claim{value: airdrop.getFee()}(
collectorOne,
amountToCollect,
wrongProof
);
vm.stopPrank();
}

Recommended Mitigation: fix the Decimal points in makeMerkle.js from 1e18 to 1e6.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

wrong-usdc-decimals-in-merkle

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.