Contract 0xe083515d1541f2a9fd0ca03f189f5d321c73b872

 

TxHash Block Age From To Value [TxFee]
0x1d7a24aef478698c88cb1223cf78397bd278ecee49b44d94cc1b27b3ca33978572247947 hrs 14 mins ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000105186
0x16b364a6bcad3f0d222e4ddc96d47fdd531bd4f1abe403d1002d428354a2f38172190171 day 16 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.00017563
0x847fc0c445976420e46628e9d8f2501d6d1afc80c9a6b37e295e0adf2f4d552d72127423 days 4 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000070252
0xe0c23b7c6436e1b93e282ad22c7ce6fb17c252c25f6acd3d2bf0cb1a711bc3e772017195 days 19 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000038709
0xc93846ae6a6edf071c2298c686adddbc5c2c502265e230cfdaf8486877c7e3b772010455 days 22 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.0000667394
0x0ac9147da9e7108e531d45488ed5f611c8f53a1e62417036daa0790ebe59cc4871976556 days 15 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000042228
0x01d6b8a02ebab8cc22596cf0b6f9bd3182847e82998505f04d07a73cdaf378b571951107 days 4 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.0001441428
0x289f72329dd52d749c8dfe0d711dc6fa68151c41084b45f01ec175fcc7225afe71947917 days 5 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000052689
0xd1929fc9ec6d4782d6bd42c46c3bc7b829b1c3ff073475be9b00321d431818a771942247 days 8 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000073899
0xe09160d61ea0e3dc240e73ab5bb0531f6cd78eb58c5ae0f32a87f3074a00b0a871907158 days 1 hr ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.0000457574
0xafd707e555e964112b12840f4c01a5ff1ccc7b6e567b6ee381c07895176126ff71893378 days 8 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000042228
0xd42246f7db523127dfc459b8b5557798d641c71107d8dee73d381b4f3e7d882371845779 days 7 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.0000420744
0xd4903a4ce355c389e259a9a337f6752828d43012a8ce1b4805a2150ecb0b35b771838789 days 11 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000147798
0xcd859be1273f660b90094c288c0c19fcbb485b222e235970a6b0ebf4d47dfbdc71837149 days 11 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000216099
0xfa0845d63f80db75619b93840dde2ed34c537c71f44dbc0d52f4c326e217fadc71837129 days 11 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.0002162142
0xeff9b2f6ed3640b22b4d382cbc021b9090f3eafb188ace4fae886f0039bc1ae271837129 days 11 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000216099
0x9252af27ea09ef1d3c8d38cd9d31a26dfe0c737b34e29868f7dbea19354b0112717770910 days 17 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000038709
0x677d920710a2f1ed5357a4f7830c9f007213698bed1ace3b35b52aa428cd9ff9717731510 days 19 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000035126
0x6b077830e416d415ec84d8aa907b0febbb4cee9a0d27f02f4677f57c18c4e988717676510 days 21 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000035062
0x4243ef31f92ecee6fe2e53bf356b2dd82247f4bc90692d0bd7751742d0c5bb3a717266811 days 17 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000119927
0x5010e19428dcc24814e597aefe4b0eb35299e75e4645bd6d9a80f5114b367d15717261011 days 18 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000119927
0x9961922aca19ac8337c3a728036a00e3341da55b5761e7c56b8ed35d5812fda4716973012 days 7 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000168077
0xd9fcef44d15ca4588b479044481fefd54e27002bcee6ffb2540e66505d79340f716954612 days 8 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.0001559883
0x4e11776291f5d2071c32506bdbebf9ee73a8afb09d02751b244afcdbd2eed097716947512 days 9 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000045747
0x988722951941384f9a891cd971c34c3596d12f1d87dcf8bd5848b1546369a634716885312 days 12 hrs ago0x50e00de2c5cc4e456cf234fcb1a0efa367ed016e  IN   0xe083515d1541f2a9fd0ca03f189f5d321c73b8720 Ether0.000042228
[ Download CSV Export 

Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: Fizzy
Compiler Version: v0.4.23+commit.124ca40d
Optimization Enabled: Yes
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.19;

contract Fizzy {
  /*
  * Potential statuses for the Insurance struct
  * 0: ongoing
  * 1: insurance contract resolved normaly and the flight landed before the limit
  * 2: insurance contract resolved normaly and the flight landed after the limit
  * 3: insurance contract resolved because cancelled by the user
  * 4: insurance contract resolved because flight cancelled by the air company
  * 5: insurance contract resolved because flight redirected
  * 6: insurance contract resolved because flight diverted
  */
  struct Insurance {          // all the infos related to a single insurance
    bytes32 productId;           // ID string of the product linked to this insurance
    uint limitArrivalTime;    // maximum arrival time after which we trigger compensation (timestamp in sec)
    uint32 premium;           // amount of the premium
    uint32 indemnity;         // amount of the indemnity
    uint8 status;             // status of this insurance contract. See comment above for potential values
  }

  event InsuranceCreation(    // event sent when a new insurance contract is added to this smart contract
    bytes32 flightId,         // <carrier_code><flight_number>.<timestamp_in_sec_of_departure_date>
    uint32 premium,           // amount of the premium paid by the user
    uint32 indemnity,         // amount of the potential indemnity
    bytes32 productId            // ID string of the product linked to this insurance
  );

  /*
   * Potential statuses for the InsuranceUpdate event
   * 1: flight landed before the limit
   * 2: flight landed after the limit
   * 3: insurance contract cancelled by the user
   * 4: flight cancelled
   * 5: flight redirected
   * 6: flight diverted
   */
  event InsuranceUpdate(      // event sent when the situation of a particular insurance contract is resolved
    bytes32 productId,           // id string of the user linked to this account
    bytes32 flightId,         // <carrier_code><flight_number>.<timestamp_in_sec_of_departure_date>
    uint32 premium,           // amount of the premium paid by the user
    uint32 indemnity,         // amount of the potential indemnity
    uint8 status              // new status of the insurance contract. See above comment for potential values
  );

  address creator;            // address of the creator of the contract

  // All the insurances handled by this smart contract are contained in this mapping
  // key: a string containing the flight number and the timestamp separated by a dot
  // value: an array of insurance contracts for this flight
  mapping (bytes32 => Insurance[]) insuranceList;


  // ------------------------------------------------------------------------------------------ //
  // MODIFIERS / CONSTRUCTOR
  // ------------------------------------------------------------------------------------------ //

  /**
   * @dev This modifier checks that only the creator of the contract can call this smart contract
   */
  modifier onlyIfCreator {
    if (msg.sender == creator) _;
  }

  /**
   * @dev Constructor
   */
  function Fizzy() public {
    creator = msg.sender;
  }


  // ------------------------------------------------------------------------------------------ //
  // INTERNAL FUNCTIONS
  // ------------------------------------------------------------------------------------------ //

  function areStringsEqual (bytes32 a, bytes32 b) private pure returns (bool) {
    // generate a hash for each string and compare them
    return keccak256(a) == keccak256(b);
  }


  // ------------------------------------------------------------------------------------------ //
  // FUNCTIONS TRIGGERING TRANSACTIONS
  // ------------------------------------------------------------------------------------------ //

  /**
   * @dev Add a new insurance for the given flight
   * @param flightId <carrier_code><flight_number>.<timestamp_in_sec_of_departure_date>
   * @param limitArrivalTime Maximum time after which we trigger the compensation (timestamp in sec)
   * @param premium Amount of premium paid by the client
   * @param indemnity Amount (potentialy) perceived by the client
   * @param productId ID string of product linked to the insurance
   */
  function addNewInsurance(
    bytes32 flightId,
    uint limitArrivalTime,
    uint32 premium,
    uint32 indemnity,
    bytes32 productId)
  public
  onlyIfCreator {

    Insurance memory insuranceToAdd;
    insuranceToAdd.limitArrivalTime = limitArrivalTime;
    insuranceToAdd.premium = premium;
    insuranceToAdd.indemnity = indemnity;
    insuranceToAdd.productId = productId;
    insuranceToAdd.status = 0;

    insuranceList[flightId].push(insuranceToAdd);

    // send an event about the creation of this insurance contract
    InsuranceCreation(flightId, premium, indemnity, productId);
  }

  /**
   * @dev Update the status of a flight
   * @param flightId <carrier_code><flight_number>.<timestamp_in_sec_of_departure_date>
   * @param actualArrivalTime The actual arrival time of the flight (timestamp in sec)
   */
  function updateFlightStatus(
    bytes32 flightId,
    uint actualArrivalTime)
  public
  onlyIfCreator {

    uint8 newStatus = 1;

    // go through the list of all insurances related to the given flight
    for (uint i = 0; i < insuranceList[flightId].length; i++) {

      // we check this contract is still ongoing before updating it
      if (insuranceList[flightId][i].status == 0) {

        newStatus = 1;

        // if the actual arrival time is over the limit the user wanted,
        // we trigger the indemnity, which means status = 2
        if (actualArrivalTime > insuranceList[flightId][i].limitArrivalTime) {
          newStatus = 2;
        }

        // update the status of the insurance contract
        insuranceList[flightId][i].status = newStatus;

        // send an event about this update for each insurance
        InsuranceUpdate(
          insuranceList[flightId][i].productId,
          flightId,
          insuranceList[flightId][i].premium,
          insuranceList[flightId][i].indemnity,
          newStatus
        );
      }
    }
  }

  /**
   * @dev Manually resolve an insurance contract
   * @param flightId <carrier_code><flight_number>.<timestamp_in_sec_of_departure_date>
   * @param newStatusId ID of the resolution status for this insurance contract
   * @param productId ID string of the product linked to the insurance
   */
  function manualInsuranceResolution(
    bytes32 flightId,
    uint8 newStatusId,
    bytes32 productId)
  public
  onlyIfCreator {

    // go through the list of all insurances related to the given flight
    for (uint i = 0; i < insuranceList[flightId].length; i++) {

      // look for the insurance contract with the correct ID number
      if (areStringsEqual(insuranceList[flightId][i].productId, productId)) {

        // we check this contract is still ongoing before updating it
        if (insuranceList[flightId][i].status == 0) {

          // change the status of the insurance contract to the specified one
          insuranceList[flightId][i].status = newStatusId;

          // send an event about this update
          InsuranceUpdate(
            productId,
            flightId,
            insuranceList[flightId][i].premium,
            insuranceList[flightId][i].indemnity,
            newStatusId
          );

          return;
        }
      }
    }
  }

  function getInsurancesCount(bytes32 flightId) public view onlyIfCreator returns (uint) {
    return insuranceList[flightId].length;
  }

  function getInsurance(bytes32 flightId, uint index) public view onlyIfCreator returns (bytes32, uint, uint32, uint32, uint8) {
    Insurance memory ins = insuranceList[flightId][index];
    return (ins.productId, ins.limitArrivalTime, ins.premium, ins.indemnity, ins.status);
  }

}

Contract ABI
[{"constant":false,"inputs":[{"name":"flightId","type":"bytes32"},{"name":"newStatusId","type":"uint8"},{"name":"productId","type":"bytes32"}],"name":"manualInsuranceResolution","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"flightId","type":"bytes32"},{"name":"index","type":"uint256"}],"name":"getInsurance","outputs":[{"name":"","type":"bytes32"},{"name":"","type":"uint256"},{"name":"","type":"uint32"},{"name":"","type":"uint32"},{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"flightId","type":"bytes32"},{"name":"limitArrivalTime","type":"uint256"},{"name":"premium","type":"uint32"},{"name":"indemnity","type":"uint32"},{"name":"productId","type":"bytes32"}],"name":"addNewInsurance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"flightId","type":"bytes32"},{"name":"actualArrivalTime","type":"uint256"}],"name":"updateFlightStatus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"flightId","type":"bytes32"}],"name":"getInsurancesCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"flightId","type":"bytes32"},{"indexed":false,"name":"premium","type":"uint32"},{"indexed":false,"name":"indemnity","type":"uint32"},{"indexed":false,"name":"productId","type":"bytes32"}],"name":"InsuranceCreation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"productId","type":"bytes32"},{"indexed":false,"name":"flightId","type":"bytes32"},{"indexed":false,"name":"premium","type":"uint32"},{"indexed":false,"name":"indemnity","type":"uint32"},{"indexed":false,"name":"status","type":"uint8"}],"name":"InsuranceUpdate","type":"event"}]

Contract Creation Code
608060405234801561001057600080fd5b5060008054600160a060020a033316600160a060020a03199091161790556108ce8061003d6000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634ef1a23a81146100715780636d28e80514610094578063b52c64c7146100e4578063b54cd45114610111578063beff6dbf1461012c575b600080fd5b34801561007d57600080fd5b5061009260043560ff60243516604435610156565b005b3480156100a057600080fd5b506100af600435602435610342565b60408051958652602086019490945263ffffffff928316858501529116606084015260ff166080830152519081900360a00190f35b3480156100f057600080fd5b5061009260043560243563ffffffff60443581169060643516608435610416565b34801561011d57600080fd5b506100926004356024356105f6565b34801561013857600080fd5b50610144600435610815565b60408051918252519081900360200190f35b600080543373ffffffffffffffffffffffffffffffffffffffff9081169116141561033c575060005b60008481526001602052604090205481101561033c57600084815260016020526040902080546101cc9190839081106101b457fe5b90600052602060002090600302016000015483610850565b156103345760008481526001602052604090208054829081106101eb57fe5b600091825260209091206003909102016002015468010000000000000000900460ff16151561033457600084815260016020526040902080548491908390811061023157fe5b906000526020600020906003020160020160086101000a81548160ff021916908360ff1602179055507f1a6e2df3135fe8e5b7327d8181b265f9d5b7c981402cd1b82faf820f0cc054bd8285600160008860001916600019168152602001908152602001600020848154811015156102a557fe5b600091825260208083206002600390930201919091015489835260019091526040909120805463ffffffff90921691869081106102de57fe5b600091825260209182902060026003909202010154604080519586529185019390935263ffffffff9182168482015264010000000090920416606083015260ff86166080830152519081900360a00190a161033c565b60010161017f565b50505050565b6000806000806000610352610874565b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116141561040b57600088815260016020526040902080548890811061039057fe5b60009182526020918290206040805160a0810182526003939093029091018054808452600182015494840185905260029091015463ffffffff808216938501849052640100000000820416606085018190526801000000000000000090910460ff1660808501819052919a5093985090965091945090925090505b509295509295909350565b61041e610874565b6000543373ffffffffffffffffffffffffffffffffffffffff908116911614156105ee578481602001818152505083816040019063ffffffff16908163ffffffff168152505082816060019063ffffffff16908163ffffffff168152505081816000019060001916908160001916815250506000816080019060ff16908160ff16815250506001600087600019166000191681526020019081526020016000208190806001815401808255809150509060018203906000526020600020906003020160009091929091909150600082015181600001906000191690556020820151816001015560408201518160020160006101000a81548163ffffffff021916908363ffffffff16021790555060608201518160020160046101000a81548163ffffffff021916908363ffffffff16021790555060808201518160020160086101000a81548160ff021916908360ff1602179055505050507f740610c472095940dbb97134b5a7c4f27fb03c69bd892fea239850fa66dc5480868585856040518085600019166000191681526020018463ffffffff1663ffffffff1681526020018363ffffffff1663ffffffff168152602001826000191660001916815260200194505050505060405180910390a15b505050505050565b6000805481903373ffffffffffffffffffffffffffffffffffffffff9081169116141561033c57506001905060005b60008481526001602052604090205481101561033c57600084815260016020526040902080548290811061065557fe5b600091825260209091206003909102016002015468010000000000000000900460ff16151561080d5760008481526001602081905260409091208054919350908290811061069f57fe5b9060005260206000209060030201600101548311156106bd57600291505b60008481526001602052604090208054839190839081106106da57fe5b60009182526020808320600260039093020191909101805460ff94909416680100000000000000000268ff0000000000000000199094169390931790925585815260019091526040902080547f1a6e2df3135fe8e5b7327d8181b265f9d5b7c981402cd1b82faf820f0cc054bd91908390811061075357fe5b600091825260208083206003909202909101548783526001909152604090912080548791908590811061078257fe5b600091825260208083206002600390930201919091015489835260019091526040909120805463ffffffff90921691869081106107bb57fe5b600091825260209182902060026003909202010154604080519586529185019390935263ffffffff9182168482015264010000000090920416606083015260ff85166080830152519081900360a00190a15b600101610625565b600080543373ffffffffffffffffffffffffffffffffffffffff9081169116141561084b57506000818152600160205260409020545b919050565b60408051918252805191829003602090810183209383529051918290030190201490565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152905600a165627a7a7230582076f8c6529e8a5a617f36f6cd29f5c96f4604a2603a7f3ce75bb53cf1495532330029


   Swarm Source:
bzzr://76f8c6529e8a5a617f36f6cd29f5c96f4604a2603a7f3ce75bb53cf149553233
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.