refactor(check)!: remove check #6
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(Highly opinionated change)
The
checkAPI andwithdraw_creation_feevariables are confusing and causes an accounting error with campaign pools.The flow of a campaign goes like this
depositreward_allcheckif necessaryIn
deposit, an amount for the campaign is specified, and inreward_all, the amount is deducted from the campaign and added to the user pool. Contradictorily,checkputs the amount back to the campaign and causes accounting errors.For example, imagine I create a campaign
nibiru-itn-rewardswith1000unibiand reward1000unibito addressnibi1gc6vpl9j0ty8tkt53787zps9ezc70kj88hluw4. Thereward_allfunction subtracts1000unibifrom the campaignnibiru-itn-rewardsand allocates it tonibi1gc6vpl9j0ty8tkt53787zps9ezc70kj88hluw4. Note that the campaign's amount is zero now.If I call
checkwith campaign idnibiru-itn-rewardsand with amount1000unibi, it resets the campaign amount to1000unibi, which breaks accounting because now I can reward another1000unibito another user even though the total amount ofunibiin the contract hasn't changed.In reality, if I wanted to withdraw any surplus from the campaign, I could just
cancelthe campaign and use thewithdrawfunction. The existence of this alternate route means thatcheckandwithdraw_creation_feeare unnecessary and cause additional headaches. Removing them simplifies the contract and reduces the size of the state, which gives us some gas improvements.BREAKING CHANGE: Removes
checkandwithdraw_creation_fee.