mirror of https://github.com/status-im/EIPs.git
ERC900: Simple Staking Interface (#910)
* Create eip-900.md * Update eip-900.md * Update eip-900.md * Update eip-900.md * Update eip-900.md * Update eip-900.md * Update eip-900.md * Update eip-900.md
This commit is contained in:
parent
3ba7271546
commit
5331b3942c
|
@ -0,0 +1,108 @@
|
|||
---
|
||||
eip: 900
|
||||
title: Simple Staking Interface
|
||||
author: Dean Eigenmann <dean@tokenate.io>, Jorge Izquierdo <jorge@aragon.one>
|
||||
type: Standards Track
|
||||
category: ERC
|
||||
status: Final
|
||||
created: 2018-02-22
|
||||
discussions-to: https://github.com/ethereum/EIPs/issues/900
|
||||
---
|
||||
|
||||
## Abstract
|
||||
|
||||
The following standard describes a common staking interface allowing for easy to use staking systems. The interface is kept simple allowing for various use cases to be implemented. This standard describes the common functionality for staking as well as providing information on stakes.
|
||||
|
||||
## Motivation
|
||||
|
||||
As we move to more token models, having a common staking interface which is familiar to users can be useful. The common interface can be used by a variety of applications, this common interface could be beneficial especially to things like Token curated registries which have recently gained popularity.
|
||||
|
||||
## Specification
|
||||
|
||||
```solidity
|
||||
interface Staking {
|
||||
|
||||
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
|
||||
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
|
||||
|
||||
function stake(uint256 amount, bytes data) public;
|
||||
function stakeFor(address user, uint256 amount, bytes data) public;
|
||||
function unstake(uint256 amount, bytes data) public;
|
||||
function totalStakedFor(address addr) public view returns (uint256);
|
||||
function totalStaked() public view returns (uint256);
|
||||
function token() public view returns (address);
|
||||
function supportsHistory() public pure returns (bool);
|
||||
|
||||
// optional
|
||||
function lastStakedFor(address addr) public view returns (uint256);
|
||||
function totalStakedForAt(address addr, uint256 blockNumber) public view returns (uint256);
|
||||
function totalStakedAt(uint256 blockNumber) public view returns (uint256);
|
||||
}
|
||||
```
|
||||
|
||||
### stake
|
||||
|
||||
Stakes a certain amount of tokens, this MUST transfer the given amount from the user.
|
||||
|
||||
*The data field can be used to add signalling information in more complex staking applications*
|
||||
|
||||
MUST trigger ```Staked``` event.
|
||||
|
||||
### stakeFor
|
||||
|
||||
Stakes a certain amount of tokens, this MUST transfer the given amount from the caller.
|
||||
|
||||
*The data field can be used to add signalling information in more complex staking applications*
|
||||
|
||||
MUST trigger ```Staked``` event.
|
||||
|
||||
### unstake
|
||||
|
||||
Unstakes a certain amount of tokens, this SHOULD return the given amount of tokens to the user, if unstaking is currently not possible the function MUST revert.
|
||||
|
||||
*The data field can be used to remove signalling information in more complex staking applications*
|
||||
|
||||
MUST trigger ```Unstaked``` event.
|
||||
|
||||
### totalStakedFor
|
||||
|
||||
Returns the current total of tokens staked for an address.
|
||||
|
||||
### totalStaked
|
||||
|
||||
Returns the current total of tokens staked.
|
||||
|
||||
### token
|
||||
|
||||
Address of the token being used by the staking interface.
|
||||
|
||||
### supportsHistory
|
||||
|
||||
MUST return true if the optional history functions are implemented, otherwise false.
|
||||
|
||||
### lastStakedFor
|
||||
|
||||
***OPTIONAL:** As not all staking systems require a complete history, this function is optional.*
|
||||
|
||||
Returns last block address staked at.
|
||||
|
||||
### totalStakedForAt
|
||||
|
||||
***OPTIONAL:** As not all staking systems require a complete history, this function is optional.*
|
||||
|
||||
Returns total amount of tokens staked at block for address.
|
||||
|
||||
### totalStakedAt
|
||||
|
||||
***OPTIONAL:** As not all staking systems require a complete history, this function is optional.*
|
||||
|
||||
Returns the total tokens staked at block.
|
||||
|
||||
## Implementation
|
||||
|
||||
- [Stakebank](https://github.com/HarbourProject/stakebank)
|
||||
- [Aragon](https://github.com/aragon/aragon-apps/pull/101)
|
||||
- [PoS Staking](https://github.com/maticnetwork/contracts/blob/master/contracts/StakeManager.sol)
|
||||
|
||||
## Copyright
|
||||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
|
Loading…
Reference in New Issue