Verified contractExactAGPL-3.0-only
DesignatedVoting
Address0xea7c2df8ab95bf0af91f8e4034b493733aca21df
- Balance
0 ETH
- Transactions
221
- Compiler
solc 0.6.12
- Same code
48 more contracts
Details
- Compiler
- solc 0.6.12+commit.27d51765
- Language
- solidity
- Optimization
- Yes, 199 runs
- License
- AGPL-3.0-only
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 12,008,280
- Creation transaction
- 0xb0992c4be2…118c063bf9
106 files
The source code is large: one file is shown at a time. Choose a file in the list.
- contracts/oracle/implementation/DesignatedVoting.solmain4.94 KB
- @openzeppelin/contracts/GSN/Context.sol1.08 KB
- @openzeppelin/contracts/access/Ownable.sol2.19 KB
- @openzeppelin/contracts/cryptography/ECDSA.sol3.63 KB
- @openzeppelin/contracts/math/Math.sol768 B
- @openzeppelin/contracts/math/SafeMath.sol5.18 KB
- @openzeppelin/contracts/math/SignedSafeMath.sol1.83 KB
- @openzeppelin/contracts/token/ERC20/ERC20.sol10.75 KB
- @openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol8.21 KB
- @openzeppelin/contracts/token/ERC20/IERC20.sol2.66 KB
- @openzeppelin/contracts/token/ERC20/SafeERC20.sol3.77 KB
- @openzeppelin/contracts/utils/Address.sol2.61 KB
- @openzeppelin/contracts/utils/Arrays.sol1.44 KB
- @openzeppelin/contracts/utils/Counters.sol1.48 KB
- @openzeppelin/contracts/utils/SafeCast.sol3.72 KB
- @uniswap/lib/contracts/libraries/Babylonian.sol1.58 KB
- @uniswap/lib/contracts/libraries/FullMath.sol1.27 KB
- @uniswap/lib/contracts/libraries/TransferHelper.sol1.81 KB
- @uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol2.42 KB
- @uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol3.53 KB
- contracts/common/implementation/AddressWhitelist.sol3.18 KB
- contracts/common/implementation/ExpandedERC20.sol3 KB
- contracts/common/implementation/FixedPoint.sol28.77 KB
- contracts/common/implementation/Lockable.sol2.7 KB
- contracts/common/implementation/MultiRole.sol9.34 KB
- contracts/common/implementation/Testable.sol1.73 KB
- contracts/common/implementation/TestnetERC20.sol1.27 KB
- contracts/common/implementation/Timer.sol894 B
- contracts/common/implementation/Withdrawable.sol2.34 KB
- contracts/common/interfaces/ExpandedIERC20.sol915 B
- contracts/common/interfaces/IERC20Standard.sol901 B
- contracts/common/interfaces/OneSplit.sol623 B
- contracts/common/interfaces/VaultInterface.sol571 B
- contracts/common/test/BasicERC20.sol2.35 KB
- contracts/common/test/MultiRoleTest.sol873 B
- contracts/common/test/OneSplitMock.sol1.7 KB
- contracts/common/test/ReentrancyAttack.sol513 B
- contracts/common/test/ReentrancyMock.sol1.92 KB
- contracts/common/test/SignedFixedPointTest.sol6.27 KB
- contracts/common/test/TestableTest.sol564 B
- contracts/common/test/TokenSender.sol450 B
- contracts/common/test/UnsignedFixedPointTest.sol6.08 KB
- contracts/common/test/VaultMock.sol669 B
- contracts/common/test/WithdrawableTest.sol750 B
- contracts/financial-templates/common/EmergencyShutdownable.sol1.9 KB
- contracts/financial-templates/common/FeePayer.sol16.79 KB
- contracts/financial-templates/common/FundingRateApplier.sol16.42 KB
- contracts/financial-templates/common/SyntheticToken.sol3.16 KB
- contracts/financial-templates/common/TokenFactory.sol1.31 KB
- contracts/financial-templates/common/financial-product-libraries/FinancialProductLibrary.sol2.47 KB
- contracts/financial-templates/common/financial-product-libraries/PreExpirationIdentifierTransformationFinancialProductLibrary.sol3.75 KB
- contracts/financial-templates/common/financial-product-libraries/StructuredNoteFinancialProductLibrary.sol5.8 KB
- contracts/financial-templates/demo/DepositBox.sol18.47 KB
- contracts/financial-templates/expiring-multiparty/ExpiringMultiParty.sol738 B
- contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyCreator.sol7.66 KB
- contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyLib.sol988 B
- contracts/financial-templates/expiring-multiparty/Liquidatable.sol32.28 KB
- contracts/financial-templates/expiring-multiparty/PricelessPositionManager.sol50.4 KB
- contracts/financial-templates/perpetual-multiparty/ConfigStore.sol8.54 KB
- contracts/financial-templates/perpetual-multiparty/ConfigStoreInterface.sol1.21 KB
- contracts/financial-templates/perpetual-multiparty/Perpetual.sol747 B
- contracts/financial-templates/perpetual-multiparty/PerpetualCreator.sol8.47 KB
- contracts/financial-templates/perpetual-multiparty/PerpetualLib.sol939 B
- contracts/financial-templates/perpetual-multiparty/PerpetualLiquidatable.sol30.97 KB
- contracts/financial-templates/perpetual-multiparty/PerpetualPositionManager.sol38.94 KB
- contracts/financial-templates/test/ExpiringMultiPartyMock.sol2.54 KB
- contracts/financial-templates/test/FinancialProductLibraryTest.sol2.4 KB
- contracts/financial-templates/test/FundingRateApplierTest.sol1.74 KB
- contracts/oracle/implementation/Constants.sol636 B
- contracts/oracle/implementation/ContractCreator.sol1.2 KB
- contracts/oracle/implementation/DesignatedVotingFactory.sol2.21 KB
- contracts/oracle/implementation/FinancialContractsAdmin.sol1.15 KB
- contracts/oracle/implementation/Finder.sol1.71 KB
- contracts/oracle/implementation/Governor.sol11.86 KB
- contracts/oracle/implementation/IdentifierWhitelist.sol2.53 KB
- contracts/oracle/implementation/OptimisticOracle.sol27.32 KB
- contracts/oracle/implementation/Registry.sol8.48 KB
- contracts/oracle/implementation/ResultComputation.sol4.37 KB
- contracts/oracle/implementation/Store.sol7.88 KB
- contracts/oracle/implementation/TokenMigrator.sol2.5 KB
- contracts/oracle/implementation/VoteTiming.sol2.89 KB
- contracts/oracle/implementation/Voting.sol44.88 KB
- contracts/oracle/implementation/VotingToken.sol1.48 KB
- contracts/oracle/implementation/test/GovernorTest.sol777 B
- contracts/oracle/implementation/test/MockAdministratee.sol693 B
- contracts/oracle/implementation/test/OptimisticRequesterTest.sol3.26 KB
- contracts/oracle/implementation/test/ResultComputationTest.sol1.03 KB
- contracts/oracle/implementation/test/VoteTimingTest.sol833 B
- contracts/oracle/implementation/test/VotingTest.sol948 B
- contracts/oracle/interfaces/AdministrateeInterface.sol1.22 KB
- contracts/oracle/interfaces/FinderInterface.sol1 KB
- contracts/oracle/interfaces/IdentifierWhitelistInterface.sol1.19 KB
- contracts/oracle/interfaces/OptimisticOracleInterface.sol11.84 KB
- contracts/oracle/interfaces/OracleAncillaryInterface.sol2.35 KB
- contracts/oracle/interfaces/OracleInterface.sol1.81 KB
- contracts/oracle/interfaces/RegistryInterface.sol2.42 KB
- contracts/oracle/interfaces/StoreInterface.sol2.12 KB
- contracts/oracle/interfaces/VotingAncillaryInterface.sol8.46 KB
- contracts/oracle/interfaces/VotingInterface.sol8.04 KB
- contracts/oracle/test/MockOracle.sol4.44 KB
- contracts/oracle/test/MockOracleAncillary.sol4.9 KB
- contracts/oracle/test/VotingAncillaryInterfaceTest.sol3.01 KB
- contracts/oracle/test/VotingInterfaceTest.sol2.98 KB
- contracts/trader/uniswap-broker/UniswapBroker.sol7.89 KB
- contracts/umips/Umip3Upgrader.sol2.68 KB
- contracts/umips/VotingUpgrader.sol3.1 KB
contracts/oracle/implementation/DesignatedVoting.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/MultiRole.sol";
import "../../common/implementation/Withdrawable.sol";
import "../interfaces/VotingAncillaryInterface.sol";
import "../interfaces/FinderInterface.sol";
import "./Constants.sol";
/**
* @title Proxy to allow voting from another address.
* @dev Allows a UMA token holder to designate another address to vote on their behalf.
* Each voter must deploy their own instance of this contract.
*/
contract DesignatedVoting is Withdrawable {
/****************************************
* INTERNAL VARIABLES AND STORAGE *
****************************************/
enum Roles {
Owner, // Can set the Voter role. Is also permanently permissioned as the minter role.
Voter // Can vote through this contract.
}
// Reference to the UMA Finder contract, allowing Voting upgrades to be performed
// without requiring any calls to this contract.
FinderInterface private finder;
/**
* @notice Construct the DesignatedVoting contract.
* @param finderAddress keeps track of all contracts within the system based on their interfaceName.
* @param ownerAddress address of the owner of the DesignatedVoting contract.
* @param voterAddress address to which the owner has delegated their voting power.
*/
constructor(
address finderAddress,
address ownerAddress,
address voterAddress
) public {
_createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), ownerAddress);
_createExclusiveRole(uint256(Roles.Voter), uint256(Roles.Owner), voterAddress);
_setWithdrawRole(uint256(Roles.Owner));
finder = FinderInterface(finderAddress);
}
/****************************************
* VOTING AND REWARD FUNCTIONALITY *
****************************************/
/**
* @notice Forwards a commit to Voting.
* @param identifier uniquely identifies the feed for this vote. EG BTC/USD price pair.
* @param time specifies the unix timestamp of the price being voted on.
* @param hash the keccak256 hash of the price you want to vote for and a random integer salt value.
*/
function commitVote(
bytes32 identifier,
uint256 time,
bytes memory ancillaryData,
bytes32 hash
) external onlyRoleHolder(uint256(Roles.Voter)) {
_getVotingAddress().commitVote(identifier, time, ancillaryData, hash);
}
/**
* @notice Forwards a batch commit to Voting.
* @param commits struct to encapsulate an `identifier`, `time`, `hash` and optional `encryptedVote`.
*/
function batchCommit(VotingAncillaryInterface.CommitmentAncillary[] calldata commits)
external
onlyRoleHolder(uint256(Roles.Voter))
{
_getVotingAddress().batchCommit(commits);
}
/**
* @notice Forwards a reveal to Voting.
* @param identifier voted on in the commit phase. EG BTC/USD price pair.
* @param time specifies the unix timestamp of the price being voted on.
* @param price used along with the `salt` to produce the `hash` during the commit phase.
* @param salt used along with the `price` to produce the `hash` during the commit phase.
*/
function revealVote(
bytes32 identifier,
uint256 time,
int256 price,
bytes memory ancillaryData,
int256 salt
) external onlyRoleHolder(uint256(Roles.Voter)) {
_getVotingAddress().revealVote(identifier, time, price, ancillaryData, salt);
}
/**
* @notice Forwards a batch reveal to Voting.
* @param reveals is an array of the Reveal struct which contains an identifier, time, price and salt.
*/
function batchReveal(VotingAncillaryInterface.RevealAncillary[] calldata reveals)
external
onlyRoleHolder(uint256(Roles.Voter))
{
_getVotingAddress().batchReveal(reveals);
}
/**
* @notice Forwards a reward retrieval to Voting.
* @dev Rewards are added to the tokens already held by this contract.
* @param roundId defines the round from which voting rewards will be retrieved from.
* @param toRetrieve an array of PendingRequests which rewards are retrieved from.
* @return amount of rewards that the user should receive.
*/
function retrieveRewards(uint256 roundId, VotingAncillaryInterface.PendingRequestAncillary[] memory toRetrieve)
public
onlyRoleHolder(uint256(Roles.Voter))
returns (FixedPoint.Unsigned memory)
{
return _getVotingAddress().retrieveRewards(address(this), roundId, toRetrieve);
}
function _getVotingAddress() private view returns (VotingAncillaryInterface) {
return VotingAncillaryInterface(finder.getImplementationAddress(OracleInterfaces.Oracle));
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 199,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.