主页EIPs
EIPsERC-900
ERC-900

Simple Staking Interface

StagnantStandards Track: ERC
创建时间: 2018-02-22
Dean Eigenmann <dean@tokenate.io>, Jorge Izquierdo <jorge@aragon.one>
社区讨论原文链接编辑
1 分钟了解
欢迎补充好内容
去提交
相关视频
欢迎补充好内容
去提交
正文

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

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

Copyright and related rights waived via CC0.

扩展阅读
欢迎补充好内容
去提交
相关项目
欢迎补充好内容
去提交

不想错过最新的 EIP 动态?

订阅 EIPs Fun 周刊以跟进相关更新,建⽴你与 EIP 之间的连接 ,更好地建设以太坊。

详情
支持以太坊贡献者,推动生态建设
资源
GitHub
支持社区