Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
AlienTornadosaurusHex 2023-05-26 21:33:46 +00:00
parent 311e20c225
commit a6bbe9e1f7
11 changed files with 149 additions and 53 deletions

3
.env.example Normal file

@ -0,0 +1,3 @@
MAINNET_RPC_URL=
PRIVATE_KEY=
ETHERSCAN_KEY=

5
.gitignore vendored

@ -14,4 +14,7 @@ docs/
.env
# Node modules
node_modules
node_modules/
# yarn
yarn.lock

@ -1,8 +1,14 @@
[profile.default]
solc-version = "0.8.20"
# General
src = 'src'
out = 'out'
libs = ["node_modules", "lib"]
chain_id = 1
# Compiler
auto_detect_solc = true
optimizer = true
optimizer-runs = 10_000_000
optimizer-runs = 1_000_000
# Network
chain_id = 1
rpc_endpoints = { mainnet = "${MAINNET_RPC_URL}" }

@ -1,8 +1,17 @@
{
"name": "governance-proposal-template",
"name": "proposal-template",
"version": "1.0.0",
"repository": "https://git.tornado.ws/AlienTornadosaurusHex/governance-proposal-template",
"repository": "https://git.tornado.ws/AlienTornadosaurusHex/proposal-template",
"author": "AlienTornadosaurusHex",
"license": "MIT",
"private": false
"private": false,
"dependencies": {
"@ensdomains/ens-contracts": "^0.0.21",
"@openzeppelin/contracts": "^4.9.0",
"@openzeppelin/upgrades-core": "^1.26.2"
},
"optionalDependencies": {
"@gnosis.pm/ido-contracts": "^0.5.0",
"@gnosis.pm/safe-contracts": "1.3.0"
}
}

9
remappings.txt Normal file

@ -0,0 +1,9 @@
src/=src/
common/=src/common/
forge-std/=lib/forge-std/src/
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@openzeppelin/upgrades/=node_modules/@openzeppelin/upgrades-core/
@ens/contracts/=node_modules/@ensdomains/ens-contracts/contracts/
@gnosis/contracts/=node_modules/@gnosis.pm/safe-contracts/contracts/
@gnosis/ido-contracts/=node_modules/@gnosis.pm/ido-contracts/contracts/

@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {ENS} from "@ens/contracts/registry/ENS.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IGovernance} from "common/interfaces/IGovernance.sol";
import {IGnosisSafe} from "common/interfaces/IGnosisSafe.sol";
contract TornadoProposal {
function getMultisig() internal pure returns (IGnosisSafe) {
return IGnosisSafe(0xb04E030140b30C27bcdfaafFFA98C57d80eDa7B4);
}
function getEns() internal pure returns (ENS) {
return ENS(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e);
}
function getTornToken() internal pure returns (IERC20) {
return IERC20(0x77777FeDdddFfC19Ff86DB637967013e6C6A116C);
}
function getGovernance() internal pure returns (IGovernance) {
return IGovernance(getGovernanceProxyAddress());
}
function getGovernanceProxyAddress() internal pure returns (address) {
return 0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce;
}
function getStakingProxyAddress() internal pure returns (address) {
return 0x2FC93484614a34f26F7970CBB94615bA109BB4bf;
}
function getRegistryProxyAddress() internal pure returns (address) {
return 0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2;
}
}

@ -1,24 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { LoopbackProxy } from "../v1/LoopbackProxy.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { GovernancePatchUpgrade } from "./GovernancePatchUpgrade.sol";
import { TornadoStakingRewards } from "./TornadoStakingRewards.sol";
import { RelayerRegistry } from "./RelayerRegistry.sol";
contract BaseProposal {
function getGovernanceProxyAddress() internal pure returns (address memory) {
return "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce";
}
function getStakingProxyAddress() internal pure returns (address memory) {
return "0x2FC93484614a34f26F7970CBB94615bA109BB4bf";
}
function getRegistryProxyAddress() internal pure returns (address memory) {
return "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2";
}
}

@ -1,11 +0,0 @@
pragma solidity ^0.8.20;
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
function balanceOf(address owner) external returns (uint256);
function approve(address spender, uint256 amount) external;
}

@ -0,0 +1,70 @@
pragma solidity ^0.8.19;
interface IGnosisSafe {
enum Operation {
Call,
DelegateCall
}
function setup(
address[] calldata _owners,
uint256 _threshold,
address to,
bytes calldata data,
address fallbackHandler,
address paymentToken,
uint256 payment,
address payable paymentReceiver
) external;
function execTransaction(
address to,
uint256 value,
bytes calldata data,
Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address payable refundReceiver,
bytes calldata signatures
) external returns (bool success);
function requiredTxGas(address to, uint256 value, bytes calldata data, Operation operation)
external
returns (uint256);
function approveHash(bytes32 hashToApprove) external;
function signMessage(bytes calldata _data) external;
function isValidSignature(bytes calldata _data, bytes calldata _signature) external returns (bytes4);
function getMessageHash(bytes memory message) external view returns (bytes32);
function encodeTransactionData(
address to,
uint256 value,
bytes memory data,
Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address refundReceiver,
uint256 _nonce
) external view returns (bytes memory);
function getTransactionHash(
address to,
uint256 value,
bytes memory data,
Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address refundReceiver,
uint256 _nonce
) external view returns (bytes32);
}

@ -1,4 +1,4 @@
pragma solidity ^0.8.20;
pragma solidity ^0.8.19;
struct Proposal {
// Creator of the proposal
@ -23,7 +23,6 @@ struct Proposal {
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);
@ -32,18 +31,12 @@ interface IGovernance {
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 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 lockWithApproval(uint256 amount) external;
function execute(uint256 proposalId) external payable;
}

@ -1,4 +1,4 @@
pragma solidity ^0.8.20;
pragma solidity ^0.8.19;
contract Common {
uint256 constant TEST_PRIVATE_KEY_ONE = 0x66ddbd7cbe4a566df405f6ded0b908c669f88cdb1656380c050e3a457bd21df0;
@ -31,4 +31,3 @@ contract Common {
uint16 constant PERMIT_FUNC_SELECTOR = uint16(0x1901);
}