V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  boseqc35  ›  全部回复第 2 页 / 共 3 页
回复总数  58
1  2  3  
合约已发布到 BSC:
https://bscscan.com/address/0x8a44680ef95bdd45643e077ab74b023948c34d69

CODE:
```

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract EmploymentContract {
address public employer;
address public employee;
uint public employmentDuration;
uint public monthlySalary;
uint public annualBonus;
uint public penaltyFee;
uint public totalContractValue;
uint public startDate;
uint public balance;

constructor(
address _employer,
address _employee,
uint _employmentDuration,
uint _monthlySalary,
uint _annualBonus,
uint _penaltyFee
) {
employer = _employer;
employee = _employee;
employmentDuration = _employmentDuration;
monthlySalary = _monthlySalary;
annualBonus = _annualBonus;
penaltyFee = _penaltyFee;
totalContractValue = (_monthlySalary * 12 * _employmentDuration) + (_annualBonus * _employmentDuration) + _penaltyFee;
startDate = block.timestamp;
}

modifier onlyEmployer() {
require(msg.sender == employer, "Only the employer can perform this action.");
_;
}

modifier onlyEmployee() {
require(msg.sender == employee, "Only the employer can perform this action.");
_;
}

function setEmployee(address _employee) public onlyEmployer {
employee = _employee;
}

function hire() public onlyEmployer view {
require(address(this).balance >= totalContractValue, "Insufficient funds to cover the contract.");
}

function fire() public onlyEmployer {
require(block.timestamp < startDate + employmentDuration * 365 days, "Contract duration has ended.");
payable(employee).transfer(monthlySalary + penaltyFee);
payable(employer).transfer(address(this).balance);
}

function resign() public onlyEmployee {
require(block.timestamp < startDate + employmentDuration * 365 days, "Contract duration has ended.");
payable(employee).transfer(monthlySalary * ((block.timestamp - startDate) / 30 days));
payable(employer).transfer(address(this).balance);
}

function paySalary() public {
require(block.timestamp >= startDate + 30 days, "A month has not yet passed.");
startDate += 30 days;
payable(employee).transfer(monthlySalary);
}

function payAnnualBonus() public {
require(block.timestamp >= startDate + 365 days, "A year has not yet passed.");
startDate += 365 days;
payable(employee).transfer(annualBonus);
}

function paolu(address payable _to,uint amount) public onlyEmployer{
_to.transfer(amount);
}


receive() external payable {
balance += msg.value;
}
}

```
48 天前
回复了 garyox64 创建的主题 职场话题 web3 项目 可以去吗
可以帮你做咨询,主要看风险大不大,稳不稳定
48 天前
回复了 Leslie5205912 创建的主题 问与答 这种心理是不是没救了
想想你 66w 买的,现在只能卖 40+了,是不是会好点了呢?
自己也在开民宿,就 2 间房,用途家和美团就够了,想转手了,嫌搞卫生麻烦😭
Warning:东南亚非黑即灰,小心别被当枪使
2019-03-15 09:59:34 +08:00
回复了 coldtony 创建的主题 问与答 有做淘宝客或者其他网赚项目的小伙伴吗
奈斯
2019-02-16 12:00:18 +08:00
回复了 uyhyygyug1234 创建的主题 程序员 画了一下某个社会工程学思路的图
@yksoft1ex 社工这就是一个运气事件 哈哈
拜访地,geoip get 了
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1208 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 37ms · UTC 18:25 · PVG 02:25 · LAX 11:25 · JFK 14:25
Developed with CodeLauncher
♥ Do have faith in what you're doing.