Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 19,645 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Update Flight St... | 8715318 | 1926 days ago | IN | 0 ETH | 0.00003519 | ||||
Update Flight St... | 8579977 | 1947 days ago | IN | 0 ETH | 0.00083752 | ||||
Update Flight St... | 8470287 | 1964 days ago | IN | 0 ETH | 0.00021037 | ||||
Update Flight St... | 8453196 | 1967 days ago | IN | 0 ETH | 0.00003519 | ||||
Update Flight St... | 8413584 | 1973 days ago | IN | 0 ETH | 0.00023577 | ||||
Update Flight St... | 8412049 | 1973 days ago | IN | 0 ETH | 0.00007038 | ||||
Update Flight St... | 8389130 | 1977 days ago | IN | 0 ETH | 0.00004558 | ||||
Update Flight St... | 8385349 | 1978 days ago | IN | 0 ETH | 0.00004215 | ||||
Update Flight St... | 8385349 | 1978 days ago | IN | 0 ETH | 0.0000387 | ||||
Update Flight St... | 8353409 | 1983 days ago | IN | 0 ETH | 0.00035893 | ||||
Update Flight St... | 8343776 | 1984 days ago | IN | 0 ETH | 0.00003519 | ||||
Update Flight St... | 8340950 | 1984 days ago | IN | 0 ETH | 0.00007025 | ||||
Update Flight St... | 8340168 | 1985 days ago | IN | 0 ETH | 0.00004207 | ||||
Update Flight St... | 8322970 | 1987 days ago | IN | 0 ETH | 0.00003519 | ||||
Update Flight St... | 8319149 | 1988 days ago | IN | 0 ETH | 0.00003519 | ||||
Update Flight St... | 8285741 | 1993 days ago | IN | 0 ETH | 0.00003519 | ||||
Update Flight St... | 8280132 | 1994 days ago | IN | 0 ETH | 0.00003519 | ||||
Update Flight St... | 8278884 | 1994 days ago | IN | 0 ETH | 0.00003512 | ||||
Update Flight St... | 8273673 | 1995 days ago | IN | 0 ETH | 0.0007038 | ||||
Update Flight St... | 8252520 | 1998 days ago | IN | 0 ETH | 0.00010557 | ||||
Update Flight St... | 8248189 | 1999 days ago | IN | 0 ETH | 0.00003512 | ||||
Update Flight St... | 8219476 | 2003 days ago | IN | 0 ETH | 0.00070124 | ||||
Update Flight St... | 8202918 | 2006 days ago | IN | 0 ETH | 0.00003512 | ||||
Update Flight St... | 8187534 | 2008 days ago | IN | 0 ETH | 0.00003519 | ||||
Update Flight St... | 8179123 | 2010 days ago | IN | 0 ETH | 0.00003512 |
Loading...
Loading
Contract Name:
Fizzy
Compiler Version
v0.4.23+commit.124ca40d
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *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
- No Contract Security Audit Submitted- Submit Audit Here
[{"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
Deployed Bytecode
0x60806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634ef1a23a81146100715780636d28e80514610094578063b52c64c7146100e4578063b54cd45114610111578063beff6dbf1461012c575b600080fd5b34801561007d57600080fd5b5061009260043560ff60243516604435610156565b005b3480156100a057600080fd5b506100af600435602435610342565b60408051958652602086019490945263ffffffff928316858501529116606084015260ff166080830152519081900360a00190f35b3480156100f057600080fd5b5061009260043560243563ffffffff60443581169060643516608435610416565b34801561011d57600080fd5b506100926004356024356105f6565b34801561013857600080fd5b50610144600435610815565b60408051918252519081900360200190f35b600080543373ffffffffffffffffffffffffffffffffffffffff9081169116141561033c575060005b60008481526001602052604090205481101561033c57600084815260016020526040902080546101cc9190839081106101b457fe5b90600052602060002090600302016000015483610850565b156103345760008481526001602052604090208054829081106101eb57fe5b600091825260209091206003909102016002015468010000000000000000900460ff16151561033457600084815260016020526040902080548491908390811061023157fe5b906000526020600020906003020160020160086101000a81548160ff021916908360ff1602179055507f1a6e2df3135fe8e5b7327d8181b265f9d5b7c981402cd1b82faf820f0cc054bd8285600160008860001916600019168152602001908152602001600020848154811015156102a557fe5b600091825260208083206002600390930201919091015489835260019091526040909120805463ffffffff90921691869081106102de57fe5b600091825260209182902060026003909202010154604080519586529185019390935263ffffffff9182168482015264010000000090920416606083015260ff86166080830152519081900360a00190a161033c565b60010161017f565b50505050565b6000806000806000610352610874565b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116141561040b57600088815260016020526040902080548890811061039057fe5b60009182526020918290206040805160a0810182526003939093029091018054808452600182015494840185905260029091015463ffffffff808216938501849052640100000000820416606085018190526801000000000000000090910460ff1660808501819052919a5093985090965091945090925090505b509295509295909350565b61041e610874565b6000543373ffffffffffffffffffffffffffffffffffffffff908116911614156105ee578481602001818152505083816040019063ffffffff16908163ffffffff168152505082816060019063ffffffff16908163ffffffff168152505081816000019060001916908160001916815250506000816080019060ff16908160ff16815250506001600087600019166000191681526020019081526020016000208190806001815401808255809150509060018203906000526020600020906003020160009091929091909150600082015181600001906000191690556020820151816001015560408201518160020160006101000a81548163ffffffff021916908363ffffffff16021790555060608201518160020160046101000a81548163ffffffff021916908363ffffffff16021790555060808201518160020160086101000a81548160ff021916908360ff1602179055505050507f740610c472095940dbb97134b5a7c4f27fb03c69bd892fea239850fa66dc5480868585856040518085600019166000191681526020018463ffffffff1663ffffffff1681526020018363ffffffff1663ffffffff168152602001826000191660001916815260200194505050505060405180910390a15b505050505050565b6000805481903373ffffffffffffffffffffffffffffffffffffffff9081169116141561033c57506001905060005b60008481526001602052604090205481101561033c57600084815260016020526040902080548290811061065557fe5b600091825260209091206003909102016002015468010000000000000000900460ff16151561080d5760008481526001602081905260409091208054919350908290811061069f57fe5b9060005260206000209060030201600101548311156106bd57600291505b60008481526001602052604090208054839190839081106106da57fe5b60009182526020808320600260039093020191909101805460ff94909416680100000000000000000268ff0000000000000000199094169390931790925585815260019091526040902080547f1a6e2df3135fe8e5b7327d8181b265f9d5b7c981402cd1b82faf820f0cc054bd91908390811061075357fe5b600091825260208083206003909202909101548783526001909152604090912080548791908590811061078257fe5b600091825260208083206002600390930201919091015489835260019091526040909120805463ffffffff90921691869081106107bb57fe5b600091825260209182902060026003909202010154604080519586529185019390935263ffffffff9182168482015264010000000090920416606083015260ff85166080830152519081900360a00190a15b600101610625565b600080543373ffffffffffffffffffffffffffffffffffffffff9081169116141561084b57506000818152600160205260409020545b919050565b60408051918252805191829003602090810183209383529051918290030190201490565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152905600a165627a7a7230582076f8c6529e8a5a617f36f6cd29f5c96f4604a2603a7f3ce75bb53cf1495532330029
Swarm Source
bzzr://76f8c6529e8a5a617f36f6cd29f5c96f4604a2603a7f3ce75bb53cf149553233
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.