diff --git a/src/RaidGeldUtils.sol b/src/RaidGeldUtils.sol index b680008..b327489 100644 --- a/src/RaidGeldUtils.sol +++ b/src/RaidGeldUtils.sol @@ -98,8 +98,8 @@ library RaidGeldUtils { function calculateBossReward(uint8 bossLevel, uint256 baseReward) internal pure returns (uint256) { // TODO: This could as well just be pre-calculated uint256 cumulativeChance = getBossCumulativeChance(bossLevel); // 0 - 1e18 range - uint256 rewardMultiplier = ((2 * (1e18 - cumulativeChance)) ** 2) / 1e18; - return (baseReward * rewardMultiplier); + uint256 rewardMultiplier = ((2 * (1e18 - cumulativeChance)) ** 2); + return (baseReward * rewardMultiplier) / 1e18 ** 2; } // Calculates whether user survives the fight diff --git a/test/RaidGeldUtils.t.sol b/test/RaidGeldUtils.t.sol index 2859ab1..d5997e0 100644 --- a/test/RaidGeldUtils.t.sol +++ b/test/RaidGeldUtils.t.sol @@ -142,7 +142,7 @@ contract raid_geldTest is Test { function test_4_print_boss_rewards() public { uint256 total = 0; for (uint8 i = 0; i < 7; i++) { - uint256 reward = RaidGeldUtils.calculateBossReward(i, 500); + uint256 reward = RaidGeldUtils.calculateBossReward(i, 500e18); console.log("Reward", i,reward); total += reward; }