Skip to content

Commit 831ac9a

Browse files
committed
Fix wallet balance discrepancy
Fixes naddison36#194 Add wallet balance functionality to `src/contracts/Associations.sol`. * **State Variable** - Add `walletBalance` to store the wallet balance. * **Constructor** - Initialize `walletBalance` to 0. * **Event** - Add `WalletBalanceUpdated` event to emit when the wallet balance is updated. * **Functions** - Add `getWalletBalance` to return the wallet balance. - Add `updateWalletBalance` to update the wallet balance and emit `WalletBalanceUpdated` event. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/naddison36/sol2uml/issues/194?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent cbc9bff commit 831ac9a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/contracts/Associations.sol

+13
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ abstract contract Associations is
252252
ITAS
253253
{
254254
uint256 public someInt;
255+
uint256 public walletBalance;
255256

256257
uint256[] someIntArray;
257258
address[FileConstant] constantLengthArray;
@@ -306,12 +307,24 @@ abstract contract Associations is
306307
Processed
307308
}
308309

310+
event WalletBalanceUpdated(uint256 newBalance);
311+
309312
constructor(
310313
ConstructorParamAssoc constructorAssoc,
311314
ConstructorParamAbstract constructorAbstract,
312315
ConstructorParamInterface constructorInterface
313316
) {
314317
someInt = 11;
318+
walletBalance = 0;
319+
}
320+
321+
function getWalletBalance() public view returns (uint256) {
322+
return walletBalance;
323+
}
324+
325+
function updateWalletBalance(uint256 newBalance) public {
326+
walletBalance = newBalance;
327+
emit WalletBalanceUpdated(newBalance);
315328
}
316329

317330
function someFunction(

0 commit comments

Comments
 (0)