mirror of https://github.com/nucypher/nucypher.git
Minimum ERC900 connectors in StakingEscrow
This allows us to be interoperable with Aragon Aggregatorpull/1917/head
parent
91bc901020
commit
b30e645c85
|
@ -0,0 +1,8 @@
|
|||
pragma solidity ^0.6.5;
|
||||
|
||||
// Minimum interface to interact with Aragon's Aggregator
|
||||
interface IERC900History {
|
||||
function totalStakedForAt(address addr, uint256 blockNumber) external view returns (uint256);
|
||||
function totalStakedAt(uint256 blockNumber) external view returns (uint256);
|
||||
function supportsHistory() external pure returns (bool);
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
pragma solidity ^0.6.5;
|
||||
|
||||
import "aragon/interfaces/IERC900History.sol";
|
||||
import "contracts/Issuer.sol";
|
||||
import "contracts/lib/Bits.sol";
|
||||
import "contracts/lib/Snapshot.sol";
|
||||
|
@ -38,11 +39,12 @@ interface WorkLockInterface {
|
|||
* Each staker that locks their tokens will receive some compensation
|
||||
* @dev |v4.1.1|
|
||||
*/
|
||||
contract StakingEscrow is Issuer {
|
||||
using SafeMath for uint256;
|
||||
contract StakingEscrow is Issuer, IERC900History {
|
||||
|
||||
using AdditionalMath for uint256;
|
||||
using AdditionalMath for uint16;
|
||||
using Bits for uint256;
|
||||
using SafeMath for uint256;
|
||||
using Snapshot for uint128[];
|
||||
|
||||
event Deposited(address indexed staker, uint256 value, uint16 periods);
|
||||
|
@ -1320,6 +1322,19 @@ contract StakingEscrow is Issuer {
|
|||
endPeriod = downtime.endPeriod;
|
||||
}
|
||||
|
||||
//------------------ ERC900 connectors ----------------------
|
||||
|
||||
function totalStakedForAt(address _owner, uint256 _blockNumber) external view override returns (uint256){
|
||||
return stakerInfo[_owner].history.getValueAt(_blockNumber);
|
||||
}
|
||||
|
||||
function totalStakedAt(uint256 _blockNumber) external view override returns (uint256){
|
||||
return balanceHistory.getValueAt(_blockNumber);
|
||||
}
|
||||
|
||||
function supportsHistory() public pure override returns (bool){
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------Upgradeable------------------------
|
||||
/**
|
||||
|
|
3
setup.py
3
setup.py
|
@ -119,7 +119,8 @@ PACKAGE_DATA = ['network/templates/basic_status.j2',
|
|||
'blockchain/eth/sol/source/zeppelin/utils/*',
|
||||
'blockchain/eth/sol/source/zeppelin/ownership/*',
|
||||
'blockchain/eth/sol/source/zeppelin/token/ERC20/*',
|
||||
'blockchain/eth/sol/source/aragon/staking/*'
|
||||
'blockchain/eth/sol/source/aragon/contracts/*',
|
||||
'blockchain/eth/sol/source/aragon/interfaces/*',
|
||||
]
|
||||
|
||||
setup(name=ABOUT['__title__'],
|
||||
|
|
Loading…
Reference in New Issue