Skip to content

第一课作业#12

Open
amber2data wants to merge 3 commits intosvblockdong:masterfrom
amber2data:master
Open

第一课作业#12
amber2data wants to merge 3 commits intosvblockdong:masterfrom
amber2data:master

Conversation

@amber2data
Copy link
Copy Markdown

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
Copy Markdown
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