good morning!!!!

Skip to content
Snippets Groups Projects
Commit e2fff913 authored by Jake Barber's avatar Jake Barber
Browse files

SNX patch

parent e4471973
Loading
Pipeline #25911 failed
This diff is collapsed.
# Proposal to complete listing for SNX on the Optimism Deployment of Interest Protocol
## Overview
The Optimism deployment of Interest Protocol has been completed and is ready for action!
[See the announcement here!](https://forums.interestprotocol.io/t/interest-protocol-optimism/217)
The first cross-chain proposal has been [executed](https://etherscan.io/tx/0x0af80f88331b2da461560e880d0f62481b309c1eb5cf154cb9fb9910bc306461)!
Cross-chain proposals present some unique challenges as compared to standard mainnet proposals. In particular, it is impossible to completely test the execution of the proposal beforehand.
While this was an excellent learning experience, some aspects of this first proposal did not execute as intended.
Specifically, the listing of SNX on the Oracle Master failed due to the ownership of this contract not being successfully transferred to the Optimism Cross Chain Account.
This in turn resulted in the listing of SNX on the Vault Controller to fail, as the listing on the Oracle Master must occur prior to listing on the Vault Controller.
However, listing SNX on the VotingVaultController did indeed occur successfully! Likewise, the cap for Capped WBTC has been updated, and this asset is now ready for use on Optimism!
**No security or integrity issues have occurred as a result of this error.**
Currently, it is possible to deposit SNX and receive Capped SNX, however this asset has no LTV or oracle price at the moment.
Borrowers should note: While it is possible to deposit SNX for Capped SNX, if a vault contains a listed asset in addition and is not solvent, then withdrawal of the SNX will be impossible until solvency is reached.
A relatively simple fix has been made, and a new proposal will remedy the problem once executed.
...@@ -16,7 +16,9 @@ import * as fs from 'fs' ...@@ -16,7 +16,9 @@ import * as fs from 'fs'
import { currentBlock, fastForward, hardhat_mine, reset, resetCurrent, resetCurrentOP } from "../../../util/block" import { currentBlock, fastForward, hardhat_mine, reset, resetCurrent, resetCurrentOP } from "../../../util/block"
import hre from 'hardhat' import hre from 'hardhat'
import { OptimisimAddresses, OptimisimDeploys, MainnetAddresses } from "../../../util/addresser"; import { OptimisimAddresses, OptimisimDeploys, MainnetAddresses } from "../../../util/addresser";
import { BytesLike } from "ethers" import { TransactionRequest } from "@ethersproject/providers"
import { BigNumber, Contract, Signer } from "ethers"
const a = new OptimisimAddresses() const a = new OptimisimAddresses()
const d = new OptimisimDeploys() const d = new OptimisimDeploys()
const m = new MainnetAddresses() const m = new MainnetAddresses()
...@@ -25,7 +27,7 @@ const { ethers, network } = require("hardhat") ...@@ -25,7 +27,7 @@ const { ethers, network } = require("hardhat")
const govAddress = "0x266d1020A84B9E8B0ed320831838152075F8C4cA" const govAddress = "0x266d1020A84B9E8B0ed320831838152075F8C4cA"
/*****************************CHANGE THESE/*****************************/ /*****************************CHANGE THESE/*****************************/
const proposeFromScript = true //IF TRUE, PRIVATE KEY MUST BE IN .env as PERSONAL_PRIVATE_KEY=42bb... const proposeFromScript = false //IF TRUE, PRIVATE KEY MUST BE IN .env as PERSONAL_PRIVATE_KEY=42bb...
const SnxLTV = BN("70e16") const SnxLTV = BN("70e16")
const SnxLiqInc = BN("75e15") const SnxLiqInc = BN("75e15")
...@@ -125,7 +127,7 @@ const proposestEthSTABLE = async (proposer: SignerWithAddress) => { ...@@ -125,7 +127,7 @@ const proposestEthSTABLE = async (proposer: SignerWithAddress) => {
proposalText, proposalText,
false false
) )
console.log("TRANSACTION DATA: \n", data.data) //console.log("TRANSACTION DATA: \n", data.data)
} }
} }
...@@ -154,23 +156,17 @@ const quickTest = async (proposer: SignerWithAddress, out: any) => { ...@@ -154,23 +156,17 @@ const quickTest = async (proposer: SignerWithAddress, out: any) => {
await impersonateAccount(whale) await impersonateAccount(whale)
await gov.connect(prop).castVote(proposal, 1) await gov.connect(prop).castVote(proposal, 1)
showBodyCyan("Advancing a lot of blocks again...") showBodyCyan("Advancing a lot of blocks again...")
await hardhat_mine(votingPeriod.toNumber()) await hardhat_mine(votingPeriod.toNumber())
await gov.connect(prop).queue(proposal) await gov.connect(prop).queue(proposal)
await fastForward(timelock.toNumber()) await fastForward(timelock.toNumber())
const result = await gov.connect(prop).execute(proposal) const result = await gov.connect(prop).execute(proposal)
await result.wait() await result.wait()
showBodyCyan("EXECUTION COMPLETE") showBodyCyan("EXECUTION COMPLETE")
await ceaseImpersonation(whale) await ceaseImpersonation(whale)
} }
async function main() { async function main() {
......
import { BN } from "../../../util/number"
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"
import {
CappedNonStandardToken__factory,
CrossChainAccount__factory,
GovernorCharlieDelegate,
GovernorCharlieDelegate__factory, ILayer1Messenger, ILayer1Messenger__factory, OracleMaster__factory,
ProxyAdmin__factory,
VaultController__factory,
VotingVaultController__factory
} from "../../../typechain-types"
import { ProposalContext } from "../suite/proposal"
import { impersonateAccount, ceaseImpersonation } from "../../../util/impersonator"
import { showBody, showBodyCyan } from "../../../util/format"
import * as fs from 'fs'
import { currentBlock, fastForward, hardhat_mine, reset, resetCurrent, resetCurrentOP } from "../../../util/block"
import hre from 'hardhat'
import { OptimisimAddresses, OptimisimDeploys, MainnetAddresses } from "../../../util/addresser";
import { TransactionRequest } from "@ethersproject/providers"
import { BigNumber, Contract, Signer } from "ethers"
const a = new OptimisimAddresses()
const d = new OptimisimDeploys()
const m = new MainnetAddresses()
const { ethers, network } = require("hardhat")
const govAddress = "0x266d1020A84B9E8B0ed320831838152075F8C4cA"
/*****************************CHANGE THESE/*****************************/
const proposeFromScript = false //IF TRUE, PRIVATE KEY MUST BE IN .env as PERSONAL_PRIVATE_KEY=42bb...
const SnxLTV = BN("70e16")
const SnxLiqInc = BN("75e15")
const proposerAddr = "0x3Df70ccb5B5AA9c300100D98258fE7F39f5F9908"
const proposestEthSTABLE = async (proposer: SignerWithAddress) => {
console.log("STARTING")
let gov: GovernorCharlieDelegate = new GovernorCharlieDelegate__factory(proposer).attach(
govAddress
)
const proposal = new ProposalContext("SNX on OP")
//register erc20
const listData = await new VaultController__factory().
attach(d.VaultController).
populateTransaction.registerErc20(
d.CappedSNX,
SnxLTV,
d.CappedSNX,
SnxLiqInc
)
const listForward = await new CrossChainAccount__factory().attach(d.optimismMessenger).
populateTransaction.forward(d.VaultController, listData.data!)
const list = await ILayer1Messenger__factory.connect(m.OPcrossChainMessenger, proposer).
populateTransaction.sendMessage(d.optimismMessenger, listForward.data!, 1500000)
proposal.addStep(list, "sendMessage(address,bytes,uint32)")
let out = proposal.populateProposal()
const proposalText = fs.readFileSync('./scripts/proposals/SNX_OP/txt.md', 'utf8')
if (proposeFromScript) {
console.log("Sending proposal")
console.log("Data: ", out)
const result = await gov.connect(proposer).propose(
out.targets,
out.values,
out.signatures,
out.calldatas,
proposalText,
false
)
const receipt = await result.wait()
console.log("Proposal sent: ", receipt.transactionHash)
const networkName = hre.network.name
if (networkName == "hardhat" || networkName == "localhost") {
//test execution if on test network
await quickTest(proposer, out)
}
} else {
console.log("Populating proposal tx")
const data = await gov.connect(proposer).populateTransaction.propose(
out.targets,
out.values,
out.signatures,
out.calldatas,
proposalText,
false
)
//console.log("TRANSACTION DATA: \n", data.data)
}
}
const quickTest = async (proposer: SignerWithAddress, out: any) => {
console.log("Testing execution")
const gov = new GovernorCharlieDelegate__factory(proposer).attach(
govAddress
)
const votingPeriod = await gov.votingPeriod()
const votingDelay = await gov.votingDelay()
const timelock = await gov.proposalTimelockDelay()
const block = await currentBlock()
const proposal = Number(await gov.proposalCount())
showBodyCyan("Advancing a lot of blocks...")
await hardhat_mine(votingDelay.toNumber())
await gov.connect(proposer).castVote(proposal, 1)
await ceaseImpersonation(proposerAddr)
const whale = "0x958892b4a0512b28AaAC890FC938868BBD42f064"//0xa6e8772af29b29b9202a073f8e36f447689beef6 ";
const prop = ethers.provider.getSigner(whale)
await impersonateAccount(whale)
await gov.connect(prop).castVote(proposal, 1)
showBodyCyan("Advancing a lot of blocks again...")
await hardhat_mine(votingPeriod.toNumber())
await gov.connect(prop).queue(proposal)
await fastForward(timelock.toNumber())
const result = await gov.connect(prop).execute(proposal)
await result.wait()
showBodyCyan("EXECUTION COMPLETE")
await ceaseImpersonation(whale)
}
async function main() {
let proposer: SignerWithAddress
const networkName = hre.network.name
if (networkName == "hardhat" || networkName == "localhost") {
console.log("TEST PROPOSAL")
await network.provider.send("evm_setAutomine", [true])
await resetCurrent()
//await reset(17696267)
const block = await currentBlock()
console.log("reset to block ", block.number)
await impersonateAccount(proposerAddr)
console.log("Impersonated ", proposerAddr)
proposer = ethers.provider.getSigner(proposerAddr)
} else {
const accounts = await ethers.getSigners()
proposer = accounts[1]
console.log(`PROPOSING ON ${networkName} AS: `, proposer.address)
}
await proposestEthSTABLE(proposer)
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
//Proposal sent: 0x4ab79dd0fb8673e6b951494307644977da481b09e68ec7c51f0d6534ebd34a80
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment