Skip to content

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