Contract 0x36cFbb93E8C1B9aAb2Ff413C92e78D12fbAcDc0E

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xef5936c784d74ef89e1a3e2582a9bd5b1f81e8c8ca8f62c681c48ea337c48eb90x60a06040151679232022-09-18 13:25:4414 days 19 hrs ago0xdf3e980a175904a26a7ba627048a789ae6a141cd IN  Create: CompoundVotingMachine0 CELO0.0005752434
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
CompoundVotingMachine

Compiler Version
v0.8.8+commit.dddeac2f

Optimization Enabled:
Yes with 0 runs

Other Settings:
default evmVersion
File 1 of 13 : CompoundVotingMachine.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

import "../DAOStackInterfaces.sol";
import "../utils/DAOUpgradeableContract.sol";

/**
 * based on https://github.com/compound-finance/compound-protocol/blob/b9b14038612d846b83f8a009a82c38974ff2dcfe/contracts/Governance/GovernorAlpha.sol
 * CompoundVotingMachine based on Compound's governance with a few differences
 * 1. no timelock. once vote has passed it stays open for 'queuePeriod' (2 days by default).
 * if vote decision has changed, execution will be delayed so at least 24 hours are left to vote.
 * 2. execution modified to support DAOStack Avatar/Controller
 */
contract CompoundVotingMachine is ContextUpgradeable, DAOUpgradeableContract {
	/// @notice The name of this contract
	string public constant name = "GoodDAO Voting Machine";

	/// @notice timestamp when foundation releases guardian veto rights
	uint64 public foundationGuardianRelease;

	/// @notice the number of blocks a proposal is open for voting (before passing quorum)
	uint256 public votingPeriod;

	/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
	uint256 public quoromPercentage;

	function quorumVotes() public view returns (uint256) {
		return (rep.totalSupply() * quoromPercentage) / 1000000;
	} //3%

	/// @notice The number of votes required in order for a voter to become a proposer
	uint256 public proposalPercentage;

	function proposalThreshold(uint256 blockNumber)
		public
		view
		returns (uint256)
	{
		return (rep.totalSupplyAt(blockNumber) * proposalPercentage) / 1000000; //0.25%
	}

	/// @notice The maximum number of actions that can be included in a proposal
	uint256 public proposalMaxOperations; //10

	/// @notice The delay in blocks before voting on a proposal may take place, once proposed
	uint256 public votingDelay; //1 block

	/// @notice The duration of time after proposal passed thershold before it can be executed
	uint256 public queuePeriod; // 2 days

	/// @notice The duration of time after proposal passed with absolute majority before it can be executed
	uint256 public fastQueuePeriod; //1 days/8 = 3hours

	/// @notice During the queue period if vote decision has changed, we extend queue period time duration so
	/// that at least gameChangerPeriod is left
	uint256 public gameChangerPeriod; //1 day

	/// @notice the duration of time a succeeded proposal has to be executed on the blockchain
	uint256 public gracePeriod; // 3days

	/// @notice The address of the DAO reputation token
	ReputationInterface public rep;

	/// @notice The address of the Governor Guardian
	address public guardian;

	/// @notice The total number of proposals
	uint256 public proposalCount;

	struct Proposal {
		// Unique id for looking up a proposal
		uint256 id;
		// Creator of the proposal
		address proposer;
		// The timestamp that the proposal will be available for execution, set once the vote succeeds
		uint256 eta;
		// the ordered list of target addresses for calls to be made
		address[] targets;
		// The ordered list of values (i.e. msg.value) to be passed to the calls to be made
		uint256[] values;
		// The ordered list of function signatures to be called
		string[] signatures;
		// The ordered list of calldata to be passed to each call
		bytes[] calldatas;
		// The block at which voting begins: holders must delegate their votes prior to this block
		uint256 startBlock;
		// The block at which voting ends: votes must be cast prior to this block
		uint256 endBlock;
		// Current number of votes in favor of this proposal
		uint256 forVotes;
		// Current number of votes in opposition to this proposal
		uint256 againstVotes;
		// Flag marking whether the proposal has been canceled
		bool canceled;
		// Flag marking whether the proposal has been executed
		bool executed;
		// Receipts of ballots for the entire set of voters
		mapping(address => Receipt) receipts;
		// quorom required at time of proposing
		uint256 quoromRequired;
		// support proposal voting bridge
		uint256 forBlockchain;
	}

	/// @notice Ballot receipt record for a voter
	struct Receipt {
		//Whether or not a vote has been cast
		bool hasVoted;
		// Whether or not the voter supports the proposal
		bool support;
		// The number of votes the voter had, which were cast
		uint256 votes;
	}

	/// @notice Possible states that a proposal may be in
	enum ProposalState {
		Pending,
		Active,
		ActiveTimelock, // passed quorom, time lock of 2 days activated, still open for voting
		Canceled,
		Defeated,
		Succeeded,
		// Queued, we dont have queued status, we use game changer period instead
		Expired,
		Executed
	}

	/// @notice The official record of all proposals ever proposed
	mapping(uint256 => Proposal) public proposals;

	/// @notice The latest proposal for each proposer
	mapping(address => uint256) public latestProposalIds;

	/// @notice The EIP-712 typehash for the contract's domain
	bytes32 public constant DOMAIN_TYPEHASH =
		keccak256(
			"EIP712Domain(string name,uint256 chainId,address verifyingContract)"
		);

	/// @notice The EIP-712 typehash for the ballot struct used by the contract
	bytes32 public constant BALLOT_TYPEHASH =
		keccak256("Ballot(uint256 proposalId,bool support)");

	/// @notice An event emitted when a new proposal is created
	event ProposalCreated(
		uint256 id,
		address proposer,
		address[] targets,
		uint256[] values,
		string[] signatures,
		bytes[] calldatas,
		uint256 startBlock,
		uint256 endBlock,
		string description
	);

	/// @notice An event emitted when using blockchain proposal bridge
	event ProposalSucceeded(
		uint256 id,
		address proposer,
		address[] targets,
		uint256[] values,
		string[] signatures,
		bytes[] calldatas,
		uint256 startBlock,
		uint256 endBlock,
		uint256 forBlockchain,
		uint256 eta,
		uint256 forVotes,
		uint256 againstVotes
	);

	/// @notice event when proposal made for a different blockchain
	event ProposalBridge(uint256 id, uint256 indexed forBlockchain);

	/// @notice An event emitted when a vote has been cast on a proposal
	event VoteCast(
		address voter,
		uint256 proposalId,
		bool support,
		uint256 votes
	);

	/// @notice An event emitted when a proposal has been canceled
	event ProposalCanceled(uint256 id);

	/// @notice An event emitted when a proposal has been queued
	event ProposalQueued(uint256 id, uint256 eta);

	/// @notice An event emitted when a proposal has been executed
	event ProposalExecuted(uint256 id);

	/// @notice An event emitted when a proposal call has been executed
	event ProposalExecutionResult(
		uint256 id,
		uint256 index,
		bool ok,
		bytes result
	);

	event GuardianSet(address newGuardian);

	event ParametersSet(uint256[9] params);

	function initialize(
		INameService ns_, // the DAO avatar
		uint256 votingPeriodBlocks_, //number of blocks a proposal is open for voting before expiring
		address guardian_,
		address reputation_
	) public initializer {
		foundationGuardianRelease = 1672531200; //01/01/2023
		setDAO(ns_);
		rep = ReputationInterface(reputation_);

		uint256[9] memory params = [
			votingPeriodBlocks_,
			30000, //3% quorum
			2500, //0.25% proposing threshold
			10, //max operations
			1, //voting delay blocks
			2 days, //queue period
			1 days / 8, //fast queue period
			1 days, //game change period
			3 days //grace period
		];
		_setVotingParameters(params);
		guardian = guardian_;
	}

	//upgrade to fix bad guardian deployment
	function fixGuardian(address _guardian) public {
		if (guardian == address(0x4659176E962763e7C8A4eF965ecfD0fdf9f52057)) {
			guardian = _guardian;
		}
	}

	function updateRep() public {
		rep = ReputationInterface(nameService.getAddress("REPUTATION"));
	}

	///@notice set the different voting parameters, value of 0 is ignored
	///cell 0 - votingPeriod blocks, 1 - quoromPercentage, 2 - proposalPercentage,3 - proposalMaxOperations, 4 - voting delay blocks, 5 - queuePeriod time
	///6 - fastQueuePeriod time, 7 - gameChangerPeriod time, 8 - gracePeriod	time
	function setVotingParameters(uint256[9] calldata _newParams) external {
		_onlyAvatar();
		_setVotingParameters(_newParams);
	}

	function _setVotingParameters(uint256[9] memory _newParams) internal {
		require(
			(quoromPercentage == 0 || _newParams[1] <= quoromPercentage * 2) &&
				_newParams[1] < 1000000,
			"percentage should not double"
		);
		require(
			(proposalPercentage == 0 || _newParams[2] <= proposalPercentage * 2) &&
				_newParams[2] < 1000000,
			"percentage should not double"
		);
		votingPeriod = _newParams[0] > 0 ? _newParams[0] : votingPeriod;
		quoromPercentage = _newParams[1] > 0 ? _newParams[1] : quoromPercentage;
		proposalPercentage = _newParams[2] > 0 ? _newParams[2] : proposalPercentage;
		proposalMaxOperations = _newParams[3] > 0
			? _newParams[3]
			: proposalMaxOperations;
		votingDelay = _newParams[4] > 0 ? _newParams[4] : votingDelay;
		queuePeriod = _newParams[5] > 0 ? _newParams[5] : queuePeriod;
		fastQueuePeriod = _newParams[6] > 0 ? _newParams[6] : fastQueuePeriod;
		gameChangerPeriod = _newParams[7] > 0 ? _newParams[7] : gameChangerPeriod;
		gracePeriod = _newParams[8] > 0 ? _newParams[8] : gracePeriod;

		emit ParametersSet(_newParams);
	}

	/// @notice make a proposal to be voted on
	/// @param targets list of contracts to be excuted on
	/// @param values list of eth value to be used in each contract call
	/// @param signatures the list of functions to execute
	/// @param calldatas the list of parameters to pass to each function
	/// @return uint256 proposal id
	function propose(
		address[] memory targets,
		uint256[] memory values,
		string[] memory signatures,
		bytes[] memory calldatas,
		string memory description
	) public returns (uint256) {
		return
			propose(
				targets,
				values,
				signatures,
				calldatas,
				description,
				getChainId()
			);
	}

	/// @notice make a proposal to be voted on
	/// @param targets list of contracts to be excuted on
	/// @param values list of eth value to be used in each contract call
	/// @param signatures the list of functions to execute
	/// @param calldatas the list of parameters to pass to each function
	/// @return uint256 proposal id
	function propose(
		address[] memory targets,
		uint256[] memory values,
		string[] memory signatures,
		bytes[] memory calldatas,
		string memory description,
		uint256 forBlockchain
	) public returns (uint256) {
		require(
			rep.getVotesAt(_msgSender(), true, block.number - 1) >
				proposalThreshold(block.number - 1),
			"CompoundVotingMachine::propose: proposer votes below proposal threshold"
		);
		require(
			targets.length == values.length &&
				targets.length == signatures.length &&
				targets.length == calldatas.length,
			"CompoundVotingMachine::propose: proposal function information arity mismatch"
		);
		require(
			targets.length != 0,
			"CompoundVotingMachine::propose: must provide actions"
		);
		require(
			targets.length <= proposalMaxOperations,
			"CompoundVotingMachine::propose: too many actions"
		);

		uint256 latestProposalId = latestProposalIds[_msgSender()];

		if (latestProposalId != 0) {
			ProposalState proposersLatestProposalState = state(latestProposalId);
			require(
				proposersLatestProposalState != ProposalState.Active &&
					proposersLatestProposalState != ProposalState.ActiveTimelock,
				"CompoundVotingMachine::propose: one live proposal per proposer, found an already active proposal"
			);
			require(
				proposersLatestProposalState != ProposalState.Pending,
				"CompoundVotingMachine::propose: one live proposal per proposer, found an already pending proposal"
			);
		}

		uint256 startBlock = block.number + votingDelay;
		uint256 endBlock = startBlock + votingPeriod;

		proposalCount++;
		Proposal storage newProposal = proposals[proposalCount];
		newProposal.id = proposalCount;
		newProposal.proposer = _msgSender();
		newProposal.eta = 0;
		newProposal.targets = targets;
		newProposal.values = values;
		newProposal.signatures = signatures;
		newProposal.calldatas = calldatas;
		newProposal.startBlock = startBlock;
		newProposal.endBlock = endBlock;
		newProposal.forVotes = 0;
		newProposal.againstVotes = 0;
		newProposal.canceled = false;
		newProposal.executed = false;
		newProposal.quoromRequired = quorumVotes();
		newProposal.forBlockchain = forBlockchain;
		latestProposalIds[newProposal.proposer] = newProposal.id;

		emit ProposalCreated(
			newProposal.id,
			_msgSender(),
			targets,
			values,
			signatures,
			calldatas,
			startBlock,
			endBlock,
			description
		);

		if (getChainId() != forBlockchain) {
			emit ProposalBridge(proposalCount, forBlockchain);
		}

		return newProposal.id;
	}

	/// @notice helper to set the effective time of a proposal that passed quorom
	/// @dev also extends the ETA in case of a game changer in vote decision
	/// @param proposal the proposal to set the eta
	/// @param hasVoteChanged did the current vote changed the decision
	function _updateETA(Proposal storage proposal, bool hasVoteChanged) internal {
		//if absolute majority allow to execute quickly
		if (proposal.forVotes > rep.totalSupplyAt(proposal.startBlock) / 2) {
			proposal.eta = block.timestamp + fastQueuePeriod;
		}
		//first time we have a quorom we ask for a no change in decision period
		else if (proposal.eta == 0) {
			proposal.eta = block.timestamp + queuePeriod;
		}
		//if we have a gamechanger then we extend current eta to have at least gameChangerPeriod left
		else if (hasVoteChanged) {
			uint256 timeLeft = proposal.eta - block.timestamp;
			proposal.eta += timeLeft > gameChangerPeriod
				? 0
				: gameChangerPeriod - timeLeft;
		} else {
			return;
		}
		emit ProposalQueued(proposal.id, proposal.eta);
	}

	/// @notice execute the proposal list of transactions
	/// @dev anyone can call this once its ETA has arrived
	function execute(uint256 proposalId) public payable {
		require(
			state(proposalId) == ProposalState.Succeeded,
			"CompoundVotingMachine::execute: proposal can only be executed if it is succeeded"
		);

		require(
			proposals[proposalId].forBlockchain == getChainId(),
			"CompoundVotingMachine::execute: proposal for wrong blockchain"
		);

		proposals[proposalId].executed = true;
		address[] memory _targets = proposals[proposalId].targets;
		uint256[] memory _values = proposals[proposalId].values;
		string[] memory _signatures = proposals[proposalId].signatures;
		bytes[] memory _calldatas = proposals[proposalId].calldatas;

		for (uint256 i = 0; i < _targets.length; i++) {
			(bool ok, bytes memory result) = _executeTransaction(
				_targets[i],
				_values[i],
				_signatures[i],
				_calldatas[i]
			);
			emit ProposalExecutionResult(proposalId, i, ok, result);
		}
		emit ProposalExecuted(proposalId);
	}

	/// @notice internal helper to execute a single transaction of a proposal
	/// @dev special execution is done if target is a method in the DAO controller
	function _executeTransaction(
		address target,
		uint256 value,
		string memory signature,
		bytes memory data
	) internal returns (bool, bytes memory) {
		bytes memory callData;

		if (bytes(signature).length == 0) {
			callData = data;
		} else {
			callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
		}

		bool ok;
		bytes memory result;

		if (target == address(dao)) {
			(ok, result) = target.call{ value: value }(callData);
		} else {
			if (value > 0) payable(address(avatar)).transfer(value); //make sure avatar have the funds to pay
			(ok, result) = dao.genericCall(target, callData, address(avatar), value);
		}
		require(
			ok,
			"CompoundVotingMachine::executeTransaction: Transaction execution reverted."
		);

		return (ok, result);
	}

	/// @notice cancel a proposal in case proposer no longer holds the votes that were required to propose
	/// @dev could be cheating trying to bypass the single proposal per address by delegating to another address
	/// or when delegators do not concur with the proposal done in their name, they can withdraw
	function cancel(uint256 proposalId) public {
		ProposalState pState = state(proposalId);
		require(
			pState != ProposalState.Executed,
			"CompoundVotingMachine::cancel: cannot cancel executed proposal"
		);

		Proposal storage proposal = proposals[proposalId];
		require(
			_msgSender() == guardian ||
				rep.getVotesAt(proposal.proposer, true, block.number - 1) <
				proposalThreshold(proposal.startBlock),
			"CompoundVotingMachine::cancel: proposer above threshold"
		);

		proposal.canceled = true;

		emit ProposalCanceled(proposalId);
	}

	/// @notice get the actions to be done in a proposal
	function getActions(uint256 proposalId)
		public
		view
		returns (
			address[] memory targets,
			uint256[] memory values,
			string[] memory signatures,
			bytes[] memory calldatas
		)
	{
		Proposal storage p = proposals[proposalId];
		return (p.targets, p.values, p.signatures, p.calldatas);
	}

	/// @notice get the receipt of a single voter in a proposal
	function getReceipt(uint256 proposalId, address voter)
		public
		view
		returns (Receipt memory)
	{
		return proposals[proposalId].receipts[voter];
	}

	/// @notice get the current status of a proposal
	function state(uint256 proposalId) public view returns (ProposalState) {
		require(
			proposalCount >= proposalId && proposalId > 0,
			"CompoundVotingMachine::state: invalid proposal id"
		);

		Proposal storage proposal = proposals[proposalId];

		if (proposal.canceled) {
			return ProposalState.Canceled;
		} else if (block.number <= proposal.startBlock) {
			return ProposalState.Pending;
		} else if (proposal.executed) {
			return ProposalState.Executed;
		} else if (
			proposal.eta > 0 && block.timestamp < proposal.eta //passed quorum but not executed yet, in time lock
		) {
			return ProposalState.ActiveTimelock;
		} else if (
			//regular voting period
			proposal.eta == 0 && block.number <= proposal.endBlock
		) {
			//proposal is active if we are in the gameChanger period (eta) or no decision yet and in voting period
			return ProposalState.Active;
		} else if (
			proposal.forVotes <= proposal.againstVotes ||
			proposal.forVotes < proposal.quoromRequired
		) {
			return ProposalState.Defeated;
		} else if (
			proposal.eta > 0 && block.timestamp >= proposal.eta + gracePeriod
		) {
			//expired if not executed gracePeriod after eta
			return ProposalState.Expired;
		} else {
			return ProposalState.Succeeded;
		}
	}

	/// @notice cast your vote on a proposal
	/// @param proposalId the proposal to vote on
	/// @param support for or against
	function castVote(uint256 proposalId, bool support) public {
		//get all votes in all blockchains including delegated
		Proposal storage proposal = proposals[proposalId];
		uint256 votes = rep.getVotesAt(_msgSender(), true, proposal.startBlock);
		return _castVote(_msgSender(), proposal, support, votes);
	}

	struct VoteSig {
		bool support;
		uint8 v;
		bytes32 r;
		bytes32 s;
	}

	// function ecRecoverTest(
	// 	uint256 proposalId,
	// 	VoteSig[] memory votesFor,
	// 	VoteSig[] memory votesAgainst
	// ) public {
	// 	bytes32 domainSeparator =
	// 		keccak256(
	// 			abi.encode(
	// 				DOMAIN_TYPEHASH,
	// 				keccak256(bytes(name)),
	// 				getChainId(),
	// 				address(this)
	// 			)
	// 		);
	// 	bytes32 structHashFor =
	// 		keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, true));
	// 	bytes32 structHashAgainst =
	// 		keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, false));
	// 	bytes32 digestFor =
	// 		keccak256(
	// 			abi.encodePacked("\x19\x01", domainSeparator, structHashFor)
	// 		);
	// 	bytes32 digestAgainst =
	// 		keccak256(
	// 			abi.encodePacked("\x19\x01", domainSeparator, structHashAgainst)
	// 		);

	// 	Proposal storage proposal = proposals[proposalId];

	// 	uint256 total;
	// 	for (uint32 i = 0; i < votesFor.length; i++) {
	// 		bytes32 digest = digestFor;

	// 		address signatory =
	// 			ecrecover(digest, votesFor[i].v, votesFor[i].r, votesFor[i].s);
	// 		require(
	// 			signatory != address(0),
	// 			"CompoundVotingMachine::castVoteBySig: invalid signature"
	// 		);
	// 		require(
	// 			votesFor[i].support == true,
	// 			"CompoundVotingMachine::castVoteBySig: invalid support value in for batch"
	// 		);
	// 		total += rep.getVotesAt(signatory, true, proposal.startBlock);
	// 		Receipt storage receipt = proposal.receipts[signatory];
	// 		receipt.hasVoted = true;
	// 		receipt.support = true;
	// 	}
	// 	if (votesFor.length > 0) {
	// 		address voteAddressHash =
	// 			address(uint160(uint256(keccak256(abi.encode(votesFor)))));
	// 		_castVote(voteAddressHash, proposalId, true, total);
	// 	}

	// 	total = 0;
	// 	for (uint32 i = 0; i < votesAgainst.length; i++) {
	// 		bytes32 digest = digestAgainst;

	// 		address signatory =
	// 			ecrecover(
	// 				digest,
	// 				votesAgainst[i].v,
	// 				votesAgainst[i].r,
	// 				votesAgainst[i].s
	// 			);
	// 		require(
	// 			signatory != address(0),
	// 			"CompoundVotingMachine::castVoteBySig: invalid signature"
	// 		);
	// 		require(
	// 			votesAgainst[i].support == false,
	// 			"CompoundVotingMachine::castVoteBySig: invalid support value in against batch"
	// 		);
	// 		total += rep.getVotesAt(signatory, true, proposal.startBlock);
	// 		Receipt storage receipt = proposal.receipts[signatory];
	// 		receipt.hasVoted = true;
	// 		receipt.support = true;
	// 	}
	// 	if (votesAgainst.length > 0) {
	// 		address voteAddressHash =
	// 			address(uint160(uint256(keccak256(abi.encode(votesAgainst)))));
	// 		_castVote(voteAddressHash, proposalId, false, total);
	// 	}
	// }

	/// @notice helper to cast a vote for someone else by using eip712 signatures
	function castVoteBySig(
		uint256 proposalId,
		bool support,
		uint8 v,
		bytes32 r,
		bytes32 s
	) public {
		bytes32 domainSeparator = keccak256(
			abi.encode(
				DOMAIN_TYPEHASH,
				keccak256(bytes(name)),
				getChainId(),
				address(this)
			)
		);
		bytes32 structHash = keccak256(
			abi.encode(BALLOT_TYPEHASH, proposalId, support)
		);
		bytes32 digest = keccak256(
			abi.encodePacked("\x19\x01", domainSeparator, structHash)
		);
		address signatory = ecrecover(digest, v, r, s);
		require(
			signatory != address(0),
			"CompoundVotingMachine::castVoteBySig: invalid signature"
		);

		//get all votes in all blockchains including delegated
		Proposal storage proposal = proposals[proposalId];
		uint256 votes = rep.getVotesAt(signatory, true, proposal.startBlock);
		return _castVote(signatory, proposal, support, votes);
	}

	/// @notice internal helper to cast a vote
	function _castVote(
		address voter,
		Proposal storage proposal,
		bool support,
		uint256 votes
	) internal {
		uint256 proposalId = proposal.id;
		require(
			state(proposalId) == ProposalState.Active ||
				state(proposalId) == ProposalState.ActiveTimelock,
			"CompoundVotingMachine::_castVote: voting is closed"
		);

		Receipt storage receipt = proposal.receipts[voter];
		require(
			receipt.hasVoted == false,
			"CompoundVotingMachine::_castVote: voter already voted"
		);

		bool hasChanged = proposal.forVotes > proposal.againstVotes;
		if (support) {
			proposal.forVotes += votes;
		} else {
			proposal.againstVotes += votes;
		}

		hasChanged = hasChanged != (proposal.forVotes > proposal.againstVotes);
		receipt.hasVoted = true;
		receipt.support = support;
		receipt.votes = votes;

		// if quorom passed then start the queue period
		if (
			proposal.forVotes >= proposal.quoromRequired ||
			proposal.againstVotes >= proposal.quoromRequired
		) _updateETA(proposal, hasChanged);
		emit VoteCast(voter, proposalId, support, votes);
	}

	function getChainId() public view returns (uint256) {
		uint256 chainId;
		assembly {
			chainId := chainid()
		}
		return chainId;
	}

	function renounceGuardian() public {
		require(_msgSender() == guardian, "CompoundVotingMachine: not guardian");
		guardian = address(0);
		foundationGuardianRelease = 0;
		emit GuardianSet(guardian);
	}

	function setGuardian(address _guardian) public {
		require(
			_msgSender() == address(avatar) || _msgSender() == guardian,
			"CompoundVotingMachine: not avatar or guardian"
		);

		require(
			_msgSender() == guardian || block.timestamp > foundationGuardianRelease,
			"CompoundVotingMachine: foundation expiration not reached"
		);

		guardian = _guardian;
		emit GuardianSet(guardian);
	}

	/// @notice allow anyone to emit details about proposal that passed. can be used for cross-chain proposals using blockheader proofs
	function emitSucceeded(uint256 _proposalId) public {
		require(
			state(_proposalId) == ProposalState.Succeeded,
			"CompoundVotingMachine: not Succeeded"
		);
		Proposal storage proposal = proposals[_proposalId];
		//also mark in storage as executed for cross chain voting. can be used by storage proofs, to verify proposal passed
		if (proposal.forBlockchain != getChainId()) {
			proposal.executed = true;
		}

		emit ProposalSucceeded(
			_proposalId,
			proposal.proposer,
			proposal.targets,
			proposal.values,
			proposal.signatures,
			proposal.calldatas,
			proposal.startBlock,
			proposal.endBlock,
			proposal.forBlockchain,
			proposal.eta,
			proposal.forVotes,
			proposal.againstVotes
		);
	}
}

File 2 of 13 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal initializer {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 3 of 13 : DAOStackInterfaces.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface Avatar {
	function nativeToken() external view returns (address);

	function nativeReputation() external view returns (address);

	function owner() external view returns (address);
}

interface Controller {
	event RegisterScheme(address indexed _sender, address indexed _scheme);
	event UnregisterScheme(address indexed _sender, address indexed _scheme);

	function genericCall(
		address _contract,
		bytes calldata _data,
		address _avatar,
		uint256 _value
	) external returns (bool, bytes memory);

	function avatar() external view returns (address);

	function unregisterScheme(address _scheme, address _avatar)
		external
		returns (bool);

	function unregisterSelf(address _avatar) external returns (bool);

	function registerScheme(
		address _scheme,
		bytes32 _paramsHash,
		bytes4 _permissions,
		address _avatar
	) external returns (bool);

	function isSchemeRegistered(address _scheme, address _avatar)
		external
		view
		returns (bool);

	function getSchemePermissions(address _scheme, address _avatar)
		external
		view
		returns (bytes4);

	function addGlobalConstraint(
		address _constraint,
		bytes32 _paramHash,
		address _avatar
	) external returns (bool);

	function mintTokens(
		uint256 _amount,
		address _beneficiary,
		address _avatar
	) external returns (bool);

	function externalTokenTransfer(
		address _token,
		address _recipient,
		uint256 _amount,
		address _avatar
	) external returns (bool);

	function sendEther(
		uint256 _amountInWei,
		address payable _to,
		address _avatar
	) external returns (bool);
}

interface GlobalConstraintInterface {
	enum CallPhase {
		Pre,
		Post,
		PreAndPost
	}

	function pre(
		address _scheme,
		bytes32 _params,
		bytes32 _method
	) external returns (bool);

	/**
	 * @dev when return if this globalConstraints is pre, post or both.
	 * @return CallPhase enum indication  Pre, Post or PreAndPost.
	 */
	function when() external returns (CallPhase);
}

interface ReputationInterface {
	function balanceOf(address _user) external view returns (uint256);

	function balanceOfAt(address _user, uint256 _blockNumber)
		external
		view
		returns (uint256);

	function getVotes(address _user) external view returns (uint256);

	function getVotesAt(
		address _user,
		bool _global,
		uint256 _blockNumber
	) external view returns (uint256);

	function totalSupply() external view returns (uint256);

	function totalSupplyAt(uint256 _blockNumber)
		external
		view
		returns (uint256);

	function delegateOf(address _user) external returns (address);
}

interface SchemeRegistrar {
	function proposeScheme(
		Avatar _avatar,
		address _scheme,
		bytes32 _parametersHash,
		bytes4 _permissions,
		string memory _descriptionHash
	) external returns (bytes32);

	event NewSchemeProposal(
		address indexed _avatar,
		bytes32 indexed _proposalId,
		address indexed _intVoteInterface,
		address _scheme,
		bytes32 _parametersHash,
		bytes4 _permissions,
		string _descriptionHash
	);
}

interface IntVoteInterface {
	event NewProposal(
		bytes32 indexed _proposalId,
		address indexed _organization,
		uint256 _numOfChoices,
		address _proposer,
		bytes32 _paramsHash
	);

	event ExecuteProposal(
		bytes32 indexed _proposalId,
		address indexed _organization,
		uint256 _decision,
		uint256 _totalReputation
	);

	event VoteProposal(
		bytes32 indexed _proposalId,
		address indexed _organization,
		address indexed _voter,
		uint256 _vote,
		uint256 _reputation
	);

	event CancelProposal(
		bytes32 indexed _proposalId,
		address indexed _organization
	);
	event CancelVoting(
		bytes32 indexed _proposalId,
		address indexed _organization,
		address indexed _voter
	);

	/**
	 * @dev register a new proposal with the given parameters. Every proposal has a unique ID which is being
	 * generated by calculating keccak256 of a incremented counter.
	 * @param _numOfChoices number of voting choices
	 * @param _proposalParameters defines the parameters of the voting machine used for this proposal
	 * @param _proposer address
	 * @param _organization address - if this address is zero the msg.sender will be used as the organization address.
	 * @return proposal's id.
	 */
	function propose(
		uint256 _numOfChoices,
		bytes32 _proposalParameters,
		address _proposer,
		address _organization
	) external returns (bytes32);

	function vote(
		bytes32 _proposalId,
		uint256 _vote,
		uint256 _rep,
		address _voter
	) external returns (bool);

	function cancelVote(bytes32 _proposalId) external;

	function getNumberOfChoices(bytes32 _proposalId)
		external
		view
		returns (uint256);

	function isVotable(bytes32 _proposalId) external view returns (bool);

	/**
	 * @dev voteStatus returns the reputation voted for a proposal for a specific voting choice.
	 * @param _proposalId the ID of the proposal
	 * @param _choice the index in the
	 * @return voted reputation for the given choice
	 */
	function voteStatus(bytes32 _proposalId, uint256 _choice)
		external
		view
		returns (uint256);

	/**
	 * @dev isAbstainAllow returns if the voting machine allow abstain (0)
	 * @return bool true or false
	 */
	function isAbstainAllow() external pure returns (bool);

	/**
     * @dev getAllowedRangeOfChoices returns the allowed range of choices for a voting machine.
     * @return min - minimum number of choices
               max - maximum number of choices
     */
	function getAllowedRangeOfChoices()
		external
		pure
		returns (uint256 min, uint256 max);
}

File 4 of 13 : DAOUpgradeableContract.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./DAOContract.sol";

/**
@title Simple contract that adds upgradability to DAOContract
*/

contract DAOUpgradeableContract is Initializable, UUPSUpgradeable, DAOContract {
	function _authorizeUpgrade(address) internal virtual override {
		_onlyAvatar();
	}
}

File 5 of 13 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 6 of 13 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal initializer {
        __ERC1967Upgrade_init_unchained();
        __UUPSUpgradeable_init_unchained();
    }

    function __UUPSUpgradeable_init_unchained() internal initializer {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallSecure(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallSecure(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;
    uint256[50] private __gap;
}

File 7 of 13 : DAOContract.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import "../DAOStackInterfaces.sol";
import "../Interfaces.sol";

/**
@title Simple contract that keeps DAO contracts registery
*/

contract DAOContract {
	Controller public dao;

	address public avatar;

	INameService public nameService;

	function _onlyAvatar() internal view {
		require(
			address(dao.avatar()) == msg.sender,
			"only avatar can call this method"
		);
	}

	function setDAO(INameService _ns) internal {
		nameService = _ns;
		updateAvatar();
	}

	function updateAvatar() public {
		dao = Controller(nameService.getAddress("CONTROLLER"));
		avatar = dao.avatar();
	}

	function nativeToken() public view returns (IGoodDollar) {
		return IGoodDollar(nameService.getAddress("GOODDOLLAR"));
	}

	uint256[50] private gap;
}

File 8 of 13 : ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable {
    function __ERC1967Upgrade_init() internal initializer {
        __ERC1967Upgrade_init_unchained();
    }

    function __ERC1967Upgrade_init_unchained() internal initializer {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallSecure(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        address oldImplementation = _getImplementation();

        // Initial upgrade and setup call
        _setImplementation(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }

        // Perform rollback test if not already in progress
        StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT);
        if (!rollbackTesting.value) {
            // Trigger rollback using upgradeTo from the new implementation
            rollbackTesting.value = true;
            _functionDelegateCall(
                newImplementation,
                abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
            );
            rollbackTesting.value = false;
            // Check rollback was effective
            require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
            // Finally reset to the new implementation and log the upgrade
            _upgradeTo(newImplementation);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {
        require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }
    uint256[50] private __gap;
}

File 9 of 13 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 10 of 13 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 13 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly {
            r.slot := slot
        }
    }
}

File 12 of 13 : Interfaces.sol
// SPDX-License-Identifier: MIT
import { DataTypes } from "./utils/DataTypes.sol";
pragma solidity >=0.8.0;

pragma experimental ABIEncoderV2;

interface ERC20 {
	function balanceOf(address addr) external view returns (uint256);

	function transfer(address to, uint256 amount) external returns (bool);

	function approve(address spender, uint256 amount) external returns (bool);

	function decimals() external view returns (uint8);

	function mint(address to, uint256 mintAmount) external returns (uint256);

	function burn(uint256 amount) external;

	function totalSupply() external view returns (uint256);

	function allowance(address owner, address spender)
		external
		view
		returns (uint256);

	function transferFrom(
		address sender,
		address recipient,
		uint256 amount
	) external returns (bool);

	function name() external view returns (string memory);

	function symbol() external view returns (string memory);

	event Transfer(address indexed from, address indexed to, uint256 amount);
	event Transfer(
		address indexed from,
		address indexed to,
		uint256 amount,
		bytes data
	);
}

interface cERC20 is ERC20 {
	function mint(uint256 mintAmount) external returns (uint256);

	function redeemUnderlying(uint256 mintAmount) external returns (uint256);

	function redeem(uint256 mintAmount) external returns (uint256);

	function exchangeRateCurrent() external returns (uint256);

	function exchangeRateStored() external view returns (uint256);

	function underlying() external returns (address);
}

interface IGoodDollar is ERC20 {
	function getFees(uint256 value) external view returns (uint256, bool);

	function burn(uint256 amount) external;

	function burnFrom(address account, uint256 amount) external;

	function renounceMinter() external;

	function addMinter(address minter) external;

	function isMinter(address minter) external view returns (bool);

	function transferAndCall(
		address to,
		uint256 value,
		bytes calldata data
	) external returns (bool);

	function formula() external view returns (address);
}

interface IERC2917 is ERC20 {
	/// @dev This emit when interests amount per block is changed by the owner of the contract.
	/// It emits with the old interests amount and the new interests amount.
	event InterestRatePerBlockChanged(uint256 oldValue, uint256 newValue);

	/// @dev This emit when a users' productivity has changed
	/// It emits with the user's address and the the value after the change.
	event ProductivityIncreased(address indexed user, uint256 value);

	/// @dev This emit when a users' productivity has changed
	/// It emits with the user's address and the the value after the change.
	event ProductivityDecreased(address indexed user, uint256 value);

	/// @dev Return the current contract's interests rate per block.
	/// @return The amount of interests currently producing per each block.
	function interestsPerBlock() external view returns (uint256);

	/// @notice Change the current contract's interests rate.
	/// @dev Note the best practice will be restrict the gross product provider's contract address to call this.
	/// @return The true/fase to notice that the value has successfully changed or not, when it succeed, it will emite the InterestRatePerBlockChanged event.
	function changeInterestRatePerBlock(uint256 value) external returns (bool);

	/// @notice It will get the productivity of given user.
	/// @dev it will return 0 if user has no productivity proved in the contract.
	/// @return user's productivity and overall productivity.
	function getProductivity(address user)
		external
		view
		returns (uint256, uint256);

	/// @notice increase a user's productivity.
	/// @dev Note the best practice will be restrict the callee to prove of productivity's contract address.
	/// @return true to confirm that the productivity added success.
	function increaseProductivity(address user, uint256 value)
		external
		returns (bool);

	/// @notice decrease a user's productivity.
	/// @dev Note the best practice will be restrict the callee to prove of productivity's contract address.
	/// @return true to confirm that the productivity removed success.
	function decreaseProductivity(address user, uint256 value)
		external
		returns (bool);

	/// @notice take() will return the interests that callee will get at current block height.
	/// @dev it will always calculated by block.number, so it will change when block height changes.
	/// @return amount of the interests that user are able to mint() at current block height.
	function take() external view returns (uint256);

	/// @notice similar to take(), but with the block height joined to calculate return.
	/// @dev for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests.
	/// @return amount of interests and the block height.
	function takeWithBlock() external view returns (uint256, uint256);

	/// @notice mint the avaiable interests to callee.
	/// @dev once it mint, the amount of interests will transfer to callee's address.
	/// @return the amount of interests minted.
	function mint() external returns (uint256);
}

interface Staking {
	struct Staker {
		// The staked DAI amount
		uint256 stakedDAI;
		// The latest block number which the
		// staker has staked tokens
		uint256 lastStake;
	}

	function stakeDAI(uint256 amount) external;

	function withdrawStake() external;

	function stakers(address staker) external view returns (Staker memory);
}

interface Uniswap {
	function swapExactETHForTokens(
		uint256 amountOutMin,
		address[] calldata path,
		address to,
		uint256 deadline
	) external payable returns (uint256[] memory amounts);

	function swapExactTokensForETH(
		uint256 amountIn,
		uint256 amountOutMin,
		address[] calldata path,
		address to,
		uint256 deadline
	) external returns (uint256[] memory amounts);

	function swapExactTokensForTokens(
		uint256 amountIn,
		uint256 amountOutMin,
		address[] calldata path,
		address to,
		uint256 deadline
	) external returns (uint256[] memory amounts);

	function WETH() external pure returns (address);

	function factory() external pure returns (address);

	function quote(
		uint256 amountA,
		uint256 reserveA,
		uint256 reserveB
	) external pure returns (uint256 amountB);

	function getAmountIn(
		uint256 amountOut,
		uint256 reserveIn,
		uint256 reserveOut
	) external pure returns (uint256 amountIn);

	function getAmountOut(
		uint256 amountI,
		uint256 reserveIn,
		uint256 reserveOut
	) external pure returns (uint256 amountOut);

	function getAmountsOut(uint256 amountIn, address[] memory path)
		external
		pure
		returns (uint256[] memory amounts);
}

interface UniswapFactory {
	function getPair(address tokenA, address tokenB)
		external
		view
		returns (address);
}

interface UniswapPair {
	function getReserves()
		external
		view
		returns (
			uint112 reserve0,
			uint112 reserve1,
			uint32 blockTimestampLast
		);

	function kLast() external view returns (uint256);

	function token0() external view returns (address);

	function token1() external view returns (address);

	function totalSupply() external view returns (uint256);

	function balanceOf(address owner) external view returns (uint256);
}

interface Reserve {
	function buy(
		address _buyWith,
		uint256 _tokenAmount,
		uint256 _minReturn
	) external returns (uint256);
}

interface IIdentity {
	function isWhitelisted(address user) external view returns (bool);

	function addWhitelistedWithDID(address account, string memory did) external;

	function removeWhitelisted(address account) external;

	function addBlacklisted(address account) external;

	function removeBlacklisted(address account) external;

	function isBlacklisted(address user) external view returns (bool);

	function addIdentityAdmin(address account) external returns (bool);

	function setAvatar(address _avatar) external;

	function isIdentityAdmin(address account) external view returns (bool);

	function owner() external view returns (address);

	function removeContract(address account) external;

	function isDAOContract(address account) external view returns (bool);

	event WhitelistedAdded(address user);
}

interface IIdentityV2 is IIdentity {
	function addWhitelistedWithDIDAndChain(
		address account,
		string memory did,
		uint256 orgChainId,
		uint256 dateAuthenticated
	) external;

	function getWhitelistedRoot(address account)
		external
		view
		returns (address root);
}

interface IUBIScheme {
	function currentDay() external view returns (uint256);

	function periodStart() external view returns (uint256);

	function hasClaimed(address claimer) external view returns (bool);
}

interface IFirstClaimPool {
	function awardUser(address user) external returns (uint256);

	function claimAmount() external view returns (uint256);
}

interface ProxyAdmin {
	function getProxyImplementation(address proxy)
		external
		view
		returns (address);

	function getProxyAdmin(address proxy) external view returns (address);

	function upgrade(address proxy, address implementation) external;

	function owner() external view returns (address);

	function transferOwnership(address newOwner) external;

	function upgradeAndCall(
		address proxy,
		address implementation,
		bytes memory data
	) external;
}

/**
 * @dev Interface for chainlink oracles to obtain price datas
 */
interface AggregatorV3Interface {
	function decimals() external view returns (uint8);

	function description() external view returns (string memory);

	function version() external view returns (uint256);

	// getRoundData and latestRoundData should both raise "No data present"
	// if they do not have data to report, instead of returning unset values
	// which could be misinterpreted as actual reported values.
	function getRoundData(uint80 _roundId)
		external
		view
		returns (
			uint80 roundId,
			int256 answer,
			uint256 startedAt,
			uint256 updatedAt,
			uint80 answeredInRound
		);

	function latestAnswer() external view returns (int256);
}

/**
	@dev interface for AAVE lending Pool
 */
interface ILendingPool {
	/**
	 * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
	 * - E.g. User deposits 100 USDC and gets in return 100 aUSDC
	 * @param asset The address of the underlying asset to deposit
	 * @param amount The amount to be deposited
	 * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
	 *   wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
	 *   is a different wallet
	 * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
	 *   0 if the action is executed directly by the user, without any middle-man
	 **/
	function deposit(
		address asset,
		uint256 amount,
		address onBehalfOf,
		uint16 referralCode
	) external;

	/**
	 * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
	 * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
	 * @param asset The address of the underlying asset to withdraw
	 * @param amount The underlying amount to be withdrawn
	 *   - Send the value type(uint256).max in order to withdraw the whole aToken balance
	 * @param to Address that will receive the underlying, same as msg.sender if the user
	 *   wants to receive it on his own wallet, or a different address if the beneficiary is a
	 *   different wallet
	 * @return The final amount withdrawn
	 **/
	function withdraw(
		address asset,
		uint256 amount,
		address to
	) external returns (uint256);

	/**
	 * @dev Returns the state and configuration of the reserve
	 * @param asset The address of the underlying asset of the reserve
	 * @return The state of the reserve
	 **/
	function getReserveData(address asset)
		external
		view
		returns (DataTypes.ReserveData memory);
}

interface IDonationStaking {
	function stakeDonations() external payable;
}

interface INameService {
	function getAddress(string memory _name) external view returns (address);
}

interface IAaveIncentivesController {
	/**
	 * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
	 * @param amount Amount of rewards to claim
	 * @param to Address that will be receiving the rewards
	 * @return Rewards claimed
	 **/
	function claimRewards(
		address[] calldata assets,
		uint256 amount,
		address to
	) external returns (uint256);

	/**
	 * @dev Returns the total of rewards of an user, already accrued + not yet accrued
	 * @param user The address of the user
	 * @return The rewards
	 **/
	function getRewardsBalance(address[] calldata assets, address user)
		external
		view
		returns (uint256);
}

interface IGoodStaking {
	function collectUBIInterest(address recipient)
		external
		returns (
			uint256,
			uint256,
			uint256
		);

	function iToken() external view returns (address);

	function currentGains(
		bool _returnTokenBalanceInUSD,
		bool _returnTokenGainsInUSD
	)
		external
		view
		returns (
			uint256,
			uint256,
			uint256,
			uint256,
			uint256
		);

	function getRewardEarned(address user) external view returns (uint256);

	function getGasCostForInterestTransfer() external view returns (uint256);

	function rewardsMinted(
		address user,
		uint256 rewardsPerBlock,
		uint256 blockStart,
		uint256 blockEnd
	) external returns (uint256);
}

interface IHasRouter {
	function getRouter() external view returns (Uniswap);
}

interface IAdminWallet {
	function addAdmins(address payable[] memory _admins) external;

	function removeAdmins(address[] memory _admins) external;

	function owner() external view returns (address);

	function transferOwnership(address _owner) external;
}

interface IMultichainRouter {
	// Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to`
	function anySwapOut(
		address token,
		address to,
		uint256 amount,
		uint256 toChainID
	) external;

	// Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to`
	function anySwapOutUnderlying(
		address token,
		address to,
		uint256 amount,
		uint256 toChainID
	) external;
}

File 13 of 13 : DataTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

library DataTypes {
	// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
	struct ReserveData {
		//stores the reserve configuration
		ReserveConfigurationMap configuration;
		//the liquidity index. Expressed in ray
		uint128 liquidityIndex;
		//variable borrow index. Expressed in ray
		uint128 variableBorrowIndex;
		//the current supply rate. Expressed in ray
		uint128 currentLiquidityRate;
		//the current variable borrow rate. Expressed in ray
		uint128 currentVariableBorrowRate;
		//the current stable borrow rate. Expressed in ray
		uint128 currentStableBorrowRate;
		uint40 lastUpdateTimestamp;
		//tokens addresses
		address aTokenAddress;
		address stableDebtTokenAddress;
		address variableDebtTokenAddress;
		//address of the interest rate strategy
		address interestRateStrategyAddress;
		//the id of the reserve. Represents the position in the list of the active reserves
		uint8 id;
	}

	struct ReserveConfigurationMap {
		//bit 0-15: LTV
		//bit 16-31: Liq. threshold
		//bit 32-47: Liq. bonus
		//bit 48-55: Decimals
		//bit 56: Reserve is active
		//bit 57: reserve is frozen
		//bit 58: borrowing is enabled
		//bit 59: stable rate borrowing enabled
		//bit 60-63: reserved
		//bit 64-79: reserve factor
		uint256 data;
	}
	enum InterestRateMode { NONE, STABLE, VARIABLE }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 0
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newGuardian","type":"address"}],"name":"GuardianSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[9]","name":"params","type":"uint256[9]"}],"name":"ParametersSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"forBlockchain","type":"uint256"}],"name":"ProposalBridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ProposalCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"address[]","name":"targets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"},{"indexed":false,"internalType":"string[]","name":"signatures","type":"string[]"},{"indexed":false,"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"ProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ProposalExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"bool","name":"ok","type":"bool"},{"indexed":false,"internalType":"bytes","name":"result","type":"bytes"}],"name":"ProposalExecutionResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eta","type":"uint256"}],"name":"ProposalQueued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"address[]","name":"targets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"},{"indexed":false,"internalType":"string[]","name":"signatures","type":"string[]"},{"indexed":false,"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"forBlockchain","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"forVotes","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"againstVotes","type":"uint256"}],"name":"ProposalSucceeded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"support","type":"bool"},{"indexed":false,"internalType":"uint256","name":"votes","type":"uint256"}],"name":"VoteCast","type":"event"},{"inputs":[],"name":"BALLOT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"avatar","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"}],"name":"castVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"castVoteBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dao","outputs":[{"internalType":"contract Controller","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"emitSucceeded","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fastQueuePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_guardian","type":"address"}],"name":"fixGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"foundationGuardianRelease","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameChangerPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"getActions","outputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"voter","type":"address"}],"name":"getReceipt","outputs":[{"components":[{"internalType":"bool","name":"hasVoted","type":"bool"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint256","name":"votes","type":"uint256"}],"internalType":"struct CompoundVotingMachine.Receipt","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gracePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract INameService","name":"ns_","type":"address"},{"internalType":"uint256","name":"votingPeriodBlocks_","type":"uint256"},{"internalType":"address","name":"guardian_","type":"address"},{"internalType":"address","name":"reputation_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"latestProposalIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nameService","outputs":[{"internalType":"contract INameService","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeToken","outputs":[{"internalType":"contract IGoodDollar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposalCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposalMaxOperations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposalPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"proposalThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposals","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"uint256","name":"eta","type":"uint256"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"forVotes","type":"uint256"},{"internalType":"uint256","name":"againstVotes","type":"uint256"},{"internalType":"bool","name":"canceled","type":"bool"},{"internalType":"bool","name":"executed","type":"bool"},{"internalType":"uint256","name":"quoromRequired","type":"uint256"},{"internalType":"uint256","name":"forBlockchain","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"internalType":"string","name":"description","type":"string"},{"internalType":"uint256","name":"forBlockchain","type":"uint256"}],"name":"propose","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"internalType":"string","name":"description","type":"string"}],"name":"propose","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"queuePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoromPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quorumVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rep","outputs":[{"internalType":"contract ReputationInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_guardian","type":"address"}],"name":"setGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[9]","name":"_newParams","type":"uint256[9]"}],"name":"setVotingParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"state","outputs":[{"internalType":"enum CompoundVotingMachine.ProposalState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateRep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"votingDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a06040523060601b60805234801561001757600080fd5b5060805160601c61446a61004b600039600081816116ce0152818161170e01528181611dcf0152611e0f015261446a6000f3fe6080604052600436106101f75760003560e01c8063013cf08b146101fc57806302a251a3146102e257806304e3b9b81461030657806306fdde031461033e5780630944db161461038d57806315373e3d146103ad57806317977c61146103cf5780631b3c90a8146103fc5780631dc5a19c1461041157806320606b7014610431578063218e63211461045357806324bc1a6414610468578063328dd9821461047d5780633408e470146104ad578063347a63c8146104c0578063358394d8146104e05780633659cfe6146105005780633932abb1146105205780633e4f49e6146105365780633e6326fc1461056357806340e58ee5146105905780634162169f146105b0578063452a9320146105d05780634634c61f146105f05780634f1ef286146106105780635aef7de6146106235780635c9e1382146106435780637629a4ac146106595780637bdbe4d0146106795780637d36b66e1461068f5780638a0dac4a146106af5780638b5d4b2c146106cf578063a06db7dc146106e5578063a840c93d146106fb578063acb0fa5914610711578063ccc0795914610727578063d2895d1614610747578063da35c6641461075d578063da95691a14610773578063deaaa7cc14610793578063e1758bd8146107b5578063e23a9a52146107ca578063e9946f6c14610881578063fe0d94c114610896575b600080fd5b34801561020857600080fd5b5061027e61021736600461350d565b60d9602052600090815260409020805460018201546002830154600784015460088501546009860154600a870154600b880154600d890154600e9099015497986001600160a01b03909716979596949593949293919260ff8083169361010090930416918b565b604080519b8c526001600160a01b03909a1660208c0152988a01979097526060890195909552608088019390935260a087019190915260c0860152151560e08501521515610100840152610120830152610140820152610160015b60405180910390f35b3480156102ee57600080fd5b506102f860cd5481565b6040519081526020016102d9565b34801561031257600080fd5b5060cc54610326906001600160401b031681565b6040516001600160401b0390911681526020016102d9565b34801561034a57600080fd5b5061038060405180604001604052806016815260200175476f6f6444414f20566f74696e67204d616368696e6560501b81525081565b6040516102d9919061357e565b34801561039957600080fd5b506102f86103a8366004613854565b6108a9565b3480156103b957600080fd5b506103cd6103c836600461393b565b610e1d565b005b3480156103db57600080fd5b506102f86103ea36600461396b565b60da6020526000908152604090205481565b34801561040857600080fd5b506103cd610ec9565b34801561041d57600080fd5b506103cd61042c366004613988565b61100e565b34801561043d57600080fd5b506102f86000805160206142ee83398151915281565b34801561045f57600080fd5b506103cd611048565b34801561047457600080fd5b506102f8611100565b34801561048957600080fd5b5061049d61049836600461350d565b6111a8565b6040516102d99493929190613a7c565b3480156104b957600080fd5b50466102f8565b3480156104cc57600080fd5b506103cd6104db36600461350d565b611439565b3480156104ec57600080fd5b506103cd6104fb366004613ad4565b61155b565b34801561050c57600080fd5b506103cd61051b36600461396b565b6116c3565b34801561052c57600080fd5b506102f860d15481565b34801561054257600080fd5b5061055661055136600461350d565b611789565b6040516102d99190613b3d565b34801561056f57600080fd5b50609954610583906001600160a01b031681565b6040516102d99190613b65565b34801561059c57600080fd5b506103cd6105ab36600461350d565b61190d565b3480156105bc57600080fd5b50609754610583906001600160a01b031681565b3480156105dc57600080fd5b5060d754610583906001600160a01b031681565b3480156105fc57600080fd5b506103cd61060b366004613b79565b611b2c565b6103cd61061e366004613bd1565b611dc4565b34801561062f57600080fd5b50609854610583906001600160a01b031681565b34801561064f57600080fd5b506102f860ce5481565b34801561066557600080fd5b506102f861067436600461350d565b611e7e565b34801561068557600080fd5b506102f860d05481565b34801561069b57600080fd5b506103cd6106aa36600461396b565b611f21565b3480156106bb57600080fd5b506103cd6106ca36600461396b565b611f68565b3480156106db57600080fd5b506102f860d25481565b3480156106f157600080fd5b506102f860d55481565b34801561070757600080fd5b506102f860cf5481565b34801561071d57600080fd5b506102f860d35481565b34801561073357600080fd5b5060d654610583906001600160a01b031681565b34801561075357600080fd5b506102f860d45481565b34801561076957600080fd5b506102f860d85481565b34801561077f57600080fd5b506102f861078e366004613c20565b6120dd565b34801561079f57600080fd5b506102f860008051602061436e83398151915281565b3480156107c157600080fd5b506105836120f7565b3480156107d657600080fd5b5061085b6107e5366004613cf1565b604080516060810182526000808252602082018190529181019190915250600091825260d9602090815260408084206001600160a01b03939093168452600c9092018152918190208151606081018352815460ff8082161515835261010090910416151593810193909352600101549082015290565b6040805182511515815260208084015115159082015291810151908201526060016102d9565b34801561088d57600080fd5b506103cd61218e565b6103cd6108a436600461350d565b612246565b60006108b9610674600143613d2c565b60d6546001600160a01b031663a265ba463360016108d78143613d2c565b6040518463ffffffff1660e01b81526004016108f593929190613d43565b60206040518083038186803b15801561090d57600080fd5b505afa158015610921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109459190613d64565b116109bb5760405162461bcd60e51b815260206004820152604760248201526000805160206143d583398151915260448201527f70726f706f73657220766f7465732062656c6f772070726f706f73616c2074686064820152661c995cda1bdb1960ca1b608482015260a4015b60405180910390fd5b855187511480156109cd575084518751145b80156109da575083518751145b610a4f5760405162461bcd60e51b815260206004820152604c60248201526000805160206143d583398151915260448201527f70726f706f73616c2066756e6374696f6e20696e666f726d6174696f6e20617260648201526b0d2e8f240dad2e6dac2e8c6d60a31b608482015260a4016109b2565b8651610aa85760405162461bcd60e51b815260206004820152603460248201526000805160206143d58339815191526044820152736d7573742070726f7669646520616374696f6e7360601b60648201526084016109b2565b60d05487511115610b025760405162461bcd60e51b815260206004820152603060248201526000805160206143d583398151915260448201526f746f6f206d616e7920616374696f6e7360801b60648201526084016109b2565b33600090815260da60205260409020548015610c63576000610b2382611789565b90506001816007811115610b3957610b39613b27565b14158015610b5957506002816007811115610b5657610b56613b27565b14155b610bcd5760405162461bcd60e51b815260206004820152606060248201526000805160206143d583398151915260448201526000805160206143f583398151915260648201527f666f756e6420616e20616c7265616479206163746976652070726f706f73616c608482015260a4016109b2565b6000816007811115610be157610be1613b27565b1415610c615760405162461bcd60e51b815260206004820152606160248201526000805160206143d583398151915260448201526000805160206143f583398151915260648201527f666f756e6420616e20616c72656164792070656e64696e672070726f706f73616084820152601b60fa1b60a482015260c4016109b2565b505b600060d15443610c739190613d7d565b9050600060cd5482610c859190613d7d565b60d880549192506000610c9783613d95565b909155505060d854600081815260d96020908152604082209283556001830180546001600160a01b0319163317905560028301919091558b51610ce2916003840191908e01906132bf565b508951610cf890600483019060208d0190613324565b508851610d0e90600583019060208c019061335f565b508751610d2490600683019060208b01906133b8565b506007810183905560088101829055600060098201819055600a820155600b8101805461ffff19169055610d56611100565b600d820155600e8101869055805460018201546001600160a01b0316600090815260da602052604090208190557f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e090338d8d8d8d89898f604051610dc299989796959493929190613db0565b60405180910390a1854614610e0e57857f93f05b7f92e65fef7a2a62683de78a4230ca5ec425170818561a02b6afcff28b60d854604051610e0591815260200190565b60405180910390a25b549a9950505050505050505050565b600082815260d96020526040812060d6549091906001600160a01b031663a265ba4633600185600701546040518463ffffffff1660e01b8152600401610e6593929190613d43565b60206040518083038186803b158015610e7d57600080fd5b505afa158015610e91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb59190613d64565b9050610ec333838584612718565b50505050565b60995460405163bf40fac160e01b815260206004820152600a60248201526921a7a72a2927a62622a960b11b60448201526001600160a01b039091169063bf40fac19060640160206040518083038186803b158015610f2757600080fd5b505afa158015610f3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5f9190613e48565b609780546001600160a01b0319166001600160a01b0392909216918217905560408051632d77bef360e11b81529051635aef7de691600480820192602092909190829003018186803b158015610fb457600080fd5b505afa158015610fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fec9190613e48565b609880546001600160a01b0319166001600160a01b0392909216919091179055565b61101661292a565b6040805161012081810190925261104591839060099083908390808284376000920191909152506129fe915050565b50565b60995460405163bf40fac160e01b815260206004820152600a6024820152692922a82aaa20aa24a7a760b11b60448201526001600160a01b039091169063bf40fac19060640160206040518083038186803b1580156110a657600080fd5b505afa1580156110ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110de9190613e48565b60d680546001600160a01b0319166001600160a01b0392909216919091179055565b6000620f424060ce5460d660009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561115757600080fd5b505afa15801561116b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118f9190613d64565b6111999190613e65565b6111a39190613e84565b905090565b606080606080600060d960008781526020019081526020016000209050806003018160040182600501836006018380548060200260200160405190810160405280929190818152602001828054801561122a57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161120c575b505050505093508280548060200260200160405190810160405280929190818152602001828054801561127c57602002820191906000526020600020905b815481526020019060010190808311611268575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156113505783829060005260206000200180546112c390613ea6565b80601f01602080910402602001604051908101604052809291908181526020018280546112ef90613ea6565b801561133c5780601f106113115761010080835404028352916020019161133c565b820191906000526020600020905b81548152906001019060200180831161131f57829003601f168201915b5050505050815260200190600101906112a4565b50505050915080805480602002602001604051908101604052809291908181526020016000905b8282101561142357838290600052602060002001805461139690613ea6565b80601f01602080910402602001604051908101604052809291908181526020018280546113c290613ea6565b801561140f5780601f106113e45761010080835404028352916020019161140f565b820191906000526020600020905b8154815290600101906020018083116113f257829003601f168201915b505050505081526020019060010190611377565b5050505090509450945094509450509193509193565b600561144482611789565b600781111561145557611455613b27565b146114ae5760405162461bcd60e51b8152602060048201526024808201527f436f6d706f756e64566f74696e674d616368696e653a206e6f742053756363656044820152631959195960e21b60648201526084016109b2565b600081815260d9602052604090204681600e0154146114d957600b8101805461ff0019166101001790555b600181015460078201546008830154600e84015460028501546009860154600a8701546040517fa5369bfba6e8a577af7ee34ae49c68529b2c8914a2561282f16e3a706cb4333c9761154f978b976001600160a01b039092169660038c019660048d019660058e019660068f0196949594613ff2565b60405180910390a15050565b600054610100900460ff1680611574575060005460ff16155b6115d75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109b2565b600054610100900460ff161580156115f9576000805461ffff19166101011790555b60cc80546001600160401b0319166363b0cd0017905561161885612bb0565b60d680546001600160a01b0319166001600160a01b038416179055604080516101208101825285815261753060208201526109c491810191909152600a6060820152600160808201526202a30060a0820152612a3060c08201526201518060e08201526203f48061010082015261168e816129fe565b5060d780546001600160a01b0319166001600160a01b03851617905580156116bc576000805461ff00191690555b5050505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561170c5760405162461bcd60e51b81526004016109b2906140c7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661173e612bd3565b6001600160a01b0316146117645760405162461bcd60e51b81526004016109b290614101565b61176d81612bef565b6040805160008082526020820190925261104591839190612bf7565b60008160d8541015801561179d5750600082115b6118035760405162461bcd60e51b815260206004820152603160248201527f436f6d706f756e64566f74696e674d616368696e653a3a73746174653a20696e6044820152701d985b1a59081c1c9bdc1bdcd85b081a59607a1b60648201526084016109b2565b600082815260d960205260409020600b81015460ff16156118275750600392915050565b8060070154431161183b5750600092915050565b600b810154610100900460ff16156118565750600792915050565b6000816002015411801561186d5750806002015442105b1561187b5750600292915050565b6002810154158015611891575080600801544311155b1561189f5750600192915050565b80600a015481600901541115806118bd575080600d01548160090154105b156118cb5750600492915050565b600081600201541180156118f0575060d55481600201546118ec9190613d7d565b4210155b156118fe5750600692915050565b50600592915050565b50919050565b600061191882611789565b9050600781600781111561192e5761192e613b27565b14156119a25760405162461bcd60e51b815260206004820152603e60248201527f436f6d706f756e64566f74696e674d616368696e653a3a63616e63656c3a206360448201527f616e6e6f742063616e63656c2065786563757465642070726f706f73616c000060648201526084016109b2565b600082815260d96020526040902060d7546001600160a01b0316336001600160a01b03161480611a7257506119da8160070154611e7e565b60d6546001838101546001600160a01b039283169263a265ba4692911690611a028143613d2c565b6040518463ffffffff1660e01b8152600401611a2093929190613d43565b60206040518083038186803b158015611a3857600080fd5b505afa158015611a4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a709190613d64565b105b611ade5760405162461bcd60e51b815260206004820152603760248201527f436f6d706f756e64566f74696e674d616368696e653a3a63616e63656c3a20706044820152761c9bdc1bdcd95c8818589bdd99481d1a1c995cda1bdb19604a1b60648201526084016109b2565b600b8101805460ff191660011790556040517f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c90611b1f9085815260200190565b60405180910390a1505050565b6040805180820182526016815275476f6f6444414f20566f74696e67204d616368696e6560501b60209182015281516000805160206142ee833981519152818301527ff0e8bb1b9036884fc34b9b811b9c0948f4a374ea4f5429d4533b8ab3c9fa373481840152466060820152306080808301919091528351808303909101815260a08201845280519083012060008051602061436e83398151915260c083015260e08201899052871515610100808401919091528451808403909101815261012083019094528351939092019290922061190160f01b6101408401526101428301829052610162830181905290916000906101820160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611c8d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d105760405162461bcd60e51b815260206004820152603760248201527f436f6d706f756e64566f74696e674d616368696e653a3a63617374566f746542604482015276795369673a20696e76616c6964207369676e617475726560481b60648201526084016109b2565b600089815260d9602052604080822060d65460078201549251635132dd2360e11b81529193926001600160a01b039091169163a265ba4691611d59918791600191600401613d43565b60206040518083038186803b158015611d7157600080fd5b505afa158015611d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da99190613d64565b9050611db783838c84612718565b5050505050505050505050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415611e0d5760405162461bcd60e51b81526004016109b2906140c7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611e3f612bd3565b6001600160a01b031614611e655760405162461bcd60e51b81526004016109b290614101565b611e6e82612bef565b611e7a82826001612bf7565b5050565b60cf5460d654604051630981b24d60e41b815260048101849052600092620f42409290916001600160a01b039091169063981b24d09060240160206040518083038186803b158015611ecf57600080fd5b505afa158015611ee3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f079190613d64565b611f119190613e65565b611f1b9190613e84565b92915050565b60d7546001600160a01b0316734659176e962763e7c8a4ef965ecfd0fdf9f5205714156110455760d780546001600160a01b0383166001600160a01b031990911617905550565b6098546001600160a01b0316336001600160a01b03161480611f9d575060d7546001600160a01b0316336001600160a01b0316145b611fff5760405162461bcd60e51b815260206004820152602d60248201527f436f6d706f756e64566f74696e674d616368696e653a206e6f7420617661746160448201526c391037b91033bab0b93234b0b760991b60648201526084016109b2565b60d7546001600160a01b0316336001600160a01b0316148061202b575060cc546001600160401b031642115b6120985760405162461bcd60e51b815260206004820152603860248201527f436f6d706f756e64566f74696e674d616368696e653a20666f756e646174696f6044820152771b88195e1c1a5c985d1a5bdb881b9bdd081c995858da195960421b60648201526084016109b2565b60d780546001600160a01b0319166001600160a01b03831690811790915560405160008051602061438e833981519152916120d291613b65565b60405180910390a150565b60006120ed8686868686466108a9565b9695505050505050565b60995460405163bf40fac160e01b815260206004820152600a60248201526923a7a7a22227a62620a960b11b60448201526000916001600160a01b03169063bf40fac19060640160206040518083038186803b15801561215657600080fd5b505afa15801561216a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a39190613e48565b60d7546001600160a01b0316336001600160a01b0316146121fd5760405162461bcd60e51b815260206004820152602360248201527f436f6d706f756e64566f74696e674d616368696e653a206e6f7420677561726460448201526234b0b760e91b60648201526084016109b2565b60d780546001600160a01b031916905560cc80546001600160401b031916905560405160008051602061438e8339815191529061223c90600090613b65565b60405180910390a1565b600561225182611789565b600781111561226257612262613b27565b146122dc5760405162461bcd60e51b8152602060048201526050602482015260008051602061434e83398151915260448201527f70726f706f73616c2063616e206f6e6c7920626520657865637574656420696660648201526f081a5d081a5cc81cdd58d8d95959195960821b608482015260a4016109b2565b46600082815260d960205260409020600e0154146123505760405162461bcd60e51b815260206004820152603d602482015260008051602061434e83398151915260448201527f70726f706f73616c20666f722077726f6e6720626c6f636b636861696e00000060648201526084016109b2565b600081815260d960209081526040808320600b8101805461ff001916610100179055600301805482518185028101850190935280835291929091908301828280156123c457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116123a6575b50505050509050600060d9600084815260200190815260200160002060040180548060200260200160405190810160405280929190818152602001828054801561242d57602002820191906000526020600020905b815481526020019060010190808311612419575b50505050509050600060d96000858152602001908152602001600020600501805480602002602001604051908101604052809291908181526020016000905b8282101561251857838290600052602060002001805461248b90613ea6565b80601f01602080910402602001604051908101604052809291908181526020018280546124b790613ea6565b80156125045780601f106124d957610100808354040283529160200191612504565b820191906000526020600020905b8154815290600101906020018083116124e757829003601f168201915b50505050508152602001906001019061246c565b505050509050600060d96000868152602001908152602001600020600601805480602002602001604051908101604052809291908181526020016000905b8282101561260257838290600052602060002001805461257590613ea6565b80601f01602080910402602001604051908101604052809291908181526020018280546125a190613ea6565b80156125ee5780601f106125c3576101008083540402835291602001916125ee565b820191906000526020600020905b8154815290600101906020018083116125d157829003601f168201915b505050505081526020019060010190612556565b50505050905060005b84518110156126dd5760008061268787848151811061262c5761262c61413b565b60200260200101518785815181106126465761264661413b565b60200260200101518786815181106126605761266061413b565b602002602001015187878151811061267a5761267a61413b565b6020026020010151612d37565b915091507f7ee6f70307f5df49af1cdc334b322bc2ff99ae186134a468bf77618a2ce2ff04888484846040516126c09493929190614151565b60405180910390a1505080806126d590613d95565b91505061260b565b506040518581527f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f9060200160405180910390a15050505050565b8254600161272582611789565b600781111561273657612736613b27565b148061275b5750600261274882611789565b600781111561275957612759613b27565b145b6127b05760405162461bcd60e51b815260206004820152603260248201526000805160206144158339815191526044820152710e881d9bdd1a5b99c81a5cc818db1bdcd95960721b60648201526084016109b2565b6001600160a01b0385166000908152600c850160205260409020805460ff16156128285760405162461bcd60e51b815260206004820152603560248201526000805160206144158339815191526044820152740e881d9bdd195c88185b1c9958591e481d9bdd1959605a1b60648201526084016109b2565b600a8501546009860154118415612858578386600901600082825461284d9190613d7d565b909155506128729050565b8386600a01600082825461286c9190613d7d565b90915550505b600a86015460098701805484548815156101000261ffff1990911617600190811786558501879055600d890154915493151592109190911415911015806128c1575085600d015486600a015410155b156128d0576128d08682612f66565b604080516001600160a01b038916815260208101859052861515818301526060810186905290517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c469181900360800190a150505050505050565b60975460408051632d77bef360e11b8152905133926001600160a01b031691635aef7de6916004808301926020929190829003018186803b15801561296e57600080fd5b505afa158015612982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a69190613e48565b6001600160a01b0316146129fc5760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79206176617461722063616e2063616c6c2074686973206d6574686f6460448201526064016109b2565b565b60ce541580612a1e575060ce54612a16906002613e65565b602082015111155b8015612a3057506020810151620f4240115b612a4c5760405162461bcd60e51b81526004016109b290614178565b60cf541580612a6c575060cf54612a64906002613e65565b604082015111155b8015612a7e57506040810151620f4240115b612a9a5760405162461bcd60e51b81526004016109b290614178565b8051612aa85760cd54612aab565b80515b60cd556020810151612abf5760ce54612ac5565b60208101515b60ce556040810151612ad95760cf54612adf565b60408101515b60cf556060810151612af35760d054612af9565b60608101515b60d0556080810151612b0d5760d154612b13565b60808101515b60d15560a0810151612b275760d254612b2d565b60a08101515b60d25560c0810151612b415760d354612b47565b60c08101515b60d35560e0810151612b5b5760d454612b61565b60e08101515b60d455610100810151612b765760d554612b7d565b6101008101515b60d5556040517f51472f0134408629271bc25caae248dd940cd836aa7bbc3974aa1ec2978059b5906120d29083906141ae565b609980546001600160a01b0319166001600160a01b038316179055611045610ec9565b60008051602061432e833981519152546001600160a01b031690565b61104561292a565b6000612c01612bd3565b9050612c0c846130c1565b600083511180612c195750815b15612c2a57612c288484613154565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff166116bc57805460ff19166001178155604051612ca5908690612c76908590602401613b65565b60408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b179052613154565b50805460ff19168155612cb6612bd3565b6001600160a01b0316826001600160a01b031614612d2e5760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b60648201526084016109b2565b6116bc8561323f565b6000606080845160001415612d4d575082612d79565b848051906020012084604051602001612d679291906141e0565b60405160208183030381529060405290505b6097546000906060906001600160a01b038a811691161415612dfb57886001600160a01b03168884604051612dae9190614211565b60006040518083038185875af1925050503d8060008114612deb576040519150601f19603f3d011682016040523d82523d6000602084013e612df0565b606091505b509092509050612ed2565b8715612e3d576098546040516001600160a01b039091169089156108fc02908a906000818181858888f19350505050158015612e3b573d6000803e3d6000fd5b505b6097546098546040516368db844d60e11b81526001600160a01b039283169263d1b7089a92612e76928e92899216908e9060040161422d565b600060405180830381600087803b158015612e9057600080fd5b505af1158015612ea4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ecc9190810190614261565b90925090505b81612f585760405162461bcd60e51b815260206004820152604a60248201527f436f6d706f756e64566f74696e674d616368696e653a3a65786563757465547260448201527f616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e606482015269103932bb32b93a32b21760b11b608482015260a4016109b2565b909890975095505050505050565b60d6546007830154604051630981b24d60e41b815260048101919091526002916001600160a01b03169063981b24d09060240160206040518083038186803b158015612fb157600080fd5b505afa158015612fc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe99190613d64565b612ff39190613e84565b826009015411156130155760d35461300b9042613d7d565b6002830155613083565b600282015461302b5760d25461300b9042613d7d565b8015611e7a5760004283600201546130439190613d2c565b905060d4548111613061578060d45461305c9190613d2c565b613064565b60005b8360020160008282546130779190613d7d565b90915550613083915050565b815460028301546040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda28929261154f92908252602082015260400190565b803b6131255760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016109b2565b60008051602061432e83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b6131b35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016109b2565b600080846001600160a01b0316846040516131ce9190614211565b600060405180830381855af49150503d8060008114613209576040519150601f19603f3d011682016040523d82523d6000602084013e61320e565b606091505b509150915061323682826040518060600160405280602781526020016143ae6027913961327f565b95945050505050565b613248816130c1565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060831561328e5750816132b8565b82511561329e5782518084602001fd5b8160405162461bcd60e51b81526004016109b2919061357e565b9392505050565b828054828255906000526020600020908101928215613314579160200282015b8281111561331457825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906132df565b50613320929150613411565b5090565b828054828255906000526020600020908101928215613314579160200282015b82811115613314578251825591602001919060010190613344565b8280548282559060005260206000209081019282156133ac579160200282015b828111156133ac578251805161339c918491602090910190613426565b509160200191906001019061337f565b50613320929150613499565b828054828255906000526020600020908101928215613405579160200282015b8281111561340557825180516133f5918491602090910190613426565b50916020019190600101906133d8565b506133209291506134b6565b5b808211156133205760008155600101613412565b82805461343290613ea6565b90600052602060002090601f0160209004810192826134545760008555613314565b82601f1061346d57805160ff1916838001178555613314565b828001600101855582156133145791820182811115613314578251825591602001919060010190613344565b808211156133205760006134ad82826134d3565b50600101613499565b808211156133205760006134ca82826134d3565b506001016134b6565b5080546134df90613ea6565b6000825580601f106134ef575050565b601f0160209004906000526020600020908101906110459190613411565b60006020828403121561351f57600080fd5b5035919050565b60005b83811015613541578181015183820152602001613529565b83811115610ec35750506000910152565b6000815180845261356a816020860160208601613526565b601f01601f19169290920160200192915050565b6020815260006132b86020830184613552565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156135cf576135cf613591565b604052919050565b60006001600160401b038211156135f0576135f0613591565b5060051b60200190565b6001600160a01b038116811461104557600080fd5b600082601f83011261362057600080fd5b81356020613635613630836135d7565b6135a7565b82815260059290921b8401810191818101908684111561365457600080fd5b8286015b8481101561367857803561366b816135fa565b8352918301918301613658565b509695505050505050565b600082601f83011261369457600080fd5b813560206136a4613630836135d7565b82815260059290921b840181019181810190868411156136c357600080fd5b8286015b8481101561367857803583529183019183016136c7565b60006001600160401b038211156136f7576136f7613591565b50601f01601f191660200190565b600082601f83011261371657600080fd5b8135613724613630826136de565b81815284602083860101111561373957600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261376757600080fd5b81356020613777613630836135d7565b82815260059290921b8401810191818101908684111561379657600080fd5b8286015b848110156136785780356001600160401b038111156137b95760008081fd5b6137c78986838b0101613705565b84525091830191830161379a565b600082601f8301126137e657600080fd5b813560206137f6613630836135d7565b82815260059290921b8401810191818101908684111561381557600080fd5b8286015b848110156136785780356001600160401b038111156138385760008081fd5b6138468986838b0101613705565b845250918301918301613819565b60008060008060008060c0878903121561386d57600080fd5b86356001600160401b038082111561388457600080fd5b6138908a838b0161360f565b975060208901359150808211156138a657600080fd5b6138b28a838b01613683565b965060408901359150808211156138c857600080fd5b6138d48a838b01613756565b955060608901359150808211156138ea57600080fd5b6138f68a838b016137d5565b9450608089013591508082111561390c57600080fd5b5061391989828a01613705565b92505060a087013590509295509295509295565b801515811461104557600080fd5b6000806040838503121561394e57600080fd5b8235915060208301356139608161392d565b809150509250929050565b60006020828403121561397d57600080fd5b81356132b8816135fa565b600061012080838503121561399c57600080fd5b8381840111156139ab57600080fd5b509092915050565b600081518084526020808501945080840160005b838110156139ec5781516001600160a01b0316875295820195908201906001016139c7565b509495945050505050565b600081518084526020808501945080840160005b838110156139ec57815187529582019590820190600101613a0b565b600081518084526020808501808196508360051b8101915082860160005b85811015613a6f578284038952613a5d848351613552565b98850198935090840190600101613a45565b5091979650505050505050565b608081526000613a8f60808301876139b3565b8281036020840152613aa181876139f7565b90508281036040840152613ab58186613a27565b90508281036060840152613ac98185613a27565b979650505050505050565b60008060008060808587031215613aea57600080fd5b8435613af5816135fa565b9350602085013592506040850135613b0c816135fa565b91506060850135613b1c816135fa565b939692955090935050565b634e487b7160e01b600052602160045260246000fd5b6020810160088310613b5f57634e487b7160e01b600052602160045260246000fd5b91905290565b6001600160a01b0391909116815260200190565b600080600080600060a08688031215613b9157600080fd5b853594506020860135613ba38161392d565b9350604086013560ff81168114613bb957600080fd5b94979396509394606081013594506080013592915050565b60008060408385031215613be457600080fd5b8235613bef816135fa565b915060208301356001600160401b03811115613c0a57600080fd5b613c1685828601613705565b9150509250929050565b600080600080600060a08688031215613c3857600080fd5b85356001600160401b0380821115613c4f57600080fd5b613c5b89838a0161360f565b96506020880135915080821115613c7157600080fd5b613c7d89838a01613683565b95506040880135915080821115613c9357600080fd5b613c9f89838a01613756565b94506060880135915080821115613cb557600080fd5b613cc189838a016137d5565b93506080880135915080821115613cd757600080fd5b50613ce488828901613705565b9150509295509295909350565b60008060408385031215613d0457600080fd5b823591506020830135613960816135fa565b634e487b7160e01b600052601160045260246000fd5b600082821015613d3e57613d3e613d16565b500390565b6001600160a01b039390931683529015156020830152604082015260600190565b600060208284031215613d7657600080fd5b5051919050565b60008219821115613d9057613d90613d16565b500190565b6000600019821415613da957613da9613d16565b5060010190565b8981526001600160a01b038916602082015261012060408201819052600090613ddb8382018b6139b3565b90508281036060840152613def818a6139f7565b90508281036080840152613e038189613a27565b905082810360a0840152613e178188613a27565b90508560c08401528460e0840152828103610100840152613e388185613552565b9c9b505050505050505050505050565b600060208284031215613e5a57600080fd5b81516132b8816135fa565b6000816000190483118215151615613e7f57613e7f613d16565b500290565b600082613ea157634e487b7160e01b600052601260045260246000fd5b500490565b600181811c90821680613eba57607f821691505b6020821081141561190757634e487b7160e01b600052602260045260246000fd5b6000815480845260208085019450836000528060002060005b838110156139ec57815487529582019560019182019101613ef4565b600081548084526020808501808196508360051b810191506000868152838120815b86811015613fe4578385038a5281548390600181811c9080831680613f5857607f831692505b8a8310811415613f7657634e487b7160e01b88526022600452602488fd5b828a52808015613f8d5760018114613fa157613fcc565b60ff1985168b8d015260408b019550613fcc565b8789528b8920895b85811015613fc45781548d82018f0152908401908d01613fa9565b8c018d019650505b50509c89019c92975050509190910190600101613f32565b509298975050505050505050565b600061018082018e835260018060a01b03808f1660208501526101806040850152818e548084526101a0860191508f6000526020600020935060005b8181101561404e578454841683526001948501946020909301920161402e565b50508481036060860152614062818f613edb565b925050508281036080840152614078818c613f10565b905082810360a084015261408c818b613f10565b60c0840199909952505060e0810195909552610100850193909352610120840191909152610140830152610160909101529695505050505050565b6020808252602c9082015260008051602061430e83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c9082015260008051602061430e83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b84815283602082015282151560408201526080606082015260006120ed6080830184613552565b6020808252601c908201527b70657263656e746167652073686f756c64206e6f7420646f75626c6560201b604082015260600190565b6101208101818360005b60098110156141d75781518352602092830192909101906001016141b8565b50505092915050565b6001600160e01b0319831681528151600090614203816004850160208701613526565b919091016004019392505050565b60008251614223818460208701613526565b9190910192915050565b600060018060a01b0380871683526080602084015261424f6080840187613552565b94166040830152506060015292915050565b6000806040838503121561427457600080fd5b825161427f8161392d565b60208401519092506001600160401b0381111561429b57600080fd5b8301601f810185136142ac57600080fd5b80516142ba613630826136de565b8181528660208385010111156142cf57600080fd5b6142e0826020830160208601613526565b809350505050925092905056fe8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86646756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc436f6d706f756e64566f74696e674d616368696e653a3a657865637574653a208e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916eee6c09ffe4572dc9ceaa5ddde4ae41befa655d6fdfe8052077af0970f700e942e416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564436f6d706f756e64566f74696e674d616368696e653a3a70726f706f73653a206f6e65206c6976652070726f706f73616c207065722070726f706f7365722c20436f6d706f756e64566f74696e674d616368696e653a3a5f63617374566f7465a264697066735822122015459f2afe77cdc2dc788632396094e4b5d820981379fc86282027e447111a3564736f6c63430008080033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.