From 44ddb271d1ba2c5fbbbca1b552cc43f2ecfad3db Mon Sep 17 00:00:00 2001 From: Brindrajsinh Chauhan <91854080+Brindrajsinh-Chauhan@users.noreply.github.com> Date: Fri, 11 Feb 2022 14:45:31 -0500 Subject: [PATCH] Update freelancer.sol --- src/contracts/freelancer.sol | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/contracts/freelancer.sol b/src/contracts/freelancer.sol index 40fba9e..40ff354 100644 --- a/src/contracts/freelancer.sol +++ b/src/contracts/freelancer.sol @@ -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" ); @@ -57,7 +62,7 @@ contract Freelance{ _imageUrl, _jobDescription, _amount, - _isHired, + false, 0, _ratingLength, 0 @@ -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); } -} \ No newline at end of file +}