Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface ITokens {
sFRAX?: string
sDAI?: string
cbETH?: string
STG?: string
STG?: string // DEPRECATED
sUSDC?: string
sUSDbC?: string
sUSDT?: string
Expand Down Expand Up @@ -303,7 +303,7 @@ export const networkConfig: { [key: string]: INetworkConfig } = {
sFRAX: '0xA663B02CF0a4b149d2aD41910CB81e23e1c41c32',
sDAI: '0x83f20f44975d03b1b09e64809b757c47f942beea',
cbETH: '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704',
STG: '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6',
STG: '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6', // DEPRECATED
sUSDC: '0xdf0770dF86a8034b3EFEf0A1Bb3c889B8332FF56',
sUSDT: '0x38EA452219524Bb87e18dE1C24D3bB59510BD783',
sETH: '0x101816545F6bd2b1076434B54383a1E633390A2E',
Expand Down Expand Up @@ -630,7 +630,7 @@ export const networkConfig: { [key: string]: INetworkConfig } = {
RSR: '0xAa98aE504658766Dfe11F31c5D95a0bdcABDe0b1', // 2%, 24hr
wstETHstETHexr: '0xB88BAc61a4Ca37C43a3725912B1f472c9A5bc061', // 0.5%, 24hr
cbETHETHexr: '0x868a501e68F3D1E89CfC0D22F6b22E8dabce5F04', // 0.5%, 24hr
STG: '0x63Af8341b62E683B87bB540896bF283D96B4D385',
STG: '0x63Af8341b62E683B87bB540896bF283D96B4D385', // DEPRECATED
stETHETH: '0xf586d0728a47229e747d824a939000Cf21dEF5A0', // 0.5%, 24h
ETHUSD: '0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70', // 0.15%, 20min
wstETHstETH: '0xB88BAc61a4Ca37C43a3725912B1f472c9A5bc061', // 0.5%, 24h
Expand Down
4 changes: 2 additions & 2 deletions contracts/plugins/assets/stargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ The Stargate Finance documentation will be a good starting point to understand t
>
> _[From The Stargate User Docs](https://stargateprotocol.gitbook.io/stargate/v/user-docs/stargate-features/pool#overview)_

These rewards are added to the total available liquidity, thereby increasing the amount of the underlying token the LP token can be redeemed for. Users can also further stake their LP tokens with the [LPStaking](https://github.com/stargate-protocol/stargate/blob/main/contracts/LPStaking.sol) contract to receive $STG rewards.
These rewards are added to the total available liquidity, thereby increasing the amount of the underlying token the LP token can be redeemed for. It's required to have a wrapper token that'll automatically stake and collect these rewards so it can be used as additional revenue for the collateral.

It's therefore required to have a wrapper token that'll automatically stake and collect these rewards so it can be used as additional revenue for the collateral.
Note: STG rewards have been deprecated and are no longer supported.

## Wrapper Token for Automatic Staking and Reward Collection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ contract StargatePoolFiatCollateral is AppreciatingFiatCollateral {
return _rate;
}

// NOTE: STG rewards have been deprecated
function claimRewards() external override(Asset, IRewardable) {
uint256 _bal = stg.balanceOf(address(this));
IRewardable(address(erc20)).claimRewards();
Expand Down
6 changes: 2 additions & 4 deletions scripts/addresses/8453-tmp-assets-collateral.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"assets": {
"COMP": "0xC9c37FC53682207844B058026024853A9C0b8c7B",
"AERO": "0x7f7B77e49d5b30445f222764a794AFE14af062eB",
"STG": "0x3962695aCce0Efce11cFf997890f3D1D7467ec40"
"AERO": "0x7f7B77e49d5b30445f222764a794AFE14af062eB"
},
"collateral": {
"DAI": "0x49A44d50d3B1E098DAC9402c4aF8D0C0E499F250",
Expand Down Expand Up @@ -33,7 +32,6 @@
"saBasUSDC": "0x6F6f81e5E66f503184f2202D83a79650c3285759",
"wstETH": "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
"AERO": "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
"STG": "0xE3B53AF74a4BF62Ae5511055290838050bf764Df",
"aeroUSDCeUSD": "0xDB5b8cead52f77De0f6B5255f73F348AAf2CBb8D",
"aeroWETHAERO": "0x65f2c1b253a3E45670aDD259C9688Edf1A3b814d",
"aeroMOGWETH": "0xfaAC26b279338dF8cF56B11A572617f674A2F69C",
Expand All @@ -43,4 +41,4 @@
"meUSD": "0xbb819D845b573B5D7C538F5b85057160cfb5f313",
"wsuperOETHb": "0x7FcD174E80f264448ebeE8c88a7C4476AAF58Ea6"
}
}
}
4 changes: 1 addition & 3 deletions scripts/addresses/base-4.2.0/8453-tmp-assets-collateral.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"assets": {
"COMP": "0xC9c37FC53682207844B058026024853A9C0b8c7B",
"AERO": "0x7f7B77e49d5b30445f222764a794AFE14af062eB",
"STG": "0x3962695aCce0Efce11cFf997890f3D1D7467ec40"
"AERO": "0x7f7B77e49d5b30445f222764a794AFE14af062eB"
},
"collateral": {
"DAI": "0x49A44d50d3B1E098DAC9402c4aF8D0C0E499F250",
Expand Down Expand Up @@ -33,7 +32,6 @@
"saBasUSDC": "0x6F6f81e5E66f503184f2202D83a79650c3285759",
"wstETH": "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
"AERO": "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
"STG": "0xE3B53AF74a4BF62Ae5511055290838050bf764Df",
"aeroUSDCeUSD": "0xDB5b8cead52f77De0f6B5255f73F348AAf2CBb8D",
"aeroWETHAERO": "0x65f2c1b253a3E45670aDD259C9688Edf1A3b814d",
"aeroMOGWETH": "0xfaAC26b279338dF8cF56B11A572617f674A2F69C",
Expand Down
1 change: 0 additions & 1 deletion scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ async function main() {
'phase2-assets/collaterals/deploy_aave_v3_usdc.ts',
'phase2-assets/collaterals/deploy_lido_wsteth_collateral.ts',
'phase2-assets/assets/deploy_aero.ts',
'phase2-assets/assets/deploy_stg.ts',
'phase2-assets/collaterals/deploy_aerodrome_usdc_eusd.ts',
'phase2-assets/collaterals/deploy_aerodrome_weth_aero.ts',
'phase2-assets/collaterals/deploy_aerodrome_mog_weth.ts',
Expand Down
112 changes: 57 additions & 55 deletions scripts/deployment/phase2-assets/assets/deploy_stg.ts
Original file line number Diff line number Diff line change
@@ -1,66 +1,68 @@
import fs from 'fs'
import hre, { ethers } from 'hardhat'
import { getChainId } from '../../../../common/blockchain-utils'
import { networkConfig } from '../../../../common/configuration'
import { fp } from '../../../../common/numbers'
import {
getDeploymentFile,
getDeploymentFilename,
getAssetCollDeploymentFilename,
IAssetCollDeployments,
fileExists,
} from '../../../deployment/common'
import { priceTimeout } from '../../../deployment/utils'
import { Asset } from '../../../../typechain'
// Note: STG asset has been deprecated due to changes to Stargate

async function main() {
// ==== Read Configuration ====
const [burner] = await hre.ethers.getSigners()
const chainId = await getChainId(hre)
// import fs from 'fs'
// import hre, { ethers } from 'hardhat'
// import { getChainId } from '../../../../common/blockchain-utils'
// import { networkConfig } from '../../../../common/configuration'
// import { fp } from '../../../../common/numbers'
// import {
// getDeploymentFile,
// getDeploymentFilename,
// getAssetCollDeploymentFilename,
// IAssetCollDeployments,
// fileExists,
// } from '../../../deployment/common'
// import { priceTimeout } from '../../../deployment/utils'
// import { Asset } from '../../../../typechain'

console.log(`Deploying STG asset to network ${hre.network.name} (${chainId})
with burner account: ${burner.address}`)
// async function main() {
// // ==== Read Configuration ====
// const [burner] = await hre.ethers.getSigners()
// const chainId = await getChainId(hre)

if (!networkConfig[chainId]) {
throw new Error(`Missing network configuration for ${hre.network.name}`)
}
// console.log(`Deploying STG asset to network ${hre.network.name} (${chainId})
// with burner account: ${burner.address}`)

// Get phase1 deployment
const phase1File = getDeploymentFilename(chainId)
if (!fileExists(phase1File)) {
throw new Error(`${phase1File} doesn't exist yet. Run phase 1`)
}
// Check previous step completed
const assetCollDeploymentFilename = getAssetCollDeploymentFilename(chainId)
const assetCollDeployments = <IAssetCollDeployments>getDeploymentFile(assetCollDeploymentFilename)
// if (!networkConfig[chainId]) {
// throw new Error(`Missing network configuration for ${hre.network.name}`)
// }

const deployedAssets: string[] = []
// // Get phase1 deployment
// const phase1File = getDeploymentFilename(chainId)
// if (!fileExists(phase1File)) {
// throw new Error(`${phase1File} doesn't exist yet. Run phase 1`)
// }
// // Check previous step completed
// const assetCollDeploymentFilename = getAssetCollDeploymentFilename(chainId)
// const assetCollDeployments = <IAssetCollDeployments>getDeploymentFile(assetCollDeploymentFilename)

/******** Deploy STG asset **************************/
const { asset: stgAsset } = await hre.run('deploy-asset', {
priceTimeout: priceTimeout.toString(),
priceFeed: networkConfig[chainId].chainlinkFeeds.STG,
oracleError: fp('0.02').toString(), // 2%
tokenAddress: networkConfig[chainId].tokens.STG,
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '86400', // 24 hr
})
await (<Asset>await ethers.getContractAt('Asset', stgAsset)).refresh()
// const deployedAssets: string[] = []

assetCollDeployments.assets.STG = stgAsset
assetCollDeployments.erc20s.STG = networkConfig[chainId].tokens.STG
deployedAssets.push(stgAsset.toString())
// /******** Deploy STG asset **************************/
// const { asset: stgAsset } = await hre.run('deploy-asset', {
// priceTimeout: priceTimeout.toString(),
// priceFeed: networkConfig[chainId].chainlinkFeeds.STG,
// oracleError: fp('0.02').toString(), // 2%
// tokenAddress: networkConfig[chainId].tokens.STG,
// maxTradeVolume: fp('1e6').toString(), // $1m,
// oracleTimeout: '86400', // 24 hr
// })
// await (<Asset>await ethers.getContractAt('Asset', stgAsset)).refresh()

/**************************************************************/
// assetCollDeployments.assets.STG = stgAsset
// assetCollDeployments.erc20s.STG = networkConfig[chainId].tokens.STG
// deployedAssets.push(stgAsset.toString())

fs.writeFileSync(assetCollDeploymentFilename, JSON.stringify(assetCollDeployments, null, 2))
// /**************************************************************/

console.log(`Deployed STG asset to ${hre.network.name} (${chainId}):
New deployments: ${deployedAssets}
Deployment file: ${assetCollDeploymentFilename}`)
}
// fs.writeFileSync(assetCollDeploymentFilename, JSON.stringify(assetCollDeployments, null, 2))

main().catch((error) => {
console.error(error)
process.exitCode = 1
})
// console.log(`Deployed STG asset to ${hre.network.name} (${chainId}):
// New deployments: ${deployedAssets}
// Deployment file: ${assetCollDeploymentFilename}`)
// }

// main().catch((error) => {
// console.error(error)
// process.exitCode = 1
// })
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function main() {
const erc20 = await WrapperFactory.deploy(
name,
symbol,
networkConfig[chainIdKey].tokens.STG,
networkConfig[chainIdKey].tokens.STG, // DEPRECATED
networkConfig[chainIdKey].STARGATE_STAKING_CONTRACT,
sUSDC
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function main() {
const erc20 = await WrapperFactory.deploy(
'Wrapped Stargate USDT',
'wSTG-USDT',
networkConfig[chainId].tokens.STG,
networkConfig[chainId].tokens.STG, // DEPRECATED
STAKING_CONTRACT,
SUSDT
)
Expand Down
103 changes: 52 additions & 51 deletions scripts/verification/assets/verify_stg.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
import hre from 'hardhat'

import { getChainId } from '../../../common/blockchain-utils'
import { developmentChains, networkConfig } from '../../../common/configuration'
import {
getAssetCollDeploymentFilename,
getDeploymentFile,
getDeploymentFilename,
IAssetCollDeployments,
IDeployments,
} from '../../deployment/common'
import { verifyContract } from '../../deployment/utils'
import { fp } from '../../../common/numbers'

let deployments: IAssetCollDeployments

async function main() {
// ********** Read config **********
const chainId = await getChainId(hre)
if (!networkConfig[chainId]) {
throw new Error(`Missing network configuration for ${hre.network.name}`)
}

if (developmentChains.includes(hre.network.name)) {
throw new Error(`Cannot verify contracts for development chain ${hre.network.name}`)
}

deployments = <IAssetCollDeployments>getDeploymentFile(getAssetCollDeploymentFilename(chainId))

const asset = await hre.ethers.getContractAt('Asset', deployments.assets.STG!)

/** ******************** Verify RSR Asset ****************************************/
await verifyContract(
chainId,
deployments.assets.STG,
[
(await asset.priceTimeout()).toString(),
await asset.chainlinkFeed(),
fp('0.02').toString(),
await asset.erc20(),
(await asset.maxTradeVolume()).toString(),
(await asset.oracleTimeout()).toString(),
],
'contracts/plugins/assets/Asset.sol:Asset'
)
}

main().catch((error) => {
console.error(error)
process.exitCode = 1
})
// Note: STG asset has been deprecated due to changes to Stargate

// import hre from 'hardhat'
// import { getChainId } from '../../../common/blockchain-utils'
// import { developmentChains, networkConfig } from '../../../common/configuration'
// import {
// getAssetCollDeploymentFilename,
// getDeploymentFile,
// getDeploymentFilename,
// IAssetCollDeployments,
// IDeployments,
// } from '../../deployment/common'
// import { verifyContract } from '../../deployment/utils'
// import { fp } from '../../../common/numbers'

// let deployments: IAssetCollDeployments

// async function main() {
// // ********** Read config **********
// const chainId = await getChainId(hre)
// if (!networkConfig[chainId]) {
// throw new Error(`Missing network configuration for ${hre.network.name}`)
// }

// if (developmentChains.includes(hre.network.name)) {
// throw new Error(`Cannot verify contracts for development chain ${hre.network.name}`)
// }

// deployments = <IAssetCollDeployments>getDeploymentFile(getAssetCollDeploymentFilename(chainId))

// const asset = await hre.ethers.getContractAt('Asset', deployments.assets.STG!)

// /** ******************** Verify RSR Asset ****************************************/
// await verifyContract(
// chainId,
// deployments.assets.STG,
// [
// (await asset.priceTimeout()).toString(),
// await asset.chainlinkFeed(),
// fp('0.02').toString(),
// await asset.erc20(),
// (await asset.maxTradeVolume()).toString(),
// (await asset.oracleTimeout()).toString(),
// ],
// 'contracts/plugins/assets/Asset.sol:Asset'
// )
// }

// main().catch((error) => {
// console.error(error)
// process.exitCode = 1
// })
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function main() {
[
name,
symbol,
networkConfig[chainId].tokens.STG,
networkConfig[chainId].tokens.STG, // DEPRECATED
networkConfig[chainId].STARGATE_STAKING_CONTRACT,
sUSDC,
],
Expand Down Expand Up @@ -83,7 +83,7 @@ async function main() {
[
name,
symbol,
networkConfig[chainId].tokens.STG,
networkConfig[chainId].tokens.STG, // DEPRECATED
networkConfig[chainId].STARGATE_STAKING_CONTRACT,
sUSDC,
],
Expand Down
1 change: 0 additions & 1 deletion scripts/verify_etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ async function main() {
'collateral-plugins/verify_aave_v3_usdc.ts',
'collateral-plugins/verify_wsteth.ts',
'collateral-plugins/verify_cbeth.ts',
'assets/verify_stg.ts',
'collateral-plugins/verify_aerodrome_usdc_eusd.ts',
'collateral-plugins/verify_aerodrome_weth_aero.ts',
'collateral-plugins/verify_aerodrome_mog_weth.ts',
Expand Down
2 changes: 1 addition & 1 deletion test/monitor/FacadeMonitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ describeFork(`FacadeMonitor - Integration - Mainnet Forking P${IMPLEMENTATION}`,
wstgUsdc = await SthWrapperFactory.deploy(
'Wrapped Stargate USDC',
'wsgUSDC',
networkConfig[chainId].tokens.STG!,
networkConfig[chainId].tokens.STG!, // DEPRECATED
networkConfig[chainId].STARGATE_STAKING_CONTRACT!,
networkConfig[chainId].tokens.sUSDC!
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describeFork('Wrapped S*USDC', () => {
;({ usdc, wstgUSDC, stgUSDC, router } = await loadFixture(makewstgSUDC))
})

// Note: STG rewards has been deprecated
describe('Deployment', () => {
it('reverts if deployed with a 0 address for STG token or LP staking contract', async () => {
await expect(
Expand Down
2 changes: 1 addition & 1 deletion test/plugins/individual-collateral/stargate/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ switch (forkNetwork) {
export const USDC_NAME = chainId == '8453' ? 'USDbC' : 'USDC'
const sUSDC_NAME = chainId == '8453' ? 'sUSDbC' : 'sUSDC'

export const STARGATE = networkConfig[chainId].tokens['STG']!
export const STARGATE = networkConfig[chainId].tokens['STG']! // DEPRECATED
export const STAKING_CONTRACT = networkConfig[chainId].STARGATE_STAKING_CONTRACT!
export const SUSDC = networkConfig[chainId].tokens[sUSDC_NAME]!
export const SUSDT = networkConfig[chainId].tokens['sUSDT']!
Expand Down
Loading