-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/ven-2878' into feat/ven-2879
- Loading branch information
Showing
235 changed files
with
82,098 additions
and
635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,4 @@ gnosisTXBuilder.json | |
**/.DS_Store | ||
|
||
.cache | ||
.vscode/settings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
export const USDT = "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"; | ||
export const USDC = "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"; | ||
export const WBTC = "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"; | ||
export const WETH = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"; | ||
export const PLP = "0x86bf21dB200f29F21253080942Be8af61046Ec29"; | ||
export const XVS = "0xc1Eb7689147C81aC840d4FF0D298489fc7986d52"; | ||
export const XVS_VAULT_TREASURY = "0xb076D4f15c08D7A7B89466327Ba71bc7e1311b58"; | ||
|
||
export const Assets = [USDT, USDC, WBTC, WETH, XVS]; | ||
|
||
export const BaseAssets = [ | ||
USDT, // USDTPrimeConverter BaseAsset | ||
USDC, // USDCPrimeConverter BaseAsset | ||
WBTC, // WBTCPrimeConverter BaseAsset | ||
WETH, // WETHPrimeConverter BaseAsset | ||
XVS, // XVSPrimeConverter BaseAsset | ||
]; | ||
|
||
export const CONVERTER_NETWORK = "0x2F6672C9A0988748b0172D97961BecfD9DC6D6d5"; | ||
export const USDT_PRIME_CONVERTER = "0x435Fac1B002d5D31f374E07c0177A1D709d5DC2D"; | ||
export const USDC_PRIME_CONVERTER = "0x6553C9f9E131191d4fECb6F0E73bE13E229065C6"; | ||
export const WBTC_PRIME_CONVERTER = "0xF91369009c37f029aa28AF89709a352375E5A162"; | ||
export const WETH_PRIME_CONVERTER = "0x4aCB90ddD6df24dC6b0D50df84C94e72012026d0"; | ||
export const XVS_VAULT_CONVERTER = "0x9c5A7aB705EA40876c1B292630a3ff2e0c213DB1"; | ||
|
||
export const ACM = "0xD9dD18EB0cf10CbA837677f28A8F9Bda4bc2b157"; | ||
|
||
export const converters: string[] = [ | ||
USDT_PRIME_CONVERTER, | ||
USDC_PRIME_CONVERTER, | ||
WBTC_PRIME_CONVERTER, | ||
WETH_PRIME_CONVERTER, | ||
XVS_VAULT_CONVERTER, | ||
]; | ||
|
||
// Function to filter assets based on a base asset | ||
const filterAssets = (assets: string[], baseAsset: string) => assets.filter(asset => asset !== baseAsset); | ||
|
||
export const USDTPrimeConverterTokenOuts = filterAssets(Assets, BaseAssets[0]); | ||
export const USDCPrimeConverterTokenOuts = filterAssets(Assets, BaseAssets[1]); | ||
export const WBTCPrimeConverterTokenOuts = filterAssets(Assets, BaseAssets[2]); | ||
export const WETHPrimeConverterTokenOuts = filterAssets(Assets, BaseAssets[3]); | ||
export const XVSVaultConverterTokenOuts = filterAssets(Assets, BaseAssets[4]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { NETWORK_ADDRESSES } from "src/networkAddresses"; | ||
import { LzChainId } from "src/types"; | ||
|
||
import { ACM, Assets, CONVERTER_NETWORK, XVS_VAULT_TREASURY, converters } from "./addresses"; | ||
|
||
const { arbitrumone } = NETWORK_ADDRESSES; | ||
|
||
const { NORMAL_TIMELOCK, FAST_TRACK_TIMELOCK, CRITICAL_TIMELOCK, GUARDIAN } = arbitrumone; | ||
const timelocks = [NORMAL_TIMELOCK, FAST_TRACK_TIMELOCK, CRITICAL_TIMELOCK]; | ||
|
||
type IncentiveAndAccessibility = [number, number]; | ||
|
||
interface AcceptOwnership { | ||
target: string; | ||
signature: string; | ||
params: []; | ||
} | ||
|
||
interface CallPermission { | ||
target: string; | ||
signature: string; | ||
params: [string, string, string]; | ||
} | ||
|
||
export const grant = (target: string, signature: string, caller: string): CallPermission => { | ||
const config: CallPermission = { | ||
target: ACM, | ||
signature: "giveCallPermission(address,string,address)", | ||
params: [target, signature, caller], | ||
}; | ||
|
||
return config; | ||
}; | ||
|
||
const incentiveAndAccessibility: IncentiveAndAccessibility = [0, 1]; | ||
|
||
function generateAcceptOwnershipCommands(ConvertersArray: string[]): AcceptOwnership[] { | ||
const acceptOwnershipCommandsArray: AcceptOwnership[] = []; | ||
|
||
for (const converter of ConvertersArray) { | ||
const config: AcceptOwnership = { | ||
target: converter, | ||
signature: "acceptOwnership()", | ||
params: [], | ||
}; | ||
|
||
acceptOwnershipCommandsArray.push(config); | ||
} | ||
|
||
return acceptOwnershipCommandsArray; | ||
} | ||
|
||
const generateSetConverterNetworkCommands = () => { | ||
return converters.map(converter => ({ | ||
target: converter, | ||
signature: "setConverterNetwork(address)", | ||
params: [CONVERTER_NETWORK], | ||
})); | ||
}; | ||
|
||
const generateAddConverterNetworkCommands = () => { | ||
return converters.map(converter => ({ | ||
target: CONVERTER_NETWORK, | ||
signature: "addTokenConverter(address)", | ||
params: [converter], | ||
dstChainId: LzChainId.arbitrumone, | ||
})); | ||
}; | ||
|
||
function generateCallPermissionCommandsOnConverters(convertersArray: string[]): CallPermission[] { | ||
return convertersArray.flatMap(converter => [ | ||
...timelocks.flatMap(timelock => [ | ||
grant(converter, "setConversionConfig(address,address,ConversionConfig)", timelock), | ||
grant(converter, "pauseConversion()", timelock), | ||
grant(converter, "resumeConversion()", timelock), | ||
grant(converter, "setMinAmountToConvert(uint256)", timelock), | ||
]), | ||
grant(converter, "pauseConversion()", GUARDIAN), | ||
grant(converter, "resumeConversion()", GUARDIAN), | ||
]); | ||
} | ||
|
||
function generateCallPermissionCommandsOnMisc(): CallPermission[] { | ||
return timelocks.flatMap(timelock => [ | ||
grant(CONVERTER_NETWORK, "addTokenConverter(address)", timelock), | ||
grant(CONVERTER_NETWORK, "removeTokenConverter(address)", timelock), | ||
grant(XVS_VAULT_TREASURY, "fundXVSVault(uint256)", timelock), | ||
]); | ||
} | ||
|
||
export const incentiveAndAccessibilities = new Array(Assets.length - 1).fill(incentiveAndAccessibility); | ||
|
||
export const acceptOwnershipCommandsAllConverters: AcceptOwnership[] = generateAcceptOwnershipCommands(converters); | ||
|
||
export const setConverterNetworkCommands = generateSetConverterNetworkCommands(); | ||
|
||
export const addConverterNetworkCommands = generateAddConverterNetworkCommands(); | ||
|
||
export const callPermissionCommands: CallPermission[] = [ | ||
...generateCallPermissionCommandsOnConverters(converters), | ||
...generateCallPermissionCommandsOnMisc(), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { NETWORK_ADDRESSES } from "src/networkAddresses"; | ||
import { makeProposal } from "src/utils"; | ||
|
||
import { ACM, CONVERTER_NETWORK, PLP, USDC, USDT, WBTC, WETH, XVS_VAULT_TREASURY } from "./addresses"; | ||
import { acceptOwnershipCommandsAllConverters, callPermissionCommands, setConverterNetworkCommands } from "./commands"; | ||
|
||
const { arbitrumone } = NETWORK_ADDRESSES; | ||
const vip018 = () => { | ||
return makeProposal([ | ||
{ | ||
target: PLP, | ||
signature: "initializeTokens(address[])", | ||
params: [[WETH, WBTC, USDC, USDT]], | ||
}, | ||
...acceptOwnershipCommandsAllConverters, | ||
{ | ||
target: XVS_VAULT_TREASURY, | ||
signature: "acceptOwnership()", | ||
params: [], | ||
}, | ||
{ | ||
target: CONVERTER_NETWORK, | ||
signature: "acceptOwnership()", | ||
params: [], | ||
}, | ||
{ | ||
target: ACM, | ||
signature: "giveCallPermission(address,string,address)", | ||
params: [arbitrumone.REDSTONE_ORACLE, "setTokenConfig(TokenConfig)", arbitrumone.GUARDIAN], | ||
}, | ||
...callPermissionCommands, | ||
...setConverterNetworkCommands, | ||
]); | ||
}; | ||
|
||
export default vip018; |
Oops, something went wrong.