Recalculate exact TORN amount

This commit is contained in:
Theo 2023-11-23 19:54:52 -08:00
parent d3b2d87799
commit 6c58e66b19
5 changed files with 63 additions and 6 deletions

@ -1 +1 @@
uint256 public constant reimbursementAmount = 6226 ether;
uint256 public constant reimbursementAmount = 6467 ether;

@ -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";

@ -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);

@ -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);
}

@ -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);
}
}