support incineration
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 45s
Details
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 45s
Details
This commit is contained in:
parent
d8d0122e31
commit
a49b42858a
|
@ -75,6 +75,15 @@ contract Forum is Reputation {
|
|||
uint depth
|
||||
) internal returns (int outboundAmount) {
|
||||
outboundAmount = (amount * citation.weightPercent) / 100;
|
||||
if (citation.targetPostIndex == type(uint256).max) {
|
||||
// Incineration
|
||||
require(
|
||||
outboundAmount >= 0,
|
||||
"Leaching from incinerator is forbidden"
|
||||
);
|
||||
_burn(address(this), uint(outboundAmount));
|
||||
return outboundAmount;
|
||||
}
|
||||
int balanceToOutbound = _edgeBalances[postIndex][
|
||||
citation.targetPostIndex
|
||||
];
|
||||
|
|
|
@ -215,5 +215,18 @@ describe('Forum', () => {
|
|||
expect(posts[2].reputation).to.equal(0);
|
||||
expect(posts[3].reputation).to.equal(0);
|
||||
});
|
||||
|
||||
it('should be able to incinerate reputation', async () => {
|
||||
await dao.addPost(account1, 'content-id-1', [
|
||||
{
|
||||
weightPercent: 50,
|
||||
targetPostIndex: ethers.MaxUint256,
|
||||
},
|
||||
]);
|
||||
await initiateValidationPool({ postIndex: 0 });
|
||||
expect(await dao.totalSupply()).to.equal(100);
|
||||
await dao.evaluateOutcome(0);
|
||||
expect((await dao.posts(0)).reputation).to.equal(50);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue