Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/contracts/freelancer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,26 @@ contract Freelance{
uint freelancerLength = 0;

address internal cUsdTokenAddress = 0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1;
address internal mainAddress = 0xb7BF999D966F287Cd6A1541045999aD5f538D3c6;
address internal owner;
uint internal fee;

constructor(uint _fee){
owner = msg.sender;
fee = _fee;
}

function addFreelancer(
string memory _name,
string memory _imageUrl,
string memory _jobDescription,
uint _amount,
bool _isHired,
uint _ratingLength
)public{
require(
IERC20Token(cUsdTokenAddress).transferFrom(
msg.sender,
mainAddress,
1000000000000000000
owner,
fee
),
"Transaction could not be performed"
);
Expand All @@ -57,7 +62,7 @@ contract Freelance{
_imageUrl,
_jobDescription,
_amount,
_isHired,
false,
0,
_ratingLength,
0
Expand Down Expand Up @@ -108,8 +113,14 @@ contract Freelance{
);
freelancers[_index].isHired = true;
}

function updateFee(uint _fee) public{
require(msg.sender == owner, "Only owner can call this function");
fee = _fee;
}


function getFreelancerLength() public view returns (uint) {
return (freelancerLength);
}
}
}