EIPs/EIPS/eip-801.md

79 lines
1.9 KiB
Markdown
Raw Normal View History

---
EIP: 801
Title: ERC-801 Canary Standard
Author: ligi <ligi@ligi.de>
Type: Standard
Category: ERC
Status: Draft
Created: 2017-12-16
---
2017-12-17 02:46:58 +00:00
## Simple Summary
A standard interface for canary contracts.
## Abstract
The following standard allows the implementation of canaries within contracts.
This standard provides basic functionality to check if a canary is alive, keeping the canary alive and optionally manage feeders.
## Motivation
The canary can e.g. be used as a [warrant canary](https://en.wikipedia.org/wiki/Warrant_canary).
A standard interface allows other applications to easily interface with canaries on Ethereum - e.g. for visualizing the state, automated alarms, applications to feed the canary or contracts (e.g. insurance) that use the state.
## Specification
### Methods
#### isAlive()
2017-12-19 10:58:50 +00:00
Returns if the canary was fed properly to signal e.g. that no warrant was received.
2017-12-17 02:46:58 +00:00
``` js
function isAlive() constant returns (bool alive)
```
2017-12-19 10:58:50 +00:00
#### getBlockOfDeath()
2017-12-17 02:46:58 +00:00
2017-12-19 10:58:50 +00:00
Returns the block the canary died.
Throws if the canary is alive.
2017-12-17 02:46:58 +00:00
``` js
2017-12-19 10:58:50 +00:00
function getBlockOfDeath() constant returns (uint256 block)
2017-12-17 02:46:58 +00:00
```
2017-12-19 10:58:50 +00:00
#### getType()
2017-12-17 02:46:58 +00:00
2017-12-19 10:58:50 +00:00
Returns the type of the canary:
2017-12-17 02:46:58 +00:00
2017-12-19 10:58:50 +00:00
* `1` = Simple (just the pure interface as defined in this ERC)
* `2` = Single feeder (as defined in ERC-TBD)
* `3` = Single feeder with bad food (as defined in ERC-TBD)
* `4` = Multiple feeders (as defined in ERC-TBD)
* `5` = Multiple mandatory feeders (as defined in ERC-TBD)
* `6` = IOT (as defined in ERC-TBD)
2017-12-17 02:46:58 +00:00
2017-12-22 10:24:31 +00:00
`1` might also be used for a special purpose contract that does not need a special type but still wants to expose the functions and provide events as defined in this ERC.
2017-12-17 02:46:58 +00:00
``` js
2017-12-19 10:58:50 +00:00
function getType() constant returns (uint8 type)
2017-12-17 02:46:58 +00:00
```
### Events
2017-12-19 10:58:50 +00:00
#### RIP
2017-12-17 02:46:58 +00:00
2017-12-22 10:24:31 +00:00
MUST trigger when the contract is called the first time after the canary died.
2017-12-17 02:46:58 +00:00
``` js
2017-12-19 10:58:50 +00:00
event RIP()
2017-12-17 02:46:58 +00:00
```
## Implementation
TODO
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).