-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrainable dao
62 lines (27 loc) · 961 Bytes
/
trainable dao
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
56
57
58
59
A Dedicated DAO for training and bartering A.I enabled services and products:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract AI_Training_DAO {
struct Member {
bool exists;
uint256 contribution;
}
mapping(address => Member) public members;
function join() public {
require(!members[msg.sender].exists, "Already a member.");
members[msg.sender] = Member(true, 0);
}
function contribute(uint256 _amount) public {
require(members[msg.sender].exists, "Not a member.");
members[msg.sender].contribution += _amount;
}
function trainAI() public view returns (bool) {
uint256 totalContribution = 0;
for (uint256 i = 0; i < members.length; i++) {
if (members[i].exists) {
totalContribution += members[i].contribution;
}
}
return totalContribution >= 1000;
}
}