#41876 [SC-Insight] User may receive boosted values which are non-concave
Previous#41875 [SC-High] Permanent Lock of User Funds in StakeV2 Due to Incorrect token Debt HandlingNext#41885 [SC-Insight] Bypass token whitelist
Was this helpful?
Was this helpful?
uint256[26] public nftBoostLookup = [
0,
345,
540,
675,
765,
840,
900,
960,
1005,
1050,
1080,
1100,
1155,
1185,
1215,
1245,
1275,
1305,
1335,
1365,
1380,
1400,
1440,
1455,
1470,
1500
]; function testAudit_NFTBoost_LookUp() public {
address alice = makeAddr("Alice");
nft.mintAmount(alice, 25);
uint256[] memory aliceTokenIds1 = new uint256[](10);
for (uint i = 0; i < aliceTokenIds1.length; ++i) {
aliceTokenIds1[i] = i;
}
uint256 aliceBoostedValue1 = yeet.getBoostedValue(alice, 0.1 ether, aliceTokenIds1);
console.log("Alice boostedValue1:", aliceBoostedValue1);
uint256[] memory aliceTokenIds2 = new uint256[](12);
for (uint i = 0; i < aliceTokenIds2.length; ++i) {
aliceTokenIds2[i] = i;
}
uint256 aliceBoostedValue2 = yeet.getBoostedValue(alice, 0.1 ether, aliceTokenIds2);
console.log("Alice boostedValue2:", aliceBoostedValue2);
uint256 aliceTotalBoostedValue = aliceBoostedValue1 + aliceBoostedValue2;
console.log("Alice total boostedValue:", aliceTotalBoostedValue);
console.log();
address bob = makeAddr("Bob");
nft.mintAmount(bob, 25);
uint256[] memory bobTokenIds1 = new uint256[](11);
for (uint i = 0; i < bobTokenIds1.length; ++i) {
bobTokenIds1[i] = i;
}
uint256 bobBoostedValue1 = yeet.getBoostedValue(bob, 0.1 ether, bobTokenIds1);
console.log("Bob boostedValue1:", bobBoostedValue1);
uint256[] memory bobTokenIds2 = new uint256[](11);
for (uint i = 0; i < bobTokenIds2.length; ++i) {
bobTokenIds2[i] = i;
}
uint256 bobBoostedValue2 = yeet.getBoostedValue(bob, 0.1 ether, bobTokenIds2);
console.log("Bob boostedValue2:", bobBoostedValue2);
uint256 bobTotalBoostedValue = bobBoostedValue1 + bobBoostedValue2;
console.log("Bob total boostedValue:", bobTotalBoostedValue);
// The cruve is non-concave at points [10, 11, 12]
assertLt(bobTotalBoostedValue, aliceTotalBoostedValue);
}