Skip to content

Commit 2a07088

Browse files
authored
Merge pull request #73 from onflow/nialexsan/mainnet-deployment
Nialexsan/mainnet deployment
2 parents ea94fb9 + 099b608 commit 2a07088

8 files changed

Lines changed: 611 additions & 121 deletions

File tree

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1+
# local
12
.DS_Store
23
.pr-drafts/
4+
.vscode/
5+
36
# flow
47
*.pkey
8+
*.pem
59
!local/mock-incrementfi.pkey
610
!local/emulator-account.pkey
711
!local/evm-gateway.pkey
812
!local/test-user.pkey
913
!local/emulator-tidal.pkey
10-
imports
14+
imports/
1115
coverage.lcov
1216
coverage.json
13-
solidity/out/
14-
15-
testnet-deployer.pkey
16-
testnet-uniswapV3-connectors-deployer.pkey
17-
mock-strategy-deployer.pkey
1817

18+
# solidity
19+
solidity/out/
1920
broadcast
2021
cache
2122
db

cadence/contracts/FlowVaultsStrategies.cdc

Lines changed: 287 additions & 109 deletions
Large diffs are not rendered by default.

cadence/transactions/flow-alp/create_position.cdc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ import "FungibleTokenConnectors"
99

1010
transaction(amount: UFix64) {
1111
prepare(signer: auth(BorrowValue) &Account) {
12+
let poolCap = signer.storage
13+
.borrow<&Capability<auth(FlowALP.EParticipant, FlowALP.EPosition) &FlowALP.Pool>>(
14+
from: FlowALP.PoolCapStoragePath
15+
) ?? panic("no Pool capability saved at PoolCapStoragePath")
1216

13-
let pool = signer.storage.borrow<auth(FlowALP.EParticipant, FlowALP.EPosition) &FlowALP.Pool>(from: FlowALP.PoolStoragePath)
14-
?? panic("Could not borrow reference to Pool from \(FlowALP.PoolStoragePath) - ensure a Pool has been configured")
15-
17+
let pool = poolCap.borrow()
18+
?? panic("cap.borrow() failed (link missing or revoked)")
1619
let vaultRef = signer.storage.borrow<auth(FungibleToken.Withdraw) &FlowToken.Vault>(from: /storage/flowTokenVault)
1720
?? panic("Could not borrow FlowToken vault ref from signer")
1821
let flowFunds <- vaultRef.withdraw(amount: amount)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import "FlowVaultsClosedBeta"
2+
3+
/// Saves a copy of the admin-issued cap into the user's account
4+
/// and publishes it under /public for easy script checks.
5+
transaction(adminAddr: Address) {
6+
7+
prepare(
8+
user: auth(Storage, Capabilities, ClaimInboxCapability) &Account
9+
) {
10+
let p = FlowVaultsClosedBeta.UserBetaCapStoragePath
11+
let cap: Capability<auth(FlowVaultsClosedBeta.Beta) &FlowVaultsClosedBeta.BetaBadge> =
12+
user.inbox.claim<
13+
auth(FlowVaultsClosedBeta.Beta) &FlowVaultsClosedBeta.BetaBadge
14+
>("FlowVaultsBetaCap", provider: adminAddr)
15+
?? panic("No beta capability found in inbox")
16+
if let t = user.storage.type(at: p) {
17+
if t == Type<Capability<auth(FlowVaultsClosedBeta.Beta) &FlowVaultsClosedBeta.BetaBadge>>() {
18+
let _ = user.storage.load<Capability<auth(FlowVaultsClosedBeta.Beta) &FlowVaultsClosedBeta.BetaBadge>>(from: p)
19+
} else {
20+
panic("Unexpected type at UserBetaCapStoragePath: ".concat(t.identifier))
21+
}
22+
}
23+
user.storage.save(cap, to: p)
24+
25+
}
26+
}
27+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import "FlowVaultsClosedBeta"
2+
3+
/// Saves a copy of the admin-issued cap into the user's account
4+
/// and publishes it under /public for easy script checks.
5+
transaction(grantee: Address) {
6+
7+
prepare(
8+
admin: auth(BorrowValue, PublishInboxCapability) &Account,
9+
) {
10+
let handle = admin.storage.borrow<auth(FlowVaultsClosedBeta.Admin) &FlowVaultsClosedBeta.AdminHandle>(
11+
from: FlowVaultsClosedBeta.AdminHandleStoragePath
12+
) ?? panic("Missing AdminHandle")
13+
14+
let cap: Capability<auth(FlowVaultsClosedBeta.Beta) &FlowVaultsClosedBeta.BetaBadge> =
15+
handle.grantBeta(addr: grantee)
16+
17+
assert(cap.check(), message: "Failed to issue beta capability")
18+
19+
admin.inbox.publish(cap, name: "FlowVaultsBetaCap", recipient: grantee)
20+
}
21+
}

flow.json

Lines changed: 185 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
{
22
"contracts": {
3+
"BandOracleConnectors": {
4+
"source": "./lib/FlowALP/FlowActions/cadence/contracts/connectors/band-oracle/BandOracleConnectors.cdc",
5+
"aliases": {
6+
"emulator": "045a1763c93006ca",
7+
"mainnet": "e36ef556b8b5d955",
8+
"testing": "0000000000000007",
9+
"testnet": "bb76ea2f8aad74a0"
10+
}
11+
},
312
"DeFiActions": {
413
"source": "./lib/FlowALP/FlowActions/cadence/contracts/interfaces/DeFiActions.cdc",
514
"aliases": {
@@ -26,18 +35,56 @@
2635
"testnet": "3bda2f90274dbc9b"
2736
}
2837
},
38+
"ERC4626PriceOracles": {
39+
"source": "./lib/FlowALP/FlowActions/cadence/contracts/connectors/evm/ERC4626PriceOracles.cdc",
40+
"aliases": {
41+
"emulator": "045a1763c93006ca",
42+
"mainnet": "04f5ae6bef48c1fc",
43+
"testing": "0000000000000009",
44+
"testnet": "7014dcffa1f14186"
45+
}
46+
},
47+
"ERC4626SinkConnectors": {
48+
"source": "./lib/FlowALP/FlowActions/cadence/contracts/connectors/evm/ERC4626SinkConnectors.cdc",
49+
"aliases": {
50+
"emulator": "045a1763c93006ca",
51+
"mainnet": "04f5ae6bef48c1fc",
52+
"testing": "0000000000000009",
53+
"testnet": "7014dcffa1f14186"
54+
}
55+
},
56+
"ERC4626SwapConnectors": {
57+
"source": "./lib/FlowALP/FlowActions/cadence/contracts/connectors/evm/ERC4626SwapConnectors.cdc",
58+
"aliases": {
59+
"emulator": "045a1763c93006ca",
60+
"mainnet": "04f5ae6bef48c1fc",
61+
"testing": "0000000000000009",
62+
"testnet": "7014dcffa1f14186"
63+
}
64+
},
65+
"ERC4626Utils": {
66+
"source": "./lib/FlowALP/FlowActions/cadence/contracts/utils/ERC4626Utils.cdc",
67+
"aliases": {
68+
"emulator": "045a1763c93006ca",
69+
"mainnet": "04f5ae6bef48c1fc",
70+
"testing": "0000000000000009",
71+
"testnet": "7014dcffa1f14186"
72+
}
73+
},
2974
"EVMAbiHelpers": {
3075
"source": "./lib/FlowALP/FlowActions/cadence/contracts/utils/EVMAbiHelpers.cdc",
3176
"aliases": {
3277
"emulator": "045a1763c93006ca",
78+
"mainnet": "a7825d405ac89518",
3379
"testing": "0000000000000007",
3480
"testnet": "3ebb7d2595e97cd2"
3581
}
3682
},
3783
"EVMTokenConnectors": {
38-
"source": "cadence/contracts/connectors/evm/EVMTokenConnectors.cdc",
84+
"source": "./lib/FlowALP/FlowActions/cadence/contracts/connectors/evm/EVMTokenConnectors.cdc",
3985
"aliases": {
4086
"emulator": "045a1763c93006ca",
87+
"mainnet": "1a771b21fcceadc2",
4188
"testing": "0000000000000009",
4289
"testnet": "b88ba0e976146cd1"
4390
}
@@ -64,6 +111,7 @@
64111
"source": "cadence/contracts/FlowVaults.cdc",
65112
"aliases": {
66113
"emulator": "045a1763c93006ca",
114+
"mainnet": "b1d63873c3cc9f79",
67115
"testing": "0000000000000009",
68116
"testnet": "3bda2f90274dbc9b"
69117
}
@@ -72,6 +120,7 @@
72120
"source": "cadence/contracts/FlowVaultsAutoBalancers.cdc",
73121
"aliases": {
74122
"emulator": "045a1763c93006ca",
123+
"mainnet": "b1d63873c3cc9f79",
75124
"testing": "0000000000000009",
76125
"testnet": "3bda2f90274dbc9b"
77126
}
@@ -80,6 +129,7 @@
80129
"source": "cadence/contracts/FlowVaultsClosedBeta.cdc",
81130
"aliases": {
82131
"emulator": "045a1763c93006ca",
132+
"mainnet": "b1d63873c3cc9f79",
83133
"testing": "0000000000000009",
84134
"testnet": "3bda2f90274dbc9b"
85135
}
@@ -88,6 +138,7 @@
88138
"source": "cadence/contracts/FlowVaultsStrategies.cdc",
89139
"aliases": {
90140
"emulator": "045a1763c93006ca",
141+
"mainnet": "b1d63873c3cc9f79",
91142
"testing": "0000000000000009",
92143
"testnet": "3bda2f90274dbc9b"
93144
}
@@ -155,6 +206,7 @@
155206
"source": "./lib/FlowALP/FlowActions/cadence/contracts/connectors/evm/UniswapV3SwapConnectors.cdc",
156207
"aliases": {
157208
"emulator": "045a1763c93006ca",
209+
"mainnet": "a7825d405ac89518",
158210
"testing": "0000000000000007",
159211
"testnet": "3ebb7d2595e97cd2"
160212
}
@@ -163,6 +215,7 @@
163215
"source": "cadence/contracts/mocks/YieldToken.cdc",
164216
"aliases": {
165217
"emulator": "045a1763c93006ca",
218+
"mainnet": "b1d63873c3cc9f79",
166219
"testing": "0000000000000010",
167220
"testnet": "3bda2f90274dbc9b"
168221
}
@@ -178,6 +231,16 @@
178231
"testing": "0000000000000007"
179232
}
180233
},
234+
"BandOracle": {
235+
"source": "mainnet://6801a6222ebf784a.BandOracle",
236+
"hash": "be8c986f46eccfe55a25447e1b7fa07e95769ac4ca11918833130a4bf3297b16",
237+
"aliases": {
238+
"emulator": "045a1763c93006ca",
239+
"mainnet": "6801a6222ebf784a",
240+
"testing": "0000000000000007",
241+
"testnet": "2c71de7af78d1adf"
242+
}
243+
},
181244
"Burner": {
182245
"source": "mainnet://f233dcee88fe0abe.Burner",
183246
"hash": "71af18e227984cd434a3ad00bb2f3618b76482842bae920ee55662c37c8bf331",
@@ -625,6 +688,30 @@
625688
"location": "local/evm-gateway.pkey"
626689
}
627690
},
691+
"mainnet-admin": {
692+
"address": "b1d63873c3cc9f79",
693+
"key": {
694+
"type": "google-kms",
695+
"hashAlgorithm": "SHA2_256",
696+
"resourceID": "projects/dl-flow-devex-production/locations/us-central1/keyRings/tidal-keyring/cryptoKeys/tidal_admin_pk/cryptoKeyVersions/1"
697+
}
698+
},
699+
"mainnet-flow-alp-deployer": {
700+
"address": "6b00ff876c299c61",
701+
"key": {
702+
"type": "google-kms",
703+
"hashAlgorithm": "SHA2_256",
704+
"resourceID": "projects/dl-flow-devex-production/locations/us-central1/keyRings/tidal-keyring/cryptoKeys/tidal_admin_pk/cryptoKeyVersions/1"
705+
}
706+
},
707+
"mainnet-uniswapV3-connectors-deployer": {
708+
"address": "a7825d405ac89518",
709+
"key": {
710+
"type": "google-kms",
711+
"hashAlgorithm": "SHA2_256",
712+
"resourceID": "projects/dl-flow-devex-production/locations/us-central1/keyRings/tidal-keyring/cryptoKeys/tidal_admin_pk/cryptoKeyVersions/1"
713+
}
714+
},
628715
"mock-incrementfi": {
629716
"address": "f3fcd2c1a78f5eee",
630717
"key": {
@@ -731,8 +818,15 @@
731818
}
732819
]
733820
},
821+
"BandOracle",
822+
"BandOracleConnectors",
734823
"MockSwapper",
735824
"EVMAbiHelpers",
825+
"EVMTokenConnectors",
826+
"ERC4626Utils",
827+
"ERC4626PriceOracles",
828+
"ERC4626SinkConnectors",
829+
"ERC4626SwapConnectors",
736830
"FlowVaultsAutoBalancers",
737831
"FlowVaultsClosedBeta",
738832
"FlowVaults",
@@ -760,6 +854,95 @@
760854
}
761855
]
762856
},
857+
"mainnet": {
858+
"mainnet-admin": [
859+
{
860+
"name": "YieldToken",
861+
"args": [
862+
{
863+
"value": "0.00000000",
864+
"type": "UFix64"
865+
}
866+
]
867+
},
868+
{
869+
"name": "MockOracle",
870+
"args": [
871+
{
872+
"value": "A.6b00ff876c299c61.MOET.Vault",
873+
"type": "String"
874+
}
875+
]
876+
},
877+
"MockSwapper",
878+
"FlowVaultsAutoBalancers",
879+
"FlowVaultsClosedBeta",
880+
"FlowVaults",
881+
{
882+
"name": "FlowVaultsStrategies",
883+
"args": [
884+
{
885+
"value": "0xca6d7Bb03334bBf135902e1d919a5feccb461632",
886+
"type": "String"
887+
},
888+
{
889+
"value": "0xeEDC6Ff75e1b10B903D9013c358e446a73d35341",
890+
"type": "String"
891+
},
892+
{
893+
"value": "0x370A8DF17742867a44e56223EC20D82092242C85",
894+
"type": "String"
895+
},
896+
{
897+
"value": "0xc52E820d2D6207D18667a97e2c6Ac22eB26E803c",
898+
"type": "String"
899+
},
900+
{
901+
"value": [
902+
{
903+
"value": "0xc52E820d2D6207D18667a97e2c6Ac22eB26E803c",
904+
"type": "String"
905+
},
906+
{
907+
"value": "0x213979bB8A9A86966999b3AA797C1fcf3B967ae2",
908+
"type": "String"
909+
},
910+
{
911+
"value": "0x2aaBea2058b5aC2D339b163C6Ab6f2b6d53aabED",
912+
"type": "String"
913+
},
914+
{
915+
"value": "0xd3bF53DAC106A0290B0483EcBC89d40FcC961f3e",
916+
"type": "String"
917+
}
918+
],
919+
"type": "Array"
920+
},
921+
{
922+
"value": [
923+
{
924+
"value": "100",
925+
"type": "UInt32"
926+
},
927+
{
928+
"value": "100",
929+
"type": "UInt32"
930+
},
931+
{
932+
"value": "3000",
933+
"type": "UInt32"
934+
}
935+
],
936+
"type": "Array"
937+
}
938+
]
939+
}
940+
],
941+
"mainnet-uniswapV3-connectors-deployer": [
942+
"EVMAbiHelpers",
943+
"UniswapV3SwapConnectors"
944+
]
945+
},
763946
"testnet": {
764947
"testnet-admin": [
765948
{
@@ -784,7 +967,7 @@
784967
"FlowVaultsAutoBalancers",
785968
"FlowVaultsClosedBeta",
786969
"FlowVaults",
787-
{
970+
{
788971
"name": "FlowVaultsStrategies",
789972
"args": [
790973
{

0 commit comments

Comments
 (0)