Skip to content

Fix execution hashes#22

Open
c-future wants to merge 9 commits intomainfrom
fix_executionHashes
Open

Fix execution hashes#22
c-future wants to merge 9 commits intomainfrom
fix_executionHashes

Conversation

@c-future
Copy link
Collaborator

No description provided.

Copy link
Collaborator Author

@c-future c-future left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also get latest from main branch

address[] public allFeeTokens;

//reward identifier -> distro, execution and virtual pool data
mapping(address => FeeDistro) public feeTokens;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need a mapping for all fee distro info for each veasset project , because we have one booster for each veasset project , so it should be a single state for fee distro , execution hash and array of fee tokens (in case there is multiple fee tokens) you could use openzipplein EnumerableSet for fee tokens , and add new mapping for fee token => lockfee (reward address)

function setFeeInfo(
uint256 _lockFeesIncentive,
uint256 _stakerLockFeesIncentive,
address _feeToken,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to pass array of fee tokens even if it is only one to support multiple fee tokens


address _feeToken = IFeeDistro(feeDistro).token();
if (feeToken != _feeToken) {
if (feeTokens[_feeToken].active != true) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so here we need an iteration on fee tokens and check if it is exist or not

address lockFees = IRewardFactory(rewardFactory).CreateTokenRewards(_feeToken, lockRewards);

if (_feeToken != veAsset) {
IRewards(stakerLockRewards).addReward(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will create new reward pool (lookFees) for each fee tokens and use mapping to save it


} else {
feeTokens[_feeToken].distro = _distro;
feeTokens[_feeToken].executionHash = _executionHash;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be move to up with these two lines for update the state

lockFeesIncentive = _lockFeesIncentive;
stakerLockFeesIncentive = _stakerLockFeesIncentive;

//claim fee rewards
IStaker(staker).claimFees(feeDistro, feeToken);
//send fee rewards to reward contract
IStaker(staker).claimFees(feeTokens[feeToken].distro, feeToken, _executionData);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as I understand _executionData will have the function signature without the inputs , so I think the inputs are missing here when pass it to function claimFee

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_executionData is both the function signature and the arguments. This is how we enforce that the arguments passed into claimFees can't be tampered with <3

// transfer to the VE3D Locker and queue the new rewards
if (_stakerLockFeesIncentive > 0) {
IERC20Upgradeable(feeToken).safeTransfer(stakerLockRewards, _stakerLockFeesIncentive);
IRewards(stakerLockRewards).queueNewRewards(feeToken, _stakerLockFeesIncentive);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after call the function , it needs iteration for the fee tokens list

IFeeDistro(_distroContract).claim();
// execute arbitrary enforced claim
(bool success, bytes memory result) = _distroContract.call(executionData);
require(success, "!fail");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you test it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested that we were successfully able to claim rewards yup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants