Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第一课作业 #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

第一课作业 #12

wants to merge 3 commits into from

Conversation

amber2data
Copy link

pragma solidity ^0.4.14;

contract Payroll{
uint salary = 1 ether;
address Lisa;
address Employee;
uint constant payDuration = 8 seconds;
uint lastPayday = now;

function set(uint new salary) {
  salary = newsalary * 200 wei;
}

function set(address Employee) {
   Lisa = Employee;
}

function addFund() payable returns (uint) {
    return this.balance;
}

function calculateRunaway() returns(uint) {
    return this.balance / salary;
}

function hasEnoughFund() returns(bool) {
    return calculateRunaway() > 0;
}

function getPaid()  {
    if (msg.sender != frank) {
        revert();
    }
    uint nextPayDay = lastPayday + payDuration;
    if (nextPayDay > now) {
        revert();
    }
        lastPayday = nextPayDay;
        frank.transfer(salary);
}

}

@amber2data
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant