-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmart-contract.sol
49 lines (37 loc) · 1.01 KB
/
smart-contract.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract WorkRoll {
struct Agreement {
address client;
address freelancer;
uint amount;
uint[] milestones;
}
Agreement public newAgreement;
constructor(
address _client,
address _freelancer,
uint _amount,
uint[] memory _milestones
) {
newAgreement.client = _client;
newAgreement.freelancer = _freelancer;
newAgreement.amount = _amount;
for (uint i = 0; i < _milestones.length; i++) {
newAgreement.milestones.push(_milestones[i]);
}
}
function checkPay(uint _globalAmount, uint[] memory _globalSplit) public pure returns(bool) {
uint splitPay = 0;
for (uint i = 0; i < _globalSplit.length ; i++)
{
splitPay = splitPay + _globalSplit[i];
}
if(_globalAmount == splitPay){
return true;
}
else{
return false;
}
}
}