Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ build/
.idea
/types
/typechain
out
cache_forge

deployed-contracts.json

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
17 changes: 11 additions & 6 deletions contracts/rewards/RewardsDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,17 @@ abstract contract RewardsDistributor is IRewardsDistributor {
* @return The boosted balance of the account.
**/
function boostedBalance(address account, uint256 balance) public view returns (uint256) {
uint256 _boosted = (balance * 20) / 100;
uint256 boostedBalance_ = balance / 5;

if (staking == IVotes(address(0))) {
return boostedBalance_;
}

uint256 _stake = staking.getVotes(account);

uint256 _adjusted = ((balance * _stake * 80) / maxBoostRequirement) / 100;
boostedBalance_ += (balance * _stake / maxBoostRequirement) * 4 / 5;

// because of this we are able to max out the boost by 5x
uint256 _boostedBalance = _boosted + _adjusted;
return _boostedBalance > balance ? balance : _boostedBalance;
return boostedBalance_ > balance ? balance : boostedBalance_;
}

/**
Expand Down Expand Up @@ -472,9 +475,11 @@ abstract contract RewardsDistributor is IRewardsDistributor {
uint256 assetUnit = 10 ** _assets[userAssetBalance.asset].decimals;
(, uint256 nextIndex) = _getAssetIndex(rewardData, userAssetBalance.totalSupply, assetUnit);

uint256 userBalance = boostedBalance(user, userAssetBalance.userBalance);

return
_getRewards(
userAssetBalance.userBalance,
userBalance,
nextIndex,
rewardData.usersData[user].index,
assetUnit
Expand Down
8 changes: 8 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[profile.default]
src = 'contracts'
solc_version = "0.8.12"
# auto_detect_solc = true
out = 'out'
libs = ['node_modules', 'lib']
test = 'test'
cache_path = 'cache_forge'
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NETWORKS_RPC_URL } from './helper-hardhat-config';

import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import "@nomicfoundation/hardhat-foundry";
import '@nomicfoundation/hardhat-chai-matchers';
import '@typechain/hardhat';
import '@tenderly/hardhat-tenderly';
Expand Down
Loading