Skip to content
Verified contractPartial

Agreement

Address0xa2bd0c2b352990d6aaa5f58ec097ef7e905dbd63
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.4.4

 

Same code

2,863 more contracts

 

Details

Compiler
solc 0.4.4+commit.4633f3de
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
3,351,460
Creation transaction
0x2e6c85a679…bf2d44af70

Agreement.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity ^0.4.0;

contract Owned {
    address public owner;

    modifier onlyOwner() {
        if (msg.sender != owner) throw;
        _;
    }

    function Owned() {
        owner = msg.sender;
    }

    function transferOwner(address newOwner) onlyOwner {
        owner = newOwner;
    }
}

contract Approvable is Owned {
    mapping (address => bool) approvals;
    address[] public members;

    function Approvable(address buyer, address seller) {
        members = new address[](2);
        members[0] = buyer;
        members[1] = seller;
    }

    function setBuyer(address buyer) onlyOwner {
        approvals[buyer] = approvals[members[0]];
        members[0] = buyer;
    }

    function setSeller(address seller) onlyOwner {
        approvals[seller] = approvals[members[1]];
        members[1] = seller;
    }

    function approve() {
        approveSender();
    }

    function approveSender() internal {
        approveSenderAsMember();
    }

    function approveSenderAsMember() internal {
        setSenderApproval();
    }

    function setSenderApproval() internal {
        approvals[msg.sender] = true;
    }

    function approveAsMember(address member) onlyOwner {
        approveMember(member);
    }

    function approveMember(address member) internal onlyOwner {
        setApproval(member);
    }

    function setApproval(address member) internal onlyOwner {
        approvals[member] = true;
    }

    function isApprovedByMember(address member) constant returns (bool) {
        return approvals[member];
    }

    function buyerApproved() constant returns (bool) {
        return isApprovedByMember(members[0]);
    }

    function sellerApproved() constant returns (bool) {
        return isApprovedByMember(members[1]);
    }

    function isApproved() constant returns (bool) {
        for (uint i = 0; i < members.length; i++) {
            if (!isApprovedByMember(members[i])) return false;
        }
        return true;
    }
}

contract Agreement is Approvable {
    uint public principal;
    uint public buyerCollateralRatio;
    uint public sellerCollateralRatio;
    bytes8[] public tickers;
    uint[] public amounts;
    address public coinOracle;

    function Agreement(address buyer, address seller, uint _principal, uint _buyerCollateralRatio,
                       uint _sellerCollateralRatio, bytes8[] _tickers, uint[] _amounts, address _coinOracle)
        Approvable(buyer, seller)
    {
        principal = _principal;
        buyerCollateralRatio = _buyerCollateralRatio;
        sellerCollateralRatio = _sellerCollateralRatio;
        tickers = _tickers;
        amounts = _amounts;
        coinOracle = _coinOracle;
    }

    function numCoins() constant returns (uint) {
        return tickers.length;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.