ETH Price: $3,016.60 (-2.55%)
Gas: 9 Gwei

Contract

0xe083515D1541F2a9Fd0ca03f189F5D321C73B872
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Update Flight St...87153182019-10-10 17:15:411651 days ago1570727741IN
0xe083515D...21C73B872
0 ETH0.000035191
Update Flight St...85799772019-09-19 13:06:461672 days ago1568898406IN
0xe083515D...21C73B872
0 ETH0.0008375223.8
Update Flight St...84702872019-09-02 10:36:361689 days ago1567420596IN
0xe083515D...21C73B872
0 ETH0.000210376
Update Flight St...84531962019-08-30 18:38:021692 days ago1567190282IN
0xe083515D...21C73B872
0 ETH0.000035191
Update Flight St...84135842019-08-24 14:45:491698 days ago1566657949IN
0xe083515D...21C73B872
0 ETH0.000235776.7
Update Flight St...84120492019-08-24 8:58:321698 days ago1566637112IN
0xe083515D...21C73B872
0 ETH0.000070382
Update Flight St...83891302019-08-20 19:30:311702 days ago1566329431IN
0xe083515D...21C73B872
0 ETH0.000045581.3
Update Flight St...83853492019-08-20 5:20:321702 days ago1566278432IN
0xe083515D...21C73B872
0 ETH0.000042151.2
Update Flight St...83853492019-08-20 5:20:321702 days ago1566278432IN
0xe083515D...21C73B872
0 ETH0.00003871.1
Update Flight St...83534092019-08-15 6:08:111707 days ago1565849291IN
0xe083515D...21C73B872
0 ETH0.0003589310.2
Update Flight St...83437762019-08-13 18:27:281709 days ago1565720848IN
0xe083515D...21C73B872
0 ETH0.000035191
Update Flight St...83409502019-08-13 7:50:551709 days ago1565682655IN
0xe083515D...21C73B872
0 ETH0.000070252
Update Flight St...83401682019-08-13 4:55:271709 days ago1565672127IN
0xe083515D...21C73B872
0 ETH0.000042071.2
Update Flight St...83229702019-08-10 12:50:261712 days ago1565441426IN
0xe083515D...21C73B872
0 ETH0.000035191
Update Flight St...83191492019-08-09 22:50:251713 days ago1565391025IN
0xe083515D...21C73B872
0 ETH0.000035191
Update Flight St...82857412019-08-04 18:15:041718 days ago1564942504IN
0xe083515D...21C73B872
0 ETH0.000035191
Update Flight St...82801322019-08-03 21:28:261719 days ago1564867706IN
0xe083515D...21C73B872
0 ETH0.000035191
Update Flight St...82788842019-08-03 16:52:071719 days ago1564851127IN
0xe083515D...21C73B872
0 ETH0.000035121
Update Flight St...82736732019-08-02 21:31:461720 days ago1564781506IN
0xe083515D...21C73B872
0 ETH0.000703820
Update Flight St...82525202019-07-30 14:36:321723 days ago1564497392IN
0xe083515D...21C73B872
0 ETH0.000105573
Update Flight St...82481892019-07-29 22:27:071724 days ago1564439227IN
0xe083515D...21C73B872
0 ETH0.000035121
Update Flight St...82194762019-07-25 11:16:321728 days ago1564053392IN
0xe083515D...21C73B872
0 ETH0.0007012420
Update Flight St...82029182019-07-22 21:31:101731 days ago1563831070IN
0xe083515D...21C73B872
0 ETH0.000035121
Update Flight St...81875342019-07-20 12:16:371733 days ago1563624997IN
0xe083515D...21C73B872
0 ETH0.000035191
Update Flight St...81791232019-07-19 5:01:411734 days ago1563512501IN
0xe083515D...21C73B872
0 ETH0.000035121
View all transactions

Advanced mode:
Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Fizzy

Compiler Version
v0.4.23+commit.124ca40d

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-06-11
*/

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 Security Audit

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"}]

608060405234801561001057600080fd5b5060008054600160a060020a033316600160a060020a03199091161790556108ce8061003d6000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634ef1a23a81146100715780636d28e80514610094578063b52c64c7146100e4578063b54cd45114610111578063beff6dbf1461012c575b600080fd5b34801561007d57600080fd5b5061009260043560ff60243516604435610156565b005b3480156100a057600080fd5b506100af600435602435610342565b60408051958652602086019490945263ffffffff928316858501529116606084015260ff166080830152519081900360a00190f35b3480156100f057600080fd5b5061009260043560243563ffffffff60443581169060643516608435610416565b34801561011d57600080fd5b506100926004356024356105f6565b34801561013857600080fd5b50610144600435610815565b60408051918252519081900360200190f35b600080543373ffffffffffffffffffffffffffffffffffffffff9081169116141561033c575060005b60008481526001602052604090205481101561033c57600084815260016020526040902080546101cc9190839081106101b457fe5b90600052602060002090600302016000015483610850565b156103345760008481526001602052604090208054829081106101eb57fe5b600091825260209091206003909102016002015468010000000000000000900460ff16151561033457600084815260016020526040902080548491908390811061023157fe5b906000526020600020906003020160020160086101000a81548160ff021916908360ff1602179055507f1a6e2df3135fe8e5b7327d8181b265f9d5b7c981402cd1b82faf820f0cc054bd8285600160008860001916600019168152602001908152602001600020848154811015156102a557fe5b600091825260208083206002600390930201919091015489835260019091526040909120805463ffffffff90921691869081106102de57fe5b600091825260209182902060026003909202010154604080519586529185019390935263ffffffff9182168482015264010000000090920416606083015260ff86166080830152519081900360a00190a161033c565b60010161017f565b50505050565b6000806000806000610352610874565b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116141561040b57600088815260016020526040902080548890811061039057fe5b60009182526020918290206040805160a0810182526003939093029091018054808452600182015494840185905260029091015463ffffffff808216938501849052640100000000820416606085018190526801000000000000000090910460ff1660808501819052919a5093985090965091945090925090505b509295509295909350565b61041e610874565b6000543373ffffffffffffffffffffffffffffffffffffffff908116911614156105ee578481602001818152505083816040019063ffffffff16908163ffffffff168152505082816060019063ffffffff16908163ffffffff168152505081816000019060001916908160001916815250506000816080019060ff16908160ff16815250506001600087600019166000191681526020019081526020016000208190806001815401808255809150509060018203906000526020600020906003020160009091929091909150600082015181600001906000191690556020820151816001015560408201518160020160006101000a81548163ffffffff021916908363ffffffff16021790555060608201518160020160046101000a81548163ffffffff021916908363ffffffff16021790555060808201518160020160086101000a81548160ff021916908360ff1602179055505050507f740610c472095940dbb97134b5a7c4f27fb03c69bd892fea239850fa66dc5480868585856040518085600019166000191681526020018463ffffffff1663ffffffff1681526020018363ffffffff1663ffffffff168152602001826000191660001916815260200194505050505060405180910390a15b505050505050565b6000805481903373ffffffffffffffffffffffffffffffffffffffff9081169116141561033c57506001905060005b60008481526001602052604090205481101561033c57600084815260016020526040902080548290811061065557fe5b600091825260209091206003909102016002015468010000000000000000900460ff16151561080d5760008481526001602081905260409091208054919350908290811061069f57fe5b9060005260206000209060030201600101548311156106bd57600291505b60008481526001602052604090208054839190839081106106da57fe5b60009182526020808320600260039093020191909101805460ff94909416680100000000000000000268ff0000000000000000199094169390931790925585815260019091526040902080547f1a6e2df3135fe8e5b7327d8181b265f9d5b7c981402cd1b82faf820f0cc054bd91908390811061075357fe5b600091825260208083206003909202909101548783526001909152604090912080548791908590811061078257fe5b600091825260208083206002600390930201919091015489835260019091526040909120805463ffffffff90921691869081106107bb57fe5b600091825260209182902060026003909202010154604080519586529185019390935263ffffffff9182168482015264010000000090920416606083015260ff85166080830152519081900360a00190a15b600101610625565b600080543373ffffffffffffffffffffffffffffffffffffffff9081169116141561084b57506000818152600160205260409020545b919050565b60408051918252805191829003602090810183209383529051918290030190201490565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152905600a165627a7a7230582076f8c6529e8a5a617f36f6cd29f5c96f4604a2603a7f3ce75bb53cf1495532330029

Deployed Bytecode

0x60806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634ef1a23a81146100715780636d28e80514610094578063b52c64c7146100e4578063b54cd45114610111578063beff6dbf1461012c575b600080fd5b34801561007d57600080fd5b5061009260043560ff60243516604435610156565b005b3480156100a057600080fd5b506100af600435602435610342565b60408051958652602086019490945263ffffffff928316858501529116606084015260ff166080830152519081900360a00190f35b3480156100f057600080fd5b5061009260043560243563ffffffff60443581169060643516608435610416565b34801561011d57600080fd5b506100926004356024356105f6565b34801561013857600080fd5b50610144600435610815565b60408051918252519081900360200190f35b600080543373ffffffffffffffffffffffffffffffffffffffff9081169116141561033c575060005b60008481526001602052604090205481101561033c57600084815260016020526040902080546101cc9190839081106101b457fe5b90600052602060002090600302016000015483610850565b156103345760008481526001602052604090208054829081106101eb57fe5b600091825260209091206003909102016002015468010000000000000000900460ff16151561033457600084815260016020526040902080548491908390811061023157fe5b906000526020600020906003020160020160086101000a81548160ff021916908360ff1602179055507f1a6e2df3135fe8e5b7327d8181b265f9d5b7c981402cd1b82faf820f0cc054bd8285600160008860001916600019168152602001908152602001600020848154811015156102a557fe5b600091825260208083206002600390930201919091015489835260019091526040909120805463ffffffff90921691869081106102de57fe5b600091825260209182902060026003909202010154604080519586529185019390935263ffffffff9182168482015264010000000090920416606083015260ff86166080830152519081900360a00190a161033c565b60010161017f565b50505050565b6000806000806000610352610874565b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116141561040b57600088815260016020526040902080548890811061039057fe5b60009182526020918290206040805160a0810182526003939093029091018054808452600182015494840185905260029091015463ffffffff808216938501849052640100000000820416606085018190526801000000000000000090910460ff1660808501819052919a5093985090965091945090925090505b509295509295909350565b61041e610874565b6000543373ffffffffffffffffffffffffffffffffffffffff908116911614156105ee578481602001818152505083816040019063ffffffff16908163ffffffff168152505082816060019063ffffffff16908163ffffffff168152505081816000019060001916908160001916815250506000816080019060ff16908160ff16815250506001600087600019166000191681526020019081526020016000208190806001815401808255809150509060018203906000526020600020906003020160009091929091909150600082015181600001906000191690556020820151816001015560408201518160020160006101000a81548163ffffffff021916908363ffffffff16021790555060608201518160020160046101000a81548163ffffffff021916908363ffffffff16021790555060808201518160020160086101000a81548160ff021916908360ff1602179055505050507f740610c472095940dbb97134b5a7c4f27fb03c69bd892fea239850fa66dc5480868585856040518085600019166000191681526020018463ffffffff1663ffffffff1681526020018363ffffffff1663ffffffff168152602001826000191660001916815260200194505050505060405180910390a15b505050505050565b6000805481903373ffffffffffffffffffffffffffffffffffffffff9081169116141561033c57506001905060005b60008481526001602052604090205481101561033c57600084815260016020526040902080548290811061065557fe5b600091825260209091206003909102016002015468010000000000000000900460ff16151561080d5760008481526001602081905260409091208054919350908290811061069f57fe5b9060005260206000209060030201600101548311156106bd57600291505b60008481526001602052604090208054839190839081106106da57fe5b60009182526020808320600260039093020191909101805460ff94909416680100000000000000000268ff0000000000000000199094169390931790925585815260019091526040902080547f1a6e2df3135fe8e5b7327d8181b265f9d5b7c981402cd1b82faf820f0cc054bd91908390811061075357fe5b600091825260208083206003909202909101548783526001909152604090912080548791908590811061078257fe5b600091825260208083206002600390930201919091015489835260019091526040909120805463ffffffff90921691869081106107bb57fe5b600091825260209182902060026003909202010154604080519586529185019390935263ffffffff9182168482015264010000000090920416606083015260ff85166080830152519081900360a00190a15b600101610625565b600080543373ffffffffffffffffffffffffffffffffffffffff9081169116141561084b57506000818152600160205260409020545b919050565b60408051918252805191829003602090810183209383529051918290030190201490565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152905600a165627a7a7230582076f8c6529e8a5a617f36f6cd29f5c96f4604a2603a7f3ce75bb53cf1495532330029

Swarm Source

bzzr://76f8c6529e8a5a617f36f6cd29f5c96f4604a2603a7f3ce75bb53cf149553233

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.