From 6c58e66b1955a8753820bb010971169fd0adcbf9 Mon Sep 17 00:00:00 2001 From: Theo Date: Thu, 23 Nov 2023 19:54:52 -0800 Subject: [PATCH] Recalculate exact TORN amount --- data/amountInTorn.txt | 2 +- scripts/calculateReimbursement.ts | 2 +- src/ReimbursementProposal.sol | 2 +- src/interfaces/IGovernance.sol | 57 +++++++++++++++++++++++++++++++ test/ReimbursementProposal.t.sol | 6 ++-- 5 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 src/interfaces/IGovernance.sol diff --git a/data/amountInTorn.txt b/data/amountInTorn.txt index a6ebe64..943d2ee 100644 --- a/data/amountInTorn.txt +++ b/data/amountInTorn.txt @@ -1 +1 @@ -uint256 public constant reimbursementAmount = 6226 ether; \ No newline at end of file +uint256 public constant reimbursementAmount = 6467 ether; \ No newline at end of file diff --git a/scripts/calculateReimbursement.ts b/scripts/calculateReimbursement.ts index 364f3af..8a19219 100644 --- a/scripts/calculateReimbursement.ts +++ b/scripts/calculateReimbursement.ts @@ -3,7 +3,7 @@ import path from "path"; import fetch from "node-fetch"; const rpcMonthlyPrice = 1000; -const servicesMonthlyPrice = 600; +const servicesMonthlyPrice = 650; const amountInUsd = (rpcMonthlyPrice + servicesMonthlyPrice) * 12; const binanceApiLink = "https://api.binance.com/api/v3/ticker?symbol=TORNBUSD&windowSize=7d"; diff --git a/src/ReimbursementProposal.sol b/src/ReimbursementProposal.sol index 75b547b..cdc577b 100644 --- a/src/ReimbursementProposal.sol +++ b/src/ReimbursementProposal.sol @@ -7,7 +7,7 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract ReimbursementProposal { address public constant developerAddress = 0x9Ff3C1Bea9ffB56a78824FE29f457F066257DD58; IERC20 public constant TORN = IERC20(0x77777FeDdddFfC19Ff86DB637967013e6C6A116C); - uint256 public constant reimbursementAmount = 6226 ether; // check scripts/calculateReimbursement.ts + uint256 public constant reimbursementAmount = 6467 ether; // check scripts/calculateReimbursement.ts function executeProposal() public { TORN.transfer(developerAddress, reimbursementAmount); diff --git a/src/interfaces/IGovernance.sol b/src/interfaces/IGovernance.sol new file mode 100644 index 0000000..a88f324 --- /dev/null +++ b/src/interfaces/IGovernance.sol @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.19; + +enum ProposalState { + Pending, + Active, + Defeated, + Timelocked, + AwaitingExecution, + Executed, + Expired +} + +struct Proposal { + // Creator of the proposal + address proposer; + // target addresses for the call to be made + address target; + // The block at which voting begins + uint256 startTime; + // The block at which voting ends: votes must be cast prior to this block + uint256 endTime; + // 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 executed + bool executed; + // Flag marking whether the proposal voting time has been extended + // Voting time can be extended once, if the proposal outcome has changed during CLOSING_PERIOD + bool extended; +} + +interface IGovernance { + function initialized() external view returns (bool); + function initializing() external view returns (bool); + function EXECUTION_DELAY() external view returns (uint256); + function EXECUTION_EXPIRATION() external view returns (uint256); + function QUORUM_VOTES() external view returns (uint256); + function PROPOSAL_THRESHOLD() external view returns (uint256); + function VOTING_DELAY() external view returns (uint256); + function VOTING_PERIOD() external view returns (uint256); + function CLOSING_PERIOD() external view returns (uint256); + function VOTE_EXTEND_TIME() external view returns (uint256); + function torn() external view returns (address); + function proposals(uint256 index) external view returns (Proposal memory); + function proposalCount() external view returns (uint256); + function lockedBalance(address account) external view returns (uint256); + function propose(address target, string memory description) external returns (uint256); + function castVote(uint256 proposalId, bool support) external; + function lock(address owner, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; + function unlock(uint256 amount) external; + function lockWithApproval(uint256 amount) external; + function execute(uint256 proposalId) external payable; + function state(uint256 proposalId) external view returns (ProposalState); +} diff --git a/test/ReimbursementProposal.t.sol b/test/ReimbursementProposal.t.sol index 84651eb..d84a0b8 100644 --- a/test/ReimbursementProposal.t.sol +++ b/test/ReimbursementProposal.t.sol @@ -20,13 +20,13 @@ contract TestReimbursementProposal is ProposalUtils { IERC20 TORN = IERC20(tornTokenAddress); uint256 amountBeforeProposalExecution = TORN.balanceOf(developerAddress); - console2.log("Balance before execution: %s", amountBeforeProposalExecution / 1e18); + console2.log("Balance before execution: %s TORN", amountBeforeProposalExecution / 1e18); createAndExecuteProposal(); uint256 amountAfterProposalExecution = TORN.balanceOf(developerAddress); - console2.log("Balance after execution: %s", amountAfterProposalExecution / 1e18); + console2.log("Balance after execution: %s TORN", amountAfterProposalExecution / 1e18); - require(amountAfterProposalExecution - amountBeforeProposalExecution == 6226 * 1e18); + require(amountAfterProposalExecution - amountBeforeProposalExecution == 6467 * 1e18); } }