mirror of
https://github.com/tornadocash/tornado-aggregator.git
synced 2024-12-04 15:14:36 +01:00
updates
This commit is contained in:
parent
98f4d06e14
commit
91dcea570c
@ -6,5 +6,32 @@ pragma experimental ABIEncoderV2;
|
||||
import "./GovernanceAggregator.sol";
|
||||
import "./PriceAggregator.sol";
|
||||
import "./SwapAggregator.sol";
|
||||
import "./MinerAggregator.sol";
|
||||
|
||||
contract Aggregator is GovernanceAggregator, PriceAggregator, SwapAggregator {}
|
||||
contract Aggregator is GovernanceAggregator, PriceAggregator, SwapAggregator, MinerAggregator {
|
||||
function miningData(
|
||||
Miner miner,
|
||||
address[] calldata instances,
|
||||
RewardSwap swap
|
||||
)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
uint256[] memory _rates,
|
||||
uint256 balance,
|
||||
uint256 poolWeight
|
||||
)
|
||||
{
|
||||
_rates = minerRates(miner, instances);
|
||||
(balance, poolWeight) = swapState(swap);
|
||||
}
|
||||
|
||||
function marketData(
|
||||
address[] calldata fromTokens,
|
||||
uint256[] calldata oneUnitAmounts,
|
||||
RewardSwap swap
|
||||
) external view returns (uint256[] memory prices, uint256 balance) {
|
||||
prices = getPricesInETH(fromTokens, oneUnitAmounts);
|
||||
balance = swap.tornVirtualBalance();
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ contract GovernanceAggregator {
|
||||
Governance governance,
|
||||
uint256 from,
|
||||
uint256 to
|
||||
) external view returns (Proposal[] memory proposals) {
|
||||
) public view returns (Proposal[] memory proposals) {
|
||||
uint256 proposalCount = governance.proposalCount();
|
||||
to = to == 0 ? proposalCount : to;
|
||||
proposals = new Proposal[](proposalCount);
|
||||
@ -56,11 +56,7 @@ contract GovernanceAggregator {
|
||||
}
|
||||
}
|
||||
|
||||
function getGovernanceBalances(Governance governance, address[] calldata accs)
|
||||
external
|
||||
view
|
||||
returns (uint256[] memory amounts)
|
||||
{
|
||||
function getGovernanceBalances(Governance governance, address[] calldata accs) public view returns (uint256[] memory amounts) {
|
||||
amounts = new uint256[](accs.length);
|
||||
for (uint256 i = 0; i < accs.length; i++) {
|
||||
amounts[i] = governance.balances(accs[i]);
|
||||
|
15
contracts/MinerAggregator.sol
Normal file
15
contracts/MinerAggregator.sol
Normal file
@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "tornado-anonymity-mining/contracts/Miner.sol";
|
||||
|
||||
contract MinerAggregator {
|
||||
function minerRates(Miner miner, address[] calldata instances) public view returns (uint256[] memory _rates) {
|
||||
_rates = new uint256[](instances.length);
|
||||
for (uint256 i = 0; i < _rates.length; i++) {
|
||||
_rates[i] = miner.rates(instances[i]);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ pragma experimental ABIEncoderV2;
|
||||
import "tornado-anonymity-mining/contracts/RewardSwap.sol";
|
||||
|
||||
contract SwapAggregator {
|
||||
function swapState(RewardSwap swap) external view returns (uint256 balance, uint256 poolWeight) {
|
||||
function swapState(RewardSwap swap) public view returns (uint256 balance, uint256 poolWeight) {
|
||||
balance = swap.tornVirtualBalance();
|
||||
poolWeight = swap.poolWeight();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user