-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfund.sol
55 lines (47 loc) · 1.19 KB
/
fund.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Fund {
address private owner;
Hocsinh[] public arrayHocsinh;
uint256 public tongtien;
struct Hocsinh {
address _Address;
uint256 _Tien;
string _Hoten;
}
constructor() {
owner = msg.sender;
tongtien = 0;
}
event CoHocSinhVuaNapTien(
uint256 tongtien,
address vi,
uint256 tien,
string hoten
);
function napTien(string memory hoten) public payable {
if (msg.value > 0) {
arrayHocsinh.push(Hocsinh(msg.sender, msg.value, hoten));
tongtien = tongtien + msg.value;
emit CoHocSinhVuaNapTien(tongtien, msg.sender, msg.value, hoten);
}
}
function hocsinhCounter() public view returns (uint256) {
return arrayHocsinh.length;
}
function get_one_Hocsinh(uint256 thutu)
public
view
returns (
address,
uint256,
string memory
)
{
return (
arrayHocsinh[thutu]._Address,
arrayHocsinh[thutu]._Tien,
arrayHocsinh[thutu]._Hoten
);
}
}