Skip to content

Commit 8c20843

Browse files
authored
feat: add test cases (#10)
1 parent be27e9d commit 8c20843

File tree

7 files changed

+9389
-1444
lines changed

7 files changed

+9389
-1444
lines changed

contracts/Main.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pragma solidity ^0.7.4;
44
import "./SavingGroups.sol";
55

66
contract Main{
7-
event RoundCreated(SavingGroups childTanda);
7+
event RoundCreated(SavingGroups childRound);
88

99
function createRound(uint256 _warranty, uint256 _saving, uint256 _groupSize, uint256 _payTime, uint256 _withdrawTime) external payable returns(address) {
1010

contracts/Ownable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract contract Ownable {
3030

3131
modifier isPayAmountCorrect(uint256 userBalance, uint256 cashIn) {
3232
//Verifies if it is the users round to widraw
33-
require(userBalance == cashIn, "Fondos Insuficientes");
33+
require(userBalance == cashIn, "Monto incorrecto");
3434
_;
3535
}
3636
}

contracts/SavingGroups.sol

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ contract SavingGroups is Ownable{
4545
uint256 public payTime = 86400 * 7;
4646
uint256 public withdrawTime = 86400 * 7;
4747

48+
// BloinxEvents
49+
event RegisterUser(address indexed user, uint256 indexed turn);
50+
event RemoveUser(address indexed user, uint256 indexed turn);
51+
event PayTurn(address indexed user);
52+
event PayLateTurn(address indexed user, uint256 indexed turn);
53+
4854
constructor(
4955
uint256 _cashIn,
5056
uint256 _saveAmount,
@@ -70,7 +76,7 @@ contract SavingGroups is Ownable{
7076
}
7177

7278
modifier atStage(Stages _stage) {
73-
require(stage == _stage);
79+
require(stage == _stage, "Stage incorrecto para ejecutar la funcion");
7480
_;
7581
}
7682

@@ -92,6 +98,7 @@ contract SavingGroups is Ownable{
9298
0
9399
);
94100
addressOrderList[_userTurn-1]=msg.sender; //store user
101+
emit RegisterUser(msg.sender, _userTurn);
95102
}
96103

97104
function removeUser(uint256 _userTurn)
@@ -107,6 +114,7 @@ contract SavingGroups is Ownable{
107114
users[removeAddress].userAddr.transfer(cashIn);
108115
}
109116
addressOrderList[_userTurn-1]=address(0);
117+
emit RemoveUser(users[removeAddress].userAddr, _userTurn);
110118
usersCounter--;
111119
cashOutUsers--;
112120
users[removeAddress].currentRoundFlag = false;
@@ -140,6 +148,7 @@ contract SavingGroups is Ownable{
140148
} else {
141149
totalSaveAmount = totalSaveAmount + msg.value;
142150
users[msg.sender].saveAmountFlag = true;
151+
emit PayTurn(msg.sender);
143152
}
144153
}
145154

0 commit comments

Comments
 (0)