Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
30 changes: 30 additions & 0 deletions cadence/contracts/FlowYieldVaultsStrategies.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,36 @@ access(all) contract FlowYieldVaultsStrategies {

access(all) entitlement Configure

access(self)
fun makeCollateralConfig(
yieldTokenEVMAddress: EVM.EVMAddress,
univ3FactoryEVMAddress: EVM.EVMAddress,
univ3RouterEVMAddress: EVM.EVMAddress,
univ3QuoterEVMAddress: EVM.EVMAddress,
yieldToCollateralAddressPath: [EVM.EVMAddress],
yieldToCollateralFeePath: [UInt32]
): {String: AnyStruct} {
pre {
yieldToCollateralAddressPath.length > 1:
"Invalid Uniswap V3 swap path length"
yieldToCollateralFeePath.length == yieldToCollateralAddressPath.length - 1:
"Uniswap V3 fee path length must be path length - 1"
yieldToCollateralAddressPath[0].equals(yieldTokenEVMAddress):
"UniswapV3 swap path must start with yield token"
}

return {
"univ3FactoryEVMAddress": univ3FactoryEVMAddress,
"univ3RouterEVMAddress": univ3RouterEVMAddress,
"univ3QuoterEVMAddress": univ3QuoterEVMAddress,
"yieldTokenEVMAddress": yieldTokenEVMAddress,
"yieldToCollateralUniV3AddressPaths": {
// we’ll store with the collateral vault type as key later
} as {Type: [EVM.EVMAddress]},
"yieldToCollateralUniV3FeePaths": {
} as {Type: [UInt32]}
}
}
/// This resource enables the issuance of StrategyComposers, thus safeguarding the issuance of Strategies which
/// may utilize resource consumption (i.e. account storage). Since TracerStrategy creation consumes account storage
/// via configured AutoBalancers
Expand Down
577 changes: 577 additions & 0 deletions cadence/contracts/FlowYieldVaultsStrategiesV1.cdc

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions cadence/tests/test_helpers.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,17 @@ access(all) fun deployContracts() {
)
Test.expect(err, Test.beNil())

err = Test.deployContract(
name: "FlowYieldVaultsStrategiesV1",
path: "../contracts/FlowYieldVaultsStrategiesV1.cdc",
arguments: [
"0x986Cb42b0557159431d48fE0A40073296414d410",
"0x92657b195e22b69E4779BBD09Fa3CD46F0CF8e39",
"0x8dd92c8d0C3b304255fF9D98ae59c3385F88360C"
]
)

Test.expect(err, Test.beNil())
// Mocked Strategy
err = Test.deployContract(
name: "MockStrategy",
Expand Down
63 changes: 62 additions & 1 deletion flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@
"testnet": "d2580caf2ef07c2f"
}
},
"FlowYieldVaultsStrategiesV1": {
"source": "cadence/contracts/FlowYieldVaultsStrategiesV1.cdc",
"aliases": {
"emulator": "045a1763c93006ca",
"mainnet": "b1d63873c3cc9f79",
"testing": "0000000000000009",
"testnet": "d2580caf2ef07c2f"
}
},
"FungibleTokenConnectors": {
"source": "./lib/FlowCreditMarket/FlowActions/cadence/contracts/connectors/FungibleTokenConnectors.cdc",
"aliases": {
Expand Down Expand Up @@ -847,6 +856,23 @@
"type": "Array"
}
]
},
{
"name": "FlowYieldVaultsStrategiesV1",
"args": [
{
"value": "0x986Cb42b0557159431d48fE0A40073296414d410",
"type": "String"
},
{
"value": "0x92657b195e22b69E4779BBD09Fa3CD46F0CF8e39",
"type": "String"
},
{
"value": "0x8dd92c8d0C3b304255fF9D98ae59c3385F88360C",
"type": "String"
}
]
}
],
"mock-incrementfi": [
Expand Down Expand Up @@ -941,8 +967,26 @@
"type": "Array"
}
]
},
{
"name": "FlowYieldVaultsStrategiesV1",
"args": [
{
"value": "0xca6d7Bb03334bBf135902e1d919a5feccb461632",
"type": "String"
},
{
"value": "0xeEDC6Ff75e1b10B903D9013c358e446a73d35341",
"type": "String"
},
{
"value": "0x370A8DF17742867a44e56223EC20D82092242C85",
"type": "String"
}
]
}
] },
]
},
"testnet": {
"testnet-admin": [
{
Expand Down Expand Up @@ -1011,6 +1055,23 @@
"type": "Array"
}
]
},
{
"name": "FlowYieldVaultsStrategiesV1",
"args": [
{
"value": "0x92657b195e22b69E4779BBD09Fa3CD46F0CF8e39",
"type": "String"
},
{
"value": "0x2Db6468229F6fB1a77d248Dbb1c386760C257804",
"type": "String"
},
{
"value": "0xA1e0E4CCACA34a738f03cFB1EAbAb16331FA3E2c",
"type": "String"
}
]
}
]
}
Expand Down
12 changes: 12 additions & 0 deletions local/setup_emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ flow transactions send ./cadence/transactions/flow-yield-vaults/admin/add_strate
/storage/FlowYieldVaultsStrategyComposerIssuer_0x045a1763c93006ca \
--signer emulator-flow-yield-vaults

# flow transactions send ../cadence/transactions/flow-yield-vaults/admin/upsert_musdf_config.cdc \
# "A.0ae53cb6e3f42a79.FlowToken.Vault" \
# <yield token>



flow transactions send ./cadence/transactions/flow-yield-vaults/admin/add_strategy_composer.cdc \
'A.045a1763c93006ca.FlowYieldVaultsStrategiesV1.USDFStrategy' \
'A.045a1763c93006ca.FlowYieldVaultsStrategiesV1.USDFStrategyComposer' \
/storage/FlowYieldVaultsStrategyV1ComposerIssuer_0x045a1763c93006ca \
--signer emulator-flow-yield-vaults

# grant PoolBeta cap
echo "Grant Protocol Beta access to FlowYieldVaults"
flow transactions send ./lib/FlowCreditMarket/cadence/tests/transactions/flow-credit-market/pool-management/03_grant_beta.cdc \
Expand Down
16 changes: 13 additions & 3 deletions local/setup_mainnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,21 @@ flow transactions send ./cadence/transactions/mocks/swapper/set_liquidity_connec
flow transactions send ./lib/FlowCreditMarket/FlowActions/cadence/transactions/fungible-tokens/setup_generic_vault.cdc 'A.1e4aa0b87d10b141.EVMVMBridgedToken_c52e820d2d6207d18667a97e2c6ac22eb26e803c.Vault' --network mainnet --signer mainnet-admin
# flow transactions send ./cadence/transactions/mocks/swapper/set_liquidity_connector.cdc /storage/EVMVMBridgedToken_4154d5b0e2931a0a1e5b733f19161aa7d2fc4b95Vault --network mainnet --signer mainnet-admin
#

flow transactions send ../cadence/transactions/flow-yield-vaults/admin/upsert_musdf_config.cdc \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix relative path: This should be ./cadence/transactions/flow-yield-vaults/admin/upsert_musdf_config.cdc instead of ../cadence/... since the script runs from the repo root.

'A.1654653399040a61.FlowToken.Vault' \
"0xc52E820d2D6207D18667a97e2c6Ac22eB26E803c" \
'["0xc52E820d2D6207D18667a97e2c6Ac22eB26E803c","0x2aaBea2058b5aC2D339b163C6Ab6f2b6d53aabED","0xd3bF53DAC106A0290B0483EcBC89d40FcC961f3e"]' \
'[100,3000]' \
--network mainnet \
--signer mainnet-admin

#
# add TracerStrategy as supported Strategy with the ability to initialize when new YieldVaults are created
flow transactions send ./cadence/transactions/flow-yield-vaults/admin/add_strategy_composer.cdc \
'A.b1d63873c3cc9f79.FlowYieldVaultsStrategies.mUSDCStrategy' \
'A.b1d63873c3cc9f79.FlowYieldVaultsStrategies.mUSDCStrategyComposer' \
/storage/FlowYieldVaultsStrategyComposerIssuer_0xb1d63873c3cc9f79 \
'A.b1d63873c3cc9f79.FlowYieldVaultsStrategiesV1.mUSDFStrategy' \
'A.b1d63873c3cc9f79.FlowYieldVaultsStrategiesV1.mUSDFStrategyComposer' \
/storage/FlowYieldVaultsStrategyV1ComposerIssuer_0xb1d63873c3cc9f79 \
--network mainnet \
--signer mainnet-admin

Expand Down
13 changes: 10 additions & 3 deletions local/setup_testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ flow transactions send ./cadence/transactions/flow-yield-vaults/admin/add_strate
--network testnet \
--signer testnet-admin

flow transactions send ../cadence/transactions/flow-yield-vaults/admin/upsert_musdf_config.cdc \
'A.7e60df042a9c0868.FlowToken.Vault' \
"0x4154d5B0E2931a0A1E5b733f19161aa7D2fc4b95" \
'["0x4154d5B0E2931a0A1E5b733f19161aa7D2fc4b95", "0xd3bF53DAC106A0290B0483EcBC89d40FcC961f3e"]' \
'[3000]' \
--network testnet \
--signer testnet-admin

flow transactions send ./cadence/transactions/flow-yield-vaults/admin/add_strategy_composer.cdc \
'A.d2580caf2ef07c2f.FlowYieldVaultsStrategies.mUSDCStrategy' \
'A.d2580caf2ef07c2f.FlowYieldVaultsStrategies.mUSDCStrategyComposer' \
/storage/FlowYieldVaultsStrategyComposerIssuer_0xd2580caf2ef07c2f \
'A.d2580caf2ef07c2f.FlowYieldVaultsStrategiesV1.mUSDFStrategy' \
'A.d2580caf2ef07c2f.FlowYieldVaultsStrategiesV1.mUSDFStrategyComposer' \
/storage/FlowYieldVaultsStrategyV1ComposerIssuer_0xd2580caf2ef07c2f \
--network testnet \
--signer testnet-admin

Expand Down