Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded Q -> 3 from #664 [1675726122175] #701

Closed
c4-judge opened this issue Feb 6, 2023 · 5 comments
Closed

Upgraded Q -> 3 from #664 [1675726122175] #701

c4-judge opened this issue Feb 6, 2023 · 5 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue duplicate-528 satisfactory satisfies C4 submission criteria; eligible for awards withdrawn by judge Special case: this finding was auto-generated by a judge and is now withdrawn; it can be ignored

Comments

@c4-judge
Copy link
Contributor

c4-judge commented Feb 6, 2023

Judge has assessed an item in Issue #664 as 3 risk. The relevant finding follows:

[L-2] ERC1155 Quest: withdrawRemainingTokens should factor in total number of receipts minted before withdrawal

Issue: There may be users with unredeemed receipts who will not be able to claim if all the remaining tokens are withdrawn to the owner after a quest has ended. Ideally, the process should be the same as ERC20 where this is taken into account.

Suggested Fix: Include the Quest Factory contract in the ERC1155 contract as well (e.g. through the constructor similar to receiptContractAddress_)

In withdrawRemainingTokens() function:

uint unclaimedTokens       = (receiptRedeemers() - redeemedTokens);
uint256 nonClaimableTokens = IERC1155(rewardToken).balanceOf(address(this)) - unclaimedTokens;
IERC1155(rewardToken).safeTransferFrom(address(this), to_, nonClaimableTokens, nonClaimableTokens, '0x00');

/// @notice Call the QuestFactory contract to get the amount of receipts that have been minted
/// @return The amount of receipts that have been minted for the given quest
	function receiptRedeemers() public view returns (uint256) {
		return questFactoryContract.getNumberMinted(questId);
 }

Link to Github Reference: https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc1155Quest.sol#L52-L63

@c4-judge c4-judge added the 3 (High Risk) Assets can be stolen/lost/compromised directly label Feb 6, 2023
@c4-judge
Copy link
Contributor Author

c4-judge commented Feb 6, 2023

kirk-baird marked the issue as duplicate of #42

@c4-judge c4-judge closed this as completed Feb 6, 2023
@c4-judge c4-judge added duplicate-42 downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax withdrawn by judge Special case: this finding was auto-generated by a judge and is now withdrawn; it can be ignored and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Feb 6, 2023
@c4-judge
Copy link
Contributor Author

This auto-generated issue was withdrawn by kirk-baird

@c4-judge c4-judge reopened this Feb 10, 2023
@c4-judge
Copy link
Contributor Author

This previously downgraded issue has been upgraded by kirk-baird

@c4-judge c4-judge added 3 (High Risk) Assets can be stolen/lost/compromised directly and removed downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Feb 10, 2023
@c4-judge
Copy link
Contributor Author

kirk-baird marked the issue as satisfactory

@c4-judge c4-judge added satisfactory satisfies C4 submission criteria; eligible for awards duplicate-528 and removed duplicate-42 labels Feb 14, 2023
@c4-judge c4-judge added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Feb 23, 2023
@c4-judge
Copy link
Contributor Author

kirk-baird changed the severity to 2 (Med Risk)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue duplicate-528 satisfactory satisfies C4 submission criteria; eligible for awards withdrawn by judge Special case: this finding was auto-generated by a judge and is now withdrawn; it can be ignored
Projects
None yet
Development

No branches or pull requests

1 participant