You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the retireAll method inside the MVDFunctionalityProposalContract blocks its compilation by raising a stack too deep error.
This is the current method implementation:
/** @dev Allows the sender to retire all the tokens used for voting in this proposal. * @param proposalId proposal identifier. */function retireAll(uint256proposalId) publicoverrideduringSurvey(proposalId) {
require(_proposals[proposalId].getItemProposalWeightFunctionalityAddress !=address(0), "");
IGetItemProposalWeightFunctionality functionality =IGetItemProposalWeightFunctionality(_proposals[proposalId].getItemProposalWeightFunctionalityAddress);
uint256 total =0;
address[] memory collections = _userCollectionAddresses[proposalId][msg.sender];
for (uint j =0; j < collections.length; j++) {
uint256[] memory amounts =newuint256[](_userObjectIds[proposalId][msg.sender][collections[j]].length);
for (uint256 i =0; i < _userObjectIds[proposalId][msg.sender][collections[j]].length; i++) {
require(_accept[proposalId][msg.sender][_userObjectIds[proposalId][msg.sender][collections[j]][i]] + _refuse[proposalId][msg.sender][_userObjectIds[proposalId][msg.sender][collections[j]][i]] >0, "");
}
for (uint256 i =0; i < _userObjectIds[proposalId][msg.sender][collections[j]].length; i++) {
uint256 tokenWeight = functionality.getItemProposalWeight(collections[j], _userObjectIds[proposalId][msg.sender][collections[j]][i]);
if (tokenWeight >0) {
uint256 acpt = _accept[proposalId][msg.sender][_userObjectIds[proposalId][msg.sender][collections[j]][i]];
uint256 rfs = _refuse[proposalId][msg.sender][_userObjectIds[proposalId][msg.sender][collections[j]][i]];
uint256 wAcpt = acpt / tokenWeight;
uint256 wRfs = rfs / tokenWeight;
amounts[i] = wAcpt + wRfs;
_accept[proposalId][msg.sender][_userObjectIds[proposalId][msg.sender][collections[j]][i]] =0;
_refuse[proposalId][msg.sender][_userObjectIds[proposalId][msg.sender][collections[j]][i]] =0;
_totalAccept[proposalId] -= acpt;
_totalRefuse[proposalId] -= rfs;
total += (acpt + rfs);
} else {
amounts[i] =0;
}
}
IEthItemCollection(collections[j]).safeBatchTransferFrom(address(this), msg.sender, amounts, _userObjectIds[proposalId][msg.sender][collections[j]], "");
}
emitRetireAll(msg.sender, proposalId, total);
}
It raises a stack too deep because there are too many nested mappings; a solution could be splitting the function into two retireAllAccept and retireAllRefuse.
The text was updated successfully, but these errors were encountered:
Currently the
retireAll
method inside the MVDFunctionalityProposalContract blocks its compilation by raising astack too deep
error.This is the current method implementation:
It raises a stack too deep because there are too many nested mappings; a solution could be splitting the function into two
retireAllAccept
andretireAllRefuse
.The text was updated successfully, but these errors were encountered: