Skip to content

Commit

Permalink
Merge pull request #11 from ElrondNetwork/leftover-funds-fix
Browse files Browse the repository at this point in the history
leftover funds fix
  • Loading branch information
dorin-iancu authored Mar 22, 2022
2 parents 1d59637 + 6d7df88 commit 2361ab0
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 1 deletion.
92 changes: 92 additions & 0 deletions metabonding/mandos/clear_project_funds_not_deposited.scen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"steps": [
{
"step": "externalSteps",
"path": "init.scen.json"
},
{
"step": "scCall",
"txId": "add-first-project",
"tx": {
"from": "address:owner",
"to": "sc:meta",
"function": "addProject",
"arguments": [
"str:FirstProj",
"address:project_owner1",
"str:PROJ-123456",
"1,000,000,000",
"1",
"3",
"0"
],
"gasLimit": "10,000,000",
"gasPrice": "0"
},
"expect": {
"out": [],
"status": "0",
"logs": "*",
"gas": "*",
"refund": "*"
}
},
{
"step": "scQuery",
"txId": "get-all-project-ids-before",
"tx": {
"to": "sc:meta",
"function": "getAllProjectIds",
"arguments": []
},
"expect": {
"out": [
"str:FirstProj"
],
"status": "0",
"logs": "*"
}
},
{
"step": "setState",
"currentBlockInfo": {
"blockEpoch": "100"
}
},
{
"step": "scCall",
"txId": "clear-expired-projects",
"tx": {
"from": "address:owner",
"to": "sc:meta",
"function": "clearExpiredProjects",
"arguments": [],
"gasLimit": "10,000,000",
"gasPrice": "0"
},
"expect": {
"out": [
"str:completed"
],
"status": "0",
"logs": "*",
"gas": "*",
"refund": "*"
}
},
{
"step": "scQuery",
"txId": "get-all-project-ids-after",
"tx": {
"to": "sc:meta",
"function": "getAllProjectIds",
"arguments": []
},
"expect": {
"out": [],
"status": "0",
"logs": "*"
}
}
]
}
1 change: 0 additions & 1 deletion metabonding/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ pub trait ProjectModule: crate::common_storage::CommonStorageModule {
);

self.project_owner(&project_id).set(&project_owner);
self.leftover_project_funds(&project_id).set(&reward_supply);

let lkmex_reward_supply = &reward_supply * lkmex_rewards_percentage / MAX_PERCENTAGE;
let delegation_reward_supply = &reward_supply - &lkmex_reward_supply;
Expand Down
2 changes: 2 additions & 0 deletions metabonding/src/rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ pub trait RewardsModule:
);
require!(total_reward_supply == payment_amount, "Invalid amount");

self.leftover_project_funds(&project_id)
.set(&total_reward_supply);
self.rewards_deposited(&project_id).set(&true);
}

Expand Down

0 comments on commit 2361ab0

Please sign in to comment.