Skip to content

Commit

Permalink
Merge pull request #956 from TempleDAO/stage
Browse files Browse the repository at this point in the history
stage -> main
  • Loading branch information
frontier159 authored Jan 29, 2024
2 parents 6224392 + 9551def commit f3d8ab4
Show file tree
Hide file tree
Showing 15 changed files with 536 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ const DashboardContent = ({ selectedDashboard = DashboardType.TREASURY_RESERVES_
title: 'Treasury Reserves Vault',
description:
'Treasury Reserves Vault (TRV) coordinates and manages the flow of capital for current Treasury allocations. When funding and management parameters are approved for a Strategy, the TRV will transfer funds e.g. DAI and issue corresponding debt to the Strategy borrower. The current equity of the Strategy is discounted by the loan principal and accrued interest benchmarked to the prevailing rate of the current Base Strategy for the borrowed token.',
chartStrategyNames: [StrategyKey.TEMPLEBASE, StrategyKey.RAMOS, StrategyKey.DSRBASE],
chartStrategyNames: [
StrategyKey.TEMPLEBASE,
StrategyKey.RAMOS,
StrategyKey.DSRBASE,
StrategyKey.TEMPLO_MAYOR_GNOSIS
],
link: `${env.etherscan}/address/${env.contracts.treasuryReservesVault}`,
},
[DashboardType.RAMOS]: {
Expand Down
1 change: 1 addition & 0 deletions apps/dapp/src/constants/env/production.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const env: Environment = {
{ name: 'Epoch 22a', address: '0xDDbea74f5c53063e6c489d3a424e95c3c2BfB2cb' },
{ name: 'Epoch 22b', address: '0x9516E1ad540573a6704f2b7fbA165bC05821e552' },
{ name: 'Epoch 22c', address: '0x57cE4E4dcA88A5E1f3788D8e47c46687F91B6AfE' },
{ name: 'Epoch 23a', address: '0xC05C4123a4870293521980640ddFE37eb5c32dB6' },
],
temple: '0x470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7',
templeStaking: '0x4D14b24EDb751221B3Ff08BBB8bd91D4b1c8bc77',
Expand Down
2 changes: 2 additions & 0 deletions protocol/scripts/deploys/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface TeamPayments {
TEMPLE_TEAM_EPOCH_22A: string;
TEMPLE_TEAM_EPOCH_22B: string;
TEMPLE_TEAM_EPOCH_22C: string;
TEMPLE_TEAM_EPOCH_23A: string;
}

export interface DeployedContracts {
Expand Down Expand Up @@ -320,6 +321,7 @@ export const DEPLOYED_CONTRACTS: { [key: string]: DeployedContracts } = {
TEMPLE_TEAM_EPOCH_22A: '0xDDbea74f5c53063e6c489d3a424e95c3c2BfB2cb',
TEMPLE_TEAM_EPOCH_22B: '0x9516E1ad540573a6704f2b7fbA165bC05821e552',
TEMPLE_TEAM_EPOCH_22C: '0x57cE4E4dcA88A5E1f3788D8e47c46687F91B6AfE',
TEMPLE_TEAM_EPOCH_23A: '0xC05C4123a4870293521980640ddFE37eb5c32dB6',
},

TEMPLE_TEAM_PAYMENTS_IMPLEMENTATION: '',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// mainnet: STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.DAI=0x1d4f48f3F64c90a60ff302784CD66f1E8127852D
// yarn hardhat verify --network mainnet 0x1d4f48f3F64c90a60ff302784CD66f1E8127852D --constructor-args scripts/deploys/mainnet/deploymentArgs/0x1d4f48f3F64c90a60ff302784CD66f1E8127852D.js
module.exports = [
"0x9f90430179D9b67341BFa50559bc7B8E35629f1b",
"0xb1E8AB0a81AaDf632a653E46Caeda1593d71d143",
93600,
13,
"500000000000000000000000"
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// mainnet: STRATEGIES.FOHMO_GNOSIS_STRATEGY.OTC_OFFER.OHM_DAI=0xA8a742A05982f853fb5836d040cf3498249041B9
// yarn hardhat verify --network mainnet 0xA8a742A05982f853fb5836d040cf3498249041B9 --constructor-args scripts/deploys/mainnet/deploymentArgs/0xA8a742A05982f853fb5836d040cf3498249041B9.js
module.exports = [
"0x6B175474E89094C44Da98b954EedeAC495271d0F",
"0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5",
"0xA0eC2aF0aE7fE5F3Ae572a2C8349f7E26bE2e5Fd",
"13900000000000000000",
1,
"13750000000000000000",
"19000000000000000000"
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// mainnet: STRATEGIES.FOHMO_GNOSIS_STRATEGY.ADDRESS=0xF179C63735690d2C08cfb231d15c0c7ac3A2Bc67
// yarn hardhat verify --network mainnet 0xF179C63735690d2C08cfb231d15c0c7ac3A2Bc67 --constructor-args scripts/deploys/mainnet/deploymentArgs/0xF179C63735690d2C08cfb231d15c0c7ac3A2Bc67.js
module.exports = [
"0x9f90430179D9b67341BFa50559bc7B8E35629f1b",
"0xb1E8AB0a81AaDf632a653E46Caeda1593d71d143",
"FohmoStrategy",
"0xf359Bae7b6AD295724e798A3Ef6Fa5109919F399",
"0xA0eC2aF0aE7fE5F3Ae572a2C8349f7E26bE2e5Fd",
"0x87B8D213177FB132e508b5d7018f7b590e00a480"
];
2 changes: 1 addition & 1 deletion protocol/scripts/deploys/mainnet/team-payments/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
expectAddressWithPrivateKey,
toAtto,
} from '../../helpers';
import snapshot from './json/epoch22c.json';
import snapshot from './json/epoch23a.json';

// TODO: Add command line arguments for json allocations file
async function main() {
Expand Down
16 changes: 16 additions & 0 deletions protocol/scripts/deploys/mainnet/team-payments/json/epoch23a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"0xE58C06c3372687039140ceb64cB05f78D71fA133": 3250,
"0xB8C400E4E9360ae7a3480A2F63e2A5aA85696148": 250,
"0xe07d083d4A8810E5b35300a6De579fB2AF525e2F": 9000,
"0x14d62c8faC60d71714F54bd3f7dF18433475968b": 12000,
"0x66a60022c7B15BBbBe265C55Ad096e44f1138e19": 7500,
"0xF26c0eBb04e794c666730233842Ca854D1747deF": 2500,
"0x1cCbe98Ce51d3ba16A5F29b7f970c3e101ded67f": 10000,
"0x07dA99dff5F996FaD9FCe0e15a20edC4DBeAe028": 14400,
"0x038D946DD8488237D8E710a45b6E801F1Ee4dc01": 14000,
"0xe345e9605391c13Fd2502e7141D54b752AaDB184": 12000,
"0x036fea042993eba9Cbd0BFbAe5C325644230e292": 10000,
"0x9F7eE729DDE0D95ffCf69F5606D534Ee47b303C0": 20000,
"0x588282ADA5B9D872d0eBF506c5C1b541e2a60BBa": 14000,
"0x97Ec4001aD1d2a1FBb581ea34C5C0Bd4a210C25C": 42500
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import '@nomiclabs/hardhat-ethers';
import { ethers } from 'hardhat';
import { TempleCircuitBreakerAllUsersPerPeriod__factory } from '../../../../../typechain';
import {
deployAndMine,
ensureExpectedEnvvars,
} from '../../../helpers';
import { getDeployedContracts } from '../contract-addresses';

async function main() {
ensureExpectedEnvvars();
const [owner] = await ethers.getSigners();
const TEMPLE_V2_ADDRESSES = getDeployedContracts();

const circuitBreakerFactory = new TempleCircuitBreakerAllUsersPerPeriod__factory(owner);
await deployAndMine(
'STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.DAI',
circuitBreakerFactory,
circuitBreakerFactory.deploy,
TEMPLE_V2_ADDRESSES.CORE.RESCUER_MSIG,
await owner.getAddress(),
60*60*26, // 26 hours
13, // no of buckets
ethers.utils.parseEther("500000"), // 500k cap per bucket
);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Not yet needed for Templo Mayor, but may be in future

import '@nomiclabs/hardhat-ethers';
// import { ethers } from 'hardhat';
// import { TempleCircuitBreakerAllUsersPerPeriod__factory } from '../../../../../typechain';
import {
// deployAndMine,
ensureExpectedEnvvars,
} from '../../../helpers';
// import { getDeployedContracts } from '../contract-addresses';

async function main() {
ensureExpectedEnvvars();
// const [owner] = await ethers.getSigners();
// const TEMPLE_V2_ADDRESSES = getDeployedContracts();

// const circuitBreakerFactory = new TempleCircuitBreakerAllUsersPerPeriod__factory(owner);

// await deployAndMine(
// 'STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.TEMPLE',
// circuitBreakerFactory,
// circuitBreakerFactory.deploy,
// TEMPLE_V2_ADDRESSES.CORE.RESCUER_MSIG,
// await owner.getAddress(),
// 60*60*26, // 26 hours
// 13, // no of buckets
// ethers.utils.parseEther("10000000"), // 10mm cap per bucket
// );
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import "@nomiclabs/hardhat-ethers";
import { ethers } from "hardhat";
import {
GnosisStrategy__factory
} from "../../../../../typechain";
import {
deployAndMine,
ensureExpectedEnvvars,
} from "../../../helpers";
import { getDeployedContracts } from '../contract-addresses';

async function main() {
ensureExpectedEnvvars();
const [owner] = await ethers.getSigners();
const TEMPLE_V2_ADDRESSES = getDeployedContracts();

const factory = new GnosisStrategy__factory(owner);
await deployAndMine(
"STRATEGIES.FOHMO_GNOSIS_STRATEGY.ADDRESS",
factory,
factory.deploy,
TEMPLE_V2_ADDRESSES.CORE.RESCUER_MSIG,
await owner.getAddress(),
"FohmoStrategy",
TEMPLE_V2_ADDRESSES.TREASURY_RESERVES_VAULT.ADDRESS,
TEMPLE_V2_ADDRESSES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.UNDERLYING_GNOSIS_SAFE,
TEMPLE_V2_ADDRESSES.CORE.CIRCUIT_BREAKER_PROXY,
);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import '@nomiclabs/hardhat-ethers';
import { ethers } from 'hardhat';
import { OtcOffer__factory } from '../../../../../typechain';
import {
deployAndMine,
ensureExpectedEnvvars,
} from '../../../helpers';
import { getDeployedContracts } from '../contract-addresses';

async function main() {
ensureExpectedEnvvars();
const [owner] = await ethers.getSigners();
const TEMPLE_V2_ADDRESSES = getDeployedContracts();

const factory = new OtcOffer__factory(owner);
await deployAndMine(
'STRATEGIES.FOHMO_GNOSIS_STRATEGY.OTC_OFFER.OHM_DAI',
factory,
factory.deploy,
TEMPLE_V2_ADDRESSES.EXTERNAL.MAKER_DAO.DAI_TOKEN, // user sell token
TEMPLE_V2_ADDRESSES.EXTERNAL.OLYMPUS.OHM_TOKEN, // user buy token
TEMPLE_V2_ADDRESSES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.UNDERLYING_GNOSIS_SAFE, // fundsOwner
ethers.utils.parseEther("13.90"), // initial offerPrice -- always 18 dp
1, // offerPricingToken == DAI (USER_SELL_TOKEN)
ethers.utils.parseEther("13.75"), // minOfferPrice
ethers.utils.parseEther("19"), // maxOfferPrice
);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import "@nomiclabs/hardhat-ethers";
import { ethers } from "hardhat";
import {
ensureExpectedEnvvars,
mine,
setExplicitAccess,
} from "../../../helpers";
import { ContractInstances, ContractAddresses, connectToContracts, getDeployedContracts } from "../contract-addresses";
import { ITempleStrategy, TempleElevatedAccess } from "../../../../../typechain";

let TEMPLE_V2_ADDRESSES: ContractAddresses;
let TEMPLE_V2_INSTANCES: ContractInstances;
let TEMPLE_V2_EXECUTOR_INSTANCES: ContractInstances;

const NAME = "FohmoStrategy";
// NAME_HASH === 0x4636ad4b030b2202c1535278671ad49fa591ff1ca722bee883692b03d34e68c8
const NAME_HASH = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(NAME));

// These will need to be created from the executor multisig
async function setupFromExecutorMultisig() {
{
// Circuit breaker identifiers
await mine(TEMPLE_V2_EXECUTOR_INSTANCES.CORE.CIRCUIT_BREAKER_PROXY.setIdentifierForCaller(
TEMPLE_V2_ADDRESSES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.ADDRESS,
NAME
));

// Circuit breaker for Dai
await mine(TEMPLE_V2_EXECUTOR_INSTANCES.CORE.CIRCUIT_BREAKER_PROXY.setCircuitBreaker(
NAME_HASH,
TEMPLE_V2_ADDRESSES.EXTERNAL.MAKER_DAO.DAI_TOKEN,
TEMPLE_V2_ADDRESSES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.DAI
));

// No Temple CB for the main treasury strategy
// Circuit breaker for Temple
// await mine(TEMPLE_V2_EXECUTOR_INSTANCES.CORE.CIRCUIT_BREAKER_PROXY.setCircuitBreaker(
// NAME_HASH,
// TEMPLE_V2_ADDRESSES.CORE.TEMPLE_TOKEN,
// TEMPLE_V2_ADDRESSES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.TEMPLE
// ));
}

{
const debtCeiling: ITempleStrategy.AssetBalanceStruct[] = [
{
asset: TEMPLE_V2_ADDRESSES.EXTERNAL.MAKER_DAO.DAI_TOKEN,
balance: ethers.utils.parseEther("2000000"), // $2mm
},
{
asset: TEMPLE_V2_ADDRESSES.CORE.TEMPLE_TOKEN,
balance: ethers.utils.parseEther("0"), // No temple debt allowed
}
];

await mine(TEMPLE_V2_EXECUTOR_INSTANCES.TREASURY_RESERVES_VAULT.INSTANCE.addStrategy(
TEMPLE_V2_ADDRESSES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.ADDRESS,
0, // underperformingEquityThreshold
debtCeiling
));
}
}

async function setup() {
{
// Grant permission for the circuit breaker proxy to call the underlying circuit breakers
await setExplicitAccess(
TEMPLE_V2_INSTANCES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.DAI,
TEMPLE_V2_ADDRESSES.CORE.CIRCUIT_BREAKER_PROXY,
["preCheck"],
true
);

// No Temple CB for the main treasury strategy
// await setExplicitAccess(
// TEMPLE_V2_INSTANCES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.TEMPLE,
// TEMPLE_V2_ADDRESSES.CORE.CIRCUIT_BREAKER_PROXY,
// ["preCheck"],
// true
// );
}

{
// Register DAI and Temple as the tokens to track
// And also OHM/GOHM
await mine(TEMPLE_V2_INSTANCES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.INSTANCE.setAssets([
TEMPLE_V2_ADDRESSES.EXTERNAL.MAKER_DAO.DAI_TOKEN,
TEMPLE_V2_ADDRESSES.CORE.TEMPLE_TOKEN,
TEMPLE_V2_ADDRESSES.EXTERNAL.OLYMPUS.OHM_TOKEN,
TEMPLE_V2_ADDRESSES.EXTERNAL.OLYMPUS.GOHM_TOKEN,
]));
}
}

async function proposeExecutor(contract: TempleElevatedAccess, executor: string) {
console.log(`proposing executor for contract: ${contract.address} = ${executor}`);
await mine(contract.proposeNewExecutor(executor));
}

async function proposeCore(contract: TempleElevatedAccess) {
await proposeExecutor(contract, TEMPLE_V2_ADDRESSES.CORE.EXECUTOR_MSIG);
}

async function transferOwnership() {
await proposeExecutor(
TEMPLE_V2_INSTANCES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.INSTANCE,
TEMPLE_V2_ADDRESSES.CORE.EXECUTOR_MSIG,
);
await proposeCore(TEMPLE_V2_INSTANCES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.DAI);
// await proposeCore(TEMPLE_V2_INSTANCES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.CIRCUIT_BREAKERS.TEMPLE);

await mine(TEMPLE_V2_INSTANCES.STRATEGIES.FOHMO_GNOSIS_STRATEGY.OTC_OFFER.OHM_DAI.transferOwnership(TEMPLE_V2_ADDRESSES.CORE.EXECUTOR_MSIG));
}

async function main() {
ensureExpectedEnvvars();
const [owner] = await ethers.getSigners();
TEMPLE_V2_ADDRESSES = getDeployedContracts();
TEMPLE_V2_INSTANCES = connectToContracts(owner);

// await setup();
// await setupFromExecutorMultisig();
await transferOwnership();
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Loading

0 comments on commit f3d8ab4

Please sign in to comment.