// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @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,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
// import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/utils/Address.sol";
library Helper {
enum Status {
LISTED, //0 proposal created by studio
UPDATED, //1 proposal updated by studio
APPROVED_LISTING, //2 approved for listing by vote from VAB holders(staker)
APPROVED_FUNDING, //3 approved for funding by vote from VAB holders(staker)
REJECTED, //4 rejected by vote from VAB holders(staker)
REPLACED //5 replaced by vote from VAB holders(staker)
}
enum TokenType {
ERC20,
ERC721,
ERC1155
}
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
require(Address.isContract(token), "C");
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper::safeApprove: approve failed");
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
require(Address.isContract(token), "C");
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "VabbleDAO::safeTransfer: transfer failed");
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
require(Address.isContract(token), "C");
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "VabbleDAO::transferFrom: transferFrom failed");
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, "VabbleDAO::safeTransferETH: ETH transfer failed");
}
function safeTransferAsset(
address token,
address to,
uint256 value
) internal {
if (token == address(0)) {
safeTransferETH(to, value);
} else {
safeTransfer(token, to, value);
}
}
// function safeTransferNFT(
// address _nft,
// address _from,
// address _to,
// TokenType _type,
// uint256 _tokenId
// ) internal {
// if (_type == TokenType.ERC721) {
// IERC721(_nft).safeTransferFrom(_from, _to, _tokenId);
// } else {
// IERC1155(_nft).safeTransferFrom(_from, _to, _tokenId, 1, "0x00");
// }
// }
function isContract(address _address) internal view returns(bool){
// uint32 size;
// assembly {
// size := extcodesize(_address)
// }
// return (size != 0);
return Address.isContract(_address);
}
// function moveToAnotherArray(uint256[] storage array1, uint256[] storage array2, uint256 value) internal {
// uint256 index = array1.length;
// for(uint256 i = 0; i < array1.length; ++i) {
// if(array1[i] == value) {
// index = i;
// }
// }
// if (index >= array1.length) return;
// array2.push(value);
// array1[index] = array1[array1.length - 1];
// array1.pop();
// }
function isTestNet() internal view returns (bool) {
uint256 id = block.chainid;
return id == 1337 || id == 80001 || id == 80002 || id == 31337 || id == 84532;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IOwnablee {
function auditor() external view returns (address);
function deployer() external view returns (address);
function replaceAuditor(address _newAuditor) external;
function transferAuditor(address _newAuditor) external;
function isDepositAsset(address _asset) external view returns (bool);
function getDepositAssetList() external view returns (address[] memory);
function VAB_WALLET() external view returns (address);
function USDC_TOKEN() external view returns (address);
function PAYOUT_TOKEN() external view returns (address);
function addToStudioPool(uint256 _amount) external;
function withdrawVABFromEdgePool(address _to) external returns (uint256);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../libraries/Helper.sol";
interface IProperty {
function filmVotePeriod() external view returns (uint256); // 0
function agentVotePeriod() external view returns (uint256); // 1
function disputeGracePeriod() external view returns (uint256); // 2
function propertyVotePeriod() external view returns (uint256); // 3
function lockPeriod() external view returns (uint256); // 4
function rewardRate() external view returns (uint256); // 5
function filmRewardClaimPeriod() external view returns (uint256); // 6
function maxAllowPeriod() external view returns (uint256); // 7
function proposalFeeAmount() external view returns (uint256); // 8
function fundFeePercent() external view returns (uint256); // 9
function minDepositAmount() external view returns (uint256); // 10
function maxDepositAmount() external view returns (uint256); // 11
function maxMintFeePercent() external view returns (uint256); // 12
function minVoteCount() external view returns (uint256); // 13
function minStakerCountPercent() external view returns (uint256); // 14
function availableVABAmount() external view returns (uint256); // 15
function boardVotePeriod() external view returns (uint256); // 16
function boardVoteWeight() external view returns (uint256); // 17
function rewardVotePeriod() external view returns (uint256); // 18
function subscriptionAmount() external view returns (uint256); // 19
function boardRewardRate() external view returns (uint256); // 20
// function disputLimitAmount() external view returns (uint256);
function DAO_FUND_REWARD() external view returns (address);
function updateLastVoteTime(address _member) external;
function getPropertyProposalInfo(uint256 _index, uint256 _flag) external view returns (uint256, uint256, uint256, uint256, address, Helper.Status);
function getGovProposalInfo(uint256 _index, uint256 _flag) external view returns (uint256, uint256, uint256, address, address, Helper.Status);
function updatePropertyProposal(uint256 _index, uint256 _flag, uint256 _approveStatus) external;
function updateGovProposal(uint256 _index, uint256 _flag, uint256 _approveStatus) external;
function checkGovWhitelist(uint256 _flag, address _address) external view returns (uint256);
function checkPropertyWhitelist(uint256 _flag, uint256 _property) external view returns (uint256);
function getAgentProposerStakeAmount(uint256 _index) external view returns (uint256);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IStakingPool {
function getStakeAmount(address _user) external view returns (uint256 amount_);
function getWithdrawableTime(address _user) external view returns (uint256 time_);
function addVotedData(address _user, uint256 _time, uint256 _proposalID) external;
function addRewardToPool(uint256 _amount) external;
function getLimitCount() external view returns (uint256 count_);
function lastfundProposalCreateTime() external view returns (uint256);
function updateLastfundProposalCreateTime(uint256 _time) external;
function addProposalData(address _creator, uint256 _cTime, uint256 _period) external returns (uint256);
function getRentVABAmount(address _user) external view returns (uint256 amount_);
function sendVAB(address[] calldata _users, address _to, uint256[] calldata _amounts) external returns (uint256);
function calcMigrationVAB() external;
function depositVAB(uint256 amount) external;
function depositVABTo(address subscriber, uint256 amount) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Interface for Helper
interface IUniHelper {
function expectedAmount(
uint256 _depositAmount,
address _depositAsset,
address _incomingAsset
) external view returns (uint256 amount_);
function swapAsset(bytes calldata _swapArgs) external returns (uint256 amount_);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../libraries/Helper.sol";
interface IVabbleDAO {
struct Film {
string title; // proposal title
string description; // proposal description
uint256[] sharePercents; // percents(1% = 1e8) that studio defines to pay reward for each payee
address[] studioPayees; // payee addresses who studio define to pay reward
uint256 raiseAmount; // USDC amount(in cash) studio are seeking to raise for the film
uint256 fundPeriod; // how many days(ex: 20 days) to keep the funding pool open
uint256 fundType; // Financing Type(None=>0, Token=>1, NFT=>2, NFT & Token=>3)
uint256 rewardPercent; // reward percent applied to users helped fund film
uint256 noVote; // if 0 => false, 1 => true
uint256 enableClaimer; // if 0 => false, 1 => true
uint256 pCreateTime; // proposal created time(block.timestamp) by studio
uint256 pApproveTime; // proposal approved time(block.timestamp) by vote
address studio; // studio address(film owner)
Helper.Status status; // status of film
}
function getFilmFund(uint256 _filmId)
external
view
returns (uint256 raiseAmount_, uint256 fundPeriod_, uint256 fundType_, uint256 rewardPercent_);
function getFilmStatus(uint256 _filmId) external view returns (Helper.Status status_);
function getFilmOwner(uint256 _filmId) external view returns (address owner_);
function getFilmProposalTime(uint256 _filmId) external view returns (uint256 cTime_, uint256 aTime_);
function approveFilmByVote(uint256 _filmId, uint256 _flag) external;
function isEnabledClaimer(uint256 _filmId) external view returns (bool enable_);
function getFilmShare(uint256 _filmId)
external
view
returns (uint256[] memory sharePercents_, address[] memory studioPayees_);
function getUserFilmListForMigrate(address _user) external view returns (Film[] memory filmList_);
function withdrawVABFromStudioPool(address _to) external returns (uint256);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IVote {
function getLastVoteTime(address _member) external view returns (uint256 time_);
function saveProposalWithFilm(uint256 _filmId, uint256 _proposalID) external;
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../libraries/Helper.sol";
import "../interfaces/IVabbleDAO.sol";
import "../interfaces/IStakingPool.sol";
import "../interfaces/IProperty.sol";
import "../interfaces/IOwnablee.sol";
import "../interfaces/IVote.sol";
import "../interfaces/IUniHelper.sol";
contract Vote is IVote, ReentrancyGuard {
event VotedToFilm(address indexed voter, uint256 indexed filmId, uint256 voteInfo);
event VotedToAgent(address indexed voter, address indexed agent, uint256 voteInfo, uint256 index);
event DisputedToAgent(address indexed caller, address indexed agent, uint256 index);
event VotedToProperty(address indexed voter, uint256 flag, uint256 propertyVal, uint256 voteInfo, uint256 index);
event VotedToPoolAddress(address indexed voter, address rewardAddress, uint256 voteInfo, uint256 index);
event VotedToFilmBoard(address indexed voter, address candidate, uint256 voteInfo, uint256 index);
event FilmApproved(uint256 indexed filmId, uint256 fundType, uint256 reason);
event AuditorReplaced(address indexed agent, address caller);
event UpdatedAgentStats(address indexed agent, address caller, uint256 reason, uint256 index);
event FilmBoardAdded(address indexed boardMember, address caller, uint256 reason, uint256 index);
event PoolAddressAdded(address indexed pool, address caller, uint256 reason, uint256 index);
event PropertyUpdated(uint256 indexed whichProperty, uint256 propertyValue, address caller, uint256 reason, uint256 index);
struct Voting {
uint256 stakeAmount_1; // staking amount of voter with status(yes)
uint256 stakeAmount_2; // staking amount of voter with status(no)
uint256 voteCount_1; // number of accumulated votes(yes)
uint256 voteCount_2; // number of accumulated votes(no)
}
struct AgentVoting {
uint256 stakeAmount_1; // staking amount of voter with status(yes)
uint256 stakeAmount_2; // staking amount of voter with status(no)
uint256 voteCount_1; // number of accumulated votes(yes)
uint256 voteCount_2; // number of accumulated votes(no)
}
address private immutable OWNABLE; // Ownablee contract address
address private VABBLE_DAO;
address private STAKING_POOL;
address private DAO_PROPERTY;
address private UNI_HELPER;
mapping(uint256 => Voting) public filmVoting; // (filmId => Voting)
mapping(address => mapping(uint256 => bool)) public isAttendToFilmVote; // (staker => (filmId => true/false))
mapping(uint256 => Voting) public filmBoardVoting; // (filmBoard index => Voting)
mapping(address => mapping(uint256 => bool)) public isAttendToBoardVote; // (staker => (filmBoard index => true/false))
mapping(uint256 => Voting) public rewardAddressVoting; // (rewardAddress index => Voting)
mapping(address => mapping(uint256 => bool)) public isAttendToRewardAddressVote; // (staker => (reward index => true/false))
mapping(uint256 => AgentVoting) public agentVoting; // (agent index => AgentVoting)
mapping(address => mapping(uint256 => bool)) public isAttendToAgentVote; // (staker => (agent index => true/false))
mapping(uint256 => mapping(uint256 => Voting)) public propertyVoting; // (flag => (property index => Voting))
mapping(uint256 => mapping(address => mapping(uint256 => bool))) public isAttendToPropertyVote; // (flag => (staker => (property index => true/false)))
mapping(address => uint256) public userFilmVoteCount; //(user => film vote count)
mapping(address => uint256) public userGovernVoteCount; //(user => governance vote count)
mapping(uint256 => uint256) public govPassedVoteCount; //(flag => pased vote count) 1: agent, 2: disput, 3: board, 4: pool, 5: property
mapping(address => uint256) private lastVoteTime; // (staker => block.timestamp) for removing filmboard member
mapping(uint256 => uint256) private proposalFilmIds; // filmId => proposalID
modifier onlyDeployer() {
require(msg.sender == IOwnablee(OWNABLE).deployer(), "caller is not the deployer");
_;
}
modifier onlyStaker() {
require(IStakingPool(STAKING_POOL).getStakeAmount(msg.sender) != 0, "Not staker");
_;
}
constructor(address _ownable) {
require(_ownable != address(0), "ownablee: zero address");
OWNABLE = _ownable;
}
/// @notice Initialize Vote
function initialize(
address _vabbleDAO,
address _stakingPool,
address _property,
address _uniHelper
) external onlyDeployer {
require(VABBLE_DAO == address(0), "init: already initialized");
require(_vabbleDAO != address(0) && Helper.isContract(_vabbleDAO), "init: zero vabbleDAO");
VABBLE_DAO = _vabbleDAO;
require(_stakingPool != address(0) && Helper.isContract(_stakingPool), "init: zero stakingPool");
STAKING_POOL = _stakingPool;
require(_property != address(0) && Helper.isContract(_property), "init: zero property");
DAO_PROPERTY = _property;
require(_uniHelper != address(0), "init: zero uniHelper");
UNI_HELPER = _uniHelper;
}
/// @notice Vote to multi films from a staker
function voteToFilms(
uint256[] calldata _filmIds,
uint256[] calldata _voteInfos
) external onlyStaker nonReentrant {
uint256 filmLength = _filmIds.length;
require(filmLength != 0 && filmLength < 1000, "vF: zero length");
require(filmLength == _voteInfos.length, "vF: Bad item length");
for(uint256 i = 0; i < filmLength; ++i) {
__voteToFilm(_filmIds[i], _voteInfos[i]);
}
}
function __voteToFilm(
uint256 _filmId,
uint256 _voteInfo
) private {
require(msg.sender != IVabbleDAO(VABBLE_DAO).getFilmOwner(_filmId), "vF: film owner");
require(!isAttendToFilmVote[msg.sender][_filmId], "vF: already voted");
require(_voteInfo == 1 || _voteInfo == 2, "vF: bad vote info");
Helper.Status status = IVabbleDAO(VABBLE_DAO).getFilmStatus(_filmId);
require(status == Helper.Status.UPDATED, "vF: not updated1");
(uint256 cTime, ) = IVabbleDAO(VABBLE_DAO).getFilmProposalTime(_filmId);
require(cTime != 0, "vF: not updated2");
require(__isVotePeriod(IProperty(DAO_PROPERTY).filmVotePeriod(), cTime), "vF: elapsed period");
uint256 stakeAmount = IStakingPool(STAKING_POOL).getStakeAmount(msg.sender);
(, , uint256 fundType, ) = IVabbleDAO(VABBLE_DAO).getFilmFund(_filmId);
if(fundType == 0) { // in case of distribution(list) film
// If film is for listing and voter is film board member, more weight(30%) per vote
if(IProperty(DAO_PROPERTY).checkGovWhitelist(2, msg.sender) == 2) {
stakeAmount += stakeAmount * IProperty(DAO_PROPERTY).boardVoteWeight() / 1e10; // (30+100)/100=1.3
}
}
Voting storage fv = filmVoting[_filmId];
if(_voteInfo == 1) {
fv.stakeAmount_1 += stakeAmount; // Yes
fv.voteCount_1++;
} else {
fv.stakeAmount_2 += stakeAmount; // No
fv.voteCount_2++;
}
userFilmVoteCount[msg.sender] += 1;
isAttendToFilmVote[msg.sender][_filmId] = true;
// for removing board member if he don't vote for some period
lastVoteTime[msg.sender] = block.timestamp;
// 1++ for calculating the rewards
IStakingPool(STAKING_POOL).addVotedData(
msg.sender, block.timestamp, proposalFilmIds[_filmId]
);
emit VotedToFilm(msg.sender, _filmId, _voteInfo);
}
function saveProposalWithFilm(uint256 _filmId, uint256 _proposalID) external override {
proposalFilmIds[_filmId] = _proposalID;
}
/// @notice Approve multi films that votePeriod has elapsed after votePeriod(10 days) by anyone
// if isFund is true then "APPROVED_FUNDING", if isFund is false then "APPROVED_LISTING"
function approveFilms(uint256[] calldata _filmIds) external onlyStaker nonReentrant {
uint256 filmLength = _filmIds.length;
require(filmLength != 0 && filmLength < 1000, "aF: invalid items");
for(uint256 i = 0; i < filmLength; ++i) {
__approveFilm(_filmIds[i]);
}
}
function __approveFilm(uint256 _filmId) private {
Voting memory fv = filmVoting[_filmId];
// Example: stakeAmount of "YES" is 2000 and stakeAmount("NO") is 1000 in 10 days(votePeriod)
// In this case, Approved since 2000 > 1000 + 500 (it means ">50%") and stakeAmount of "YES" > 75m
(uint256 pCreateTime, uint256 pApproveTime) = IVabbleDAO(VABBLE_DAO).getFilmProposalTime(_filmId);
require(!__isVotePeriod(IProperty(DAO_PROPERTY).filmVotePeriod(), pCreateTime), "aF: vote period yet");
require(pApproveTime == 0, "aF: already approved");
(, , uint256 fundType, ) = IVabbleDAO(VABBLE_DAO).getFilmFund(_filmId);
uint256 reason = 0;
uint256 totalVoteCount = fv.voteCount_1 + fv.voteCount_2;
if(totalVoteCount >= IStakingPool(STAKING_POOL).getLimitCount() && fv.stakeAmount_1 > fv.stakeAmount_2) {
reason = 0;
} else {
if(totalVoteCount < IStakingPool(STAKING_POOL).getLimitCount()) {
reason = 1;
} else if(fv.stakeAmount_1 <= fv.stakeAmount_2) {
reason = 2;
} else {
reason = 10;
}
}
IVabbleDAO(VABBLE_DAO).approveFilmByVote(_filmId, reason);
emit FilmApproved(_filmId, fundType, reason);
}
/// @notice Stakers vote(1,2 => Yes, No) to agent for replacing Auditor
function voteToAgent(
uint256 _voteInfo,
uint256 _index
) external onlyStaker nonReentrant {
(uint256 cTime, , uint256 pID, address agent, address creator, ) = IProperty(DAO_PROPERTY).getGovProposalInfo(_index, 1);
require(_voteInfo == 1 || _voteInfo == 2, "vA: bad vote info");
require(cTime != 0, "vA: no proposal");
AgentVoting storage av = agentVoting[_index];
uint256 stakeAmount = IStakingPool(STAKING_POOL).getStakeAmount(msg.sender);
require(!isAttendToAgentVote[msg.sender][_index], "vA: already voted");
require(msg.sender != creator, "vA: self voted");
require(__isVotePeriod(IProperty(DAO_PROPERTY).agentVotePeriod(), cTime), "vA: elapsed period");
if(_voteInfo == 1) {
av.stakeAmount_1 += stakeAmount;
av.voteCount_1++;
} else {
av.stakeAmount_2 += stakeAmount;
av.voteCount_2++;
}
isAttendToAgentVote[msg.sender][_index] = true;
userGovernVoteCount[msg.sender] += 1;
// for removing board member if he don't vote for some period
lastVoteTime[msg.sender] = block.timestamp;
// 1++ for calculating the rewards
IStakingPool(STAKING_POOL).addVotedData(msg.sender, block.timestamp, pID);
emit VotedToAgent(msg.sender, agent, _voteInfo, _index);
}
/// @notice update proposal status based on vote result
function updateAgentStats(uint256 _index) external onlyStaker nonReentrant {
(uint256 cTime, uint256 aTime, , address agent, , ) = IProperty(DAO_PROPERTY).getGovProposalInfo(_index, 1);
require(!__isVotePeriod(IProperty(DAO_PROPERTY).agentVotePeriod(), cTime), "uAS: vote period yet");
require(aTime == 0, "uAS: already updated");
AgentVoting memory av = agentVoting[_index];
uint256 reason = 0;
uint256 totalVoteCount = av.voteCount_1 + av.voteCount_2;
// must be over 51%
if(
totalVoteCount >= IStakingPool(STAKING_POOL).getLimitCount() &&
av.stakeAmount_1 > av.stakeAmount_2
) {
IProperty(DAO_PROPERTY).updateGovProposal(_index, 1, 1);
govPassedVoteCount[1] += 1;
} else {
IProperty(DAO_PROPERTY).updateGovProposal(_index, 1, 0);
if(totalVoteCount < IStakingPool(STAKING_POOL).getLimitCount()) {
reason = 1;
} else if(av.stakeAmount_1 <= av.stakeAmount_2) {
reason = 2;
} else {
reason = 10;
}
}
emit UpdatedAgentStats(agent, msg.sender, reason, _index);
}
/// @notice Dispute to agent proposal with staked double or paid double
// one user enough to dispute
function disputeToAgent(uint256 _index, bool _pay) external onlyStaker nonReentrant {
(, uint256 aTime, , address agent, , Helper.Status stats) = IProperty(DAO_PROPERTY).getGovProposalInfo(_index, 1);
require(stats == Helper.Status.UPDATED, "dTA: reject or not pass vote");
require(__isVotePeriod(IProperty(DAO_PROPERTY).disputeGracePeriod(), aTime), "dTA: elapsed dispute period");
// staked double than agent proposer or pay double of proposalFeeAmount
if(_pay) {
require(__paidDoubleFee(), "dTA: pay double");
} else {
require(isDoubleStaked(_index, msg.sender), "dTA: stake more");
}
IProperty(DAO_PROPERTY).updateGovProposal(_index, 1, 0);
emit DisputedToAgent(msg.sender, agent, _index);
}
function isDoubleStaked(uint256 _index, address _user) public view returns (bool) {
uint256 stakeAmount = IStakingPool(STAKING_POOL).getStakeAmount(_user);
uint256 proposerAmount = IProperty(DAO_PROPERTY).getAgentProposerStakeAmount(_index);
if(stakeAmount >= 2 * proposerAmount) {
return true;
} else {
return false;
}
}
/// @notice Check if proposal fee transferred from studio to stakingPool
// Get expected VAB amount from UniswapV2 and then Transfer VAB: user(studio) -> stakingPool.
function __paidDoubleFee() private returns (bool paid_) {
uint256 amount = 2 * IProperty(DAO_PROPERTY).proposalFeeAmount();
address usdcToken = IOwnablee(OWNABLE).USDC_TOKEN();
address vabToken = IOwnablee(OWNABLE).PAYOUT_TOKEN();
uint256 expectVABAmount = IUniHelper(UNI_HELPER).expectedAmount(amount, usdcToken, vabToken);
if(expectVABAmount > 0 && IERC20(vabToken).balanceOf(msg.sender) >= expectVABAmount) {
Helper.safeTransferFrom(vabToken, msg.sender, address(this), expectVABAmount);
if(IERC20(vabToken).allowance(address(this), STAKING_POOL) == 0) {
Helper.safeApprove(vabToken, STAKING_POOL, IERC20(vabToken).totalSupply());
}
IStakingPool(STAKING_POOL).addRewardToPool(expectVABAmount);
paid_ = true;
}
}
// must be over 51%, staking amount must be over 75m,
// dispute staking amount must be less than 150m
function replaceAuditor(uint256 _index) external onlyStaker nonReentrant {
(, uint256 aTime, , address agent, , Helper.Status stats) = IProperty(DAO_PROPERTY).getGovProposalInfo(_index, 1);
require(stats == Helper.Status.UPDATED, "rA: reject or not pass vote");
require(
!__isVotePeriod(IProperty(DAO_PROPERTY).disputeGracePeriod(), aTime),
"rA: grace period yet"
);
AgentVoting memory av = agentVoting[_index];
uint256 totalVoteCount = av.voteCount_1 + av.voteCount_2;
require(totalVoteCount >= IStakingPool(STAKING_POOL).getLimitCount(), "rA: e1");
require(av.stakeAmount_1 > av.stakeAmount_2, "rA: e2");
// require(av.stakeAmount_1 > IProperty(DAO_PROPERTY).disputLimitAmount(), "rA: e3");
IOwnablee(OWNABLE).replaceAuditor(agent);
IProperty(DAO_PROPERTY).updateGovProposal(_index, 1, 5); // update proposal status
emit AuditorReplaced(agent, msg.sender);
}
function voteToFilmBoard(
uint256 _index,
uint256 _voteInfo
) external onlyStaker nonReentrant {
(uint256 cTime, , uint256 pID, address member, address creator, ) = IProperty(DAO_PROPERTY).getGovProposalInfo(_index, 2);
require(IProperty(DAO_PROPERTY).checkGovWhitelist(2, member) == 1, "vFB: not candidate");
require(!isAttendToBoardVote[msg.sender][_index], "vFB: already voted");
require(_voteInfo == 1 || _voteInfo == 2, "vFB: bad vote info");
require(msg.sender != creator, "vFB: self voted");
require(cTime != 0, "vFB: no proposal");
require(__isVotePeriod(IProperty(DAO_PROPERTY).boardVotePeriod(), cTime), "vFB: elapsed period");
uint256 stakeAmount = IStakingPool(STAKING_POOL).getStakeAmount(msg.sender);
Voting storage fbp = filmBoardVoting[_index];
if(_voteInfo == 1) {
fbp.stakeAmount_1 += stakeAmount; // Yes
fbp.voteCount_1++;
} else {
fbp.stakeAmount_2 += stakeAmount; // No
fbp.voteCount_2++;
}
userGovernVoteCount[msg.sender] += 1;
isAttendToBoardVote[msg.sender][_index] = true;
// for removing board member if he don't vote for some period
lastVoteTime[msg.sender] = block.timestamp;
// 1++ for calculating the rewards
IStakingPool(STAKING_POOL).addVotedData(msg.sender, block.timestamp, pID);
emit VotedToFilmBoard(msg.sender, member, _voteInfo, _index);
}
function addFilmBoard(uint256 _index) external onlyStaker nonReentrant {
(uint256 cTime, uint256 aTime, , address member, , ) = IProperty(DAO_PROPERTY).getGovProposalInfo(_index, 2);
require(IProperty(DAO_PROPERTY).checkGovWhitelist(2, member) == 1, "aFB: not candidate");
require(!__isVotePeriod(IProperty(DAO_PROPERTY).boardVotePeriod(), cTime), "aFB: vote period yet");
require(aTime == 0, "aFB: already approved");
uint256 reason = 0;
Voting memory fbp = filmBoardVoting[_index];
uint256 totalVoteCount = fbp.voteCount_1 + fbp.voteCount_2;
if(
totalVoteCount >= IStakingPool(STAKING_POOL).getLimitCount() &&
fbp.stakeAmount_1 > fbp.stakeAmount_2
) {
IProperty(DAO_PROPERTY).updateGovProposal(_index, 2, 1);
govPassedVoteCount[3] += 1;
} else {
IProperty(DAO_PROPERTY).updateGovProposal(_index, 2, 0);
if(totalVoteCount < IStakingPool(STAKING_POOL).getLimitCount()) {
reason = 1;
} else if(fbp.stakeAmount_1 <= fbp.stakeAmount_2) {
reason = 2;
} else {
reason = 10;
}
}
emit FilmBoardAdded(member, msg.sender, reason, _index);
}
///@notice Stakers vote to proposal for setup the address to reward DAO fund
function voteToRewardAddress(uint256 _index, uint256 _voteInfo) external onlyStaker nonReentrant {
(uint256 cTime, , uint256 pID, address member, address creator, ) = IProperty(DAO_PROPERTY).getGovProposalInfo(_index, 3);
require(IProperty(DAO_PROPERTY).checkGovWhitelist(3, member) == 1, "vRA: not candidate");
require(!isAttendToRewardAddressVote[msg.sender][_index], "vRA: already voted");
require(_voteInfo == 1 || _voteInfo == 2, "vRA: bad vote info");
require(msg.sender != creator, "vRA: self voted");
require(cTime != 0, "vRA: no proposal");
require(__isVotePeriod(IProperty(DAO_PROPERTY).rewardVotePeriod(), cTime), "vRA elapsed period");
uint256 stakeAmount = IStakingPool(STAKING_POOL).getStakeAmount(msg.sender);
Voting storage rav = rewardAddressVoting[_index];
if(_voteInfo == 1) {
rav.stakeAmount_1 += stakeAmount; // Yes
rav.voteCount_1++;
} else {
rav.stakeAmount_2 += stakeAmount; // No
rav.voteCount_2++;
}
userGovernVoteCount[msg.sender] += 1;
isAttendToRewardAddressVote[msg.sender][_index] = true;
// for removing board member if he don't vote for some period
lastVoteTime[msg.sender] = block.timestamp;
// 1++ for calculating the rewards
IStakingPool(STAKING_POOL).addVotedData(msg.sender, block.timestamp, pID);
emit VotedToPoolAddress(msg.sender, member, _voteInfo, _index);
}
function setDAORewardAddress(uint256 _index) external onlyStaker nonReentrant {
(uint256 cTime, uint256 aTime, , address member, , ) = IProperty(DAO_PROPERTY).getGovProposalInfo(_index, 3);
require(IProperty(DAO_PROPERTY).checkGovWhitelist(3, member) == 1, "sRA: not candidate");
require(!__isVotePeriod(IProperty(DAO_PROPERTY).rewardVotePeriod(), cTime), "sRA: vote period yet");
require(aTime == 0, "sRA: already approved");
uint256 reason = 0;
Voting memory rav = rewardAddressVoting[_index];
uint256 totalVoteCount = rav.voteCount_1 + rav.voteCount_2;
if(
totalVoteCount >= IStakingPool(STAKING_POOL).getLimitCount() && // Less than limit count
rav.stakeAmount_1 > rav.stakeAmount_2 // less 51%
) {
IProperty(DAO_PROPERTY).updateGovProposal(_index, 3, 1);
govPassedVoteCount[4] += 1;
} else {
IProperty(DAO_PROPERTY).updateGovProposal(_index, 3, 0);
if(totalVoteCount < IStakingPool(STAKING_POOL).getLimitCount()) {
reason = 1;
} else if(rav.stakeAmount_1 <= rav.stakeAmount_2) {
reason = 2;
} else {
reason = 10;
}
}
emit PoolAddressAdded(member, msg.sender, reason, _index);
}
/// @notice Stakers vote(1,2 => Yes, No) to proposal for updating properties(filmVotePeriod, rewardRate, ...)
function voteToProperty(
uint256 _voteInfo,
uint256 _index,
uint256 _flag
) external onlyStaker nonReentrant {
(uint256 cTime, , uint256 pID, uint256 value, address creator, ) = IProperty(DAO_PROPERTY).getPropertyProposalInfo(_index, _flag);
require(!isAttendToPropertyVote[_flag][msg.sender][_index], "vP: already voted");
require(msg.sender != creator, "vP: self voted");
require(_voteInfo == 1 || _voteInfo == 2, "vP: bad vote info");
require(cTime != 0, "vP: no proposal");
require(__isVotePeriod(IProperty(DAO_PROPERTY).propertyVotePeriod(), cTime), "vP: elapsed period");
uint256 stakeAmount = IStakingPool(STAKING_POOL).getStakeAmount(msg.sender);
Voting storage pv = propertyVoting[_flag][_index];
if(_voteInfo == 1) {
pv.stakeAmount_1 += stakeAmount;
pv.voteCount_1++;
} else {
pv.stakeAmount_2 += stakeAmount;
pv.voteCount_2++;
}
userGovernVoteCount[msg.sender] += 1;
isAttendToPropertyVote[_flag][msg.sender][_index] = true;
// for removing board member if he don't vote for some period
lastVoteTime[msg.sender] = block.timestamp;
// 1++ for calculating the rewards
IStakingPool(STAKING_POOL).addVotedData(msg.sender, block.timestamp, pID);
emit VotedToProperty(msg.sender, _flag, value, _voteInfo, _index);
}
/// @notice Update properties based on vote result(>=51% and stakeAmount of "Yes" > 75m)
function updateProperty(
uint256 _index,
uint256 _flag
) external onlyStaker nonReentrant {
(uint256 cTime, uint256 aTime, , uint256 value, , ) = IProperty(DAO_PROPERTY).getPropertyProposalInfo(_index, _flag);
require(!__isVotePeriod(IProperty(DAO_PROPERTY).propertyVotePeriod(), cTime), "pV: vote period yet");
require(aTime == 0, "pV: already approved");
uint256 reason = 0;
Voting memory pv = propertyVoting[_flag][_index];
uint256 totalVoteCount = pv.voteCount_1 + pv.voteCount_2;
if(
totalVoteCount >= IStakingPool(STAKING_POOL).getLimitCount() &&
pv.stakeAmount_1 > pv.stakeAmount_2
) {
IProperty(DAO_PROPERTY).updatePropertyProposal(_index, _flag, 1);
govPassedVoteCount[5] += 1;
} else {
IProperty(DAO_PROPERTY).updatePropertyProposal(_index, _flag, 0);
if(totalVoteCount < IStakingPool(STAKING_POOL).getLimitCount()) {
reason = 1;
} else if(pv.stakeAmount_1 <= pv.stakeAmount_2) {
reason = 2;
} else {
reason = 10;
}
}
emit PropertyUpdated(_flag, value, msg.sender, reason, _index);
}
function __isVotePeriod(
uint256 _period,
uint256 _startTime
) private view returns (bool) {
require(_startTime != 0, "zero start time");
if(_period >= block.timestamp - _startTime) return true;
else return false;
}
/// @notice Update last vote time for removing filmboard member
function getLastVoteTime(address _member) external view override returns (uint256 time_) {
time_ = lastVoteTime[_member];
}
}
{
"compilationTarget": {
"contracts/dao/Vote.sol": "Vote"
},
"evmVersion": "cancun",
"libraries": {
"contracts/libraries/DAOOperations.sol:DAOOperations": "0xdaf27e7ad131c8d2b3e7d3f25342a201e11c88a4"
},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [
":@ensdomains/=node_modules/@ensdomains/",
":@ethereum-waffle/=node_modules/@ethereum-waffle/",
":@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
":eth-gas-reporter/=node_modules/eth-gas-reporter/",
":forge-std/=lib/forge-std/src/",
":foundry-devops/=lib/foundry-devops/",
":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
":hardhat-deploy/=node_modules/hardhat-deploy/",
":hardhat/=node_modules/hardhat/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/"
]
}
[{"inputs":[{"internalType":"address","name":"_ownable","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"agent","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"AuditorReplaced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"agent","type":"address"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"DisputedToAgent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"filmId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fundType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reason","type":"uint256"}],"name":"FilmApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"boardMember","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"reason","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"FilmBoardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"reason","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"PoolAddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"whichProperty","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"propertyValue","type":"uint256"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"reason","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"PropertyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"agent","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"reason","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"UpdatedAgentStats","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"address","name":"agent","type":"address"},{"indexed":false,"internalType":"uint256","name":"voteInfo","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"VotedToAgent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"uint256","name":"filmId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"voteInfo","type":"uint256"}],"name":"VotedToFilm","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"address","name":"candidate","type":"address"},{"indexed":false,"internalType":"uint256","name":"voteInfo","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"VotedToFilmBoard","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"address","name":"rewardAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"voteInfo","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"VotedToPoolAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"flag","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"propertyVal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"voteInfo","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"VotedToProperty","type":"event"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"addFilmBoard","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"agentVoting","outputs":[{"internalType":"uint256","name":"stakeAmount_1","type":"uint256"},{"internalType":"uint256","name":"stakeAmount_2","type":"uint256"},{"internalType":"uint256","name":"voteCount_1","type":"uint256"},{"internalType":"uint256","name":"voteCount_2","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_filmIds","type":"uint256[]"}],"name":"approveFilms","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"bool","name":"_pay","type":"bool"}],"name":"disputeToAgent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"filmBoardVoting","outputs":[{"internalType":"uint256","name":"stakeAmount_1","type":"uint256"},{"internalType":"uint256","name":"stakeAmount_2","type":"uint256"},{"internalType":"uint256","name":"voteCount_1","type":"uint256"},{"internalType":"uint256","name":"voteCount_2","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"filmVoting","outputs":[{"internalType":"uint256","name":"stakeAmount_1","type":"uint256"},{"internalType":"uint256","name":"stakeAmount_2","type":"uint256"},{"internalType":"uint256","name":"voteCount_1","type":"uint256"},{"internalType":"uint256","name":"voteCount_2","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_member","type":"address"}],"name":"getLastVoteTime","outputs":[{"internalType":"uint256","name":"time_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"govPassedVoteCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vabbleDAO","type":"address"},{"internalType":"address","name":"_stakingPool","type":"address"},{"internalType":"address","name":"_property","type":"address"},{"internalType":"address","name":"_uniHelper","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"isAttendToAgentVote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"isAttendToBoardVote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"isAttendToFilmVote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"isAttendToPropertyVote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"isAttendToRewardAddressVote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"isDoubleStaked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"propertyVoting","outputs":[{"internalType":"uint256","name":"stakeAmount_1","type":"uint256"},{"internalType":"uint256","name":"stakeAmount_2","type":"uint256"},{"internalType":"uint256","name":"voteCount_1","type":"uint256"},{"internalType":"uint256","name":"voteCount_2","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"replaceAuditor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardAddressVoting","outputs":[{"internalType":"uint256","name":"stakeAmount_1","type":"uint256"},{"internalType":"uint256","name":"stakeAmount_2","type":"uint256"},{"internalType":"uint256","name":"voteCount_1","type":"uint256"},{"internalType":"uint256","name":"voteCount_2","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_filmId","type":"uint256"},{"internalType":"uint256","name":"_proposalID","type":"uint256"}],"name":"saveProposalWithFilm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"setDAORewardAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"updateAgentStats","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"uint256","name":"_flag","type":"uint256"}],"name":"updateProperty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userFilmVoteCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userGovernVoteCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voteInfo","type":"uint256"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"voteToAgent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"uint256","name":"_voteInfo","type":"uint256"}],"name":"voteToFilmBoard","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_filmIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_voteInfos","type":"uint256[]"}],"name":"voteToFilms","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voteInfo","type":"uint256"},{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"uint256","name":"_flag","type":"uint256"}],"name":"voteToProperty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"uint256","name":"_voteInfo","type":"uint256"}],"name":"voteToRewardAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]