Skip to content

Commit

Permalink
change how funding/reward is calculated (#56)
Browse files Browse the repository at this point in the history
* change transfer to multiply before dividing on close bounty
* change e2e to create two funding rounds from the same acc to test that partial funding works
  • Loading branch information
moshmage authored Oct 2, 2022
1 parent e8e4cd5 commit e8e71b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/bepro/NetworkV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ contract NetworkV2 is Governed, ReentrancyGuard {
for (uint256 i = 0; i <= proposal.details.length - 1; i++) {
INetworkV2.ProposalDetail memory detail = proposal.details[i];
INetworkV2.BountyConnector memory award = INetworkV2.BountyConnector(address(this), bounty.id, detail.percentage, "dev");
require(erc20.transfer(detail.recipient, proposalAmount.div(100).mul(detail.percentage)), "5");
require(erc20.transfer(detail.recipient, proposalAmount.mul(detail.percentage).div(100)), "5");

if (address(registry) != address(0)) {
if (address(registry.bountyToken()) != address(0)) {
Expand Down
5 changes: 4 additions & 1 deletion test/models/network-v2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ describe(`NetworkV2`, () => {

web3Connection.switchToAccount(Alice.privateKey);
await bountyTransactional.approve(network.contractAddress!, AMOUNT_1M);
await hasTxBlockNumber(network.fundBounty(bountyId, 10000));
await hasTxBlockNumber(network.fundBounty(bountyId, 10000/2));
await hasTxBlockNumber(network.fundBounty(bountyId, 10000/2));

web3Connection.switchToAccount(Admin.privateKey);
await increaseTime(62, web3Connection.Web3);
Expand Down Expand Up @@ -392,6 +393,8 @@ describe(`NetworkV2`, () => {

it(`Alice withdraws from bounty`, async () => {
await hasTxBlockNumber(network.withdrawFundingReward(bountyId, 0));
expect(await rewardToken.getTokenAmount(Alice.address)).to.be.eq((500).toString());
await hasTxBlockNumber(network.withdrawFundingReward(bountyId, 1));
expect(await rewardToken.getTokenAmount(Alice.address)).to.be.eq((1000).toString());
});
});
Expand Down

0 comments on commit e8e71b8

Please sign in to comment.