Skip to content

Commit 6b150e7

Browse files
committed
cleaned testnet deployment
1 parent 213ca9d commit 6b150e7

3 files changed

Lines changed: 31 additions & 32 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ coverage.lcov
1010
coverage.json
1111
solidity/out/
1212

13-
testnet-deployer.pkey
13+
testnet-deployer.pkey
14+
testnet-uniswapV3-connectors-deployer.pkey
Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import "FungibleToken"
22
import "EVM"
3-
import "FlowEVMBridgeUtils"
4-
import "UniswapV3SwapConnectors3"
3+
import "UniswapV3SwapConnectors"
54
import "FlowEVMBridgeConfig"
65

76
transaction() {
@@ -15,23 +14,20 @@ transaction() {
1514

1615
let quoter = EVM.addressFromString("0xA1e0E4CCACA34a738f03cFB1EAbAb16331FA3E2c")
1716

18-
// let usdc = EVM.addressFromString("0x5e65b6B04fbA51D95409712978Cb91E99d93aE73")
19-
// let wflow = EVM.addressFromString("0xd3bF53DAC106A0290B0483EcBC89d40FcC961f3e") // WFLOW on EVM side
17+
// let usdc = EVM.addressFromString("0x5e65b6B04fbA51D95409712978Cb91E99d93aE73") // Testnet USDC
18+
// let wflow = EVM.addressFromString("0xd3bF53DAC106A0290B0483EcBC89d40FcC961f3e") // Testnet WFLOW
2019

21-
let tokenIn = EVM.addressFromString("0xd431955D55a99EF69BEb96BA34718d0f9fBc91b1")
22-
let tokenOut = EVM.addressFromString("0x4154d5B0E2931a0A1E5b733f19161aa7D2fc4b95")
20+
let tokenIn = EVM.addressFromString("0xd431955D55a99EF69BEb96BA34718d0f9fBc91b1") // mockUSDC
21+
let tokenOut = EVM.addressFromString("0x4154d5B0E2931a0A1E5b733f19161aa7D2fc4b95") // More Vaults mUSDC
2322

2423
// Vault types for in/out
25-
// let inType: Type = Type<@FlowToken.Vault>() // FLOW in
26-
// let outType: Type = FlowEVMBridgeConfig.getTypeAssociated(with: usdc) ?? panic("invalid USDC out type")
2724

28-
let inType: Type = FlowEVMBridgeConfig.getTypeAssociated(with: tokenIn) ?? panic("invalid mockUSDC in type") // FLOW in
25+
let inType: Type = FlowEVMBridgeConfig.getTypeAssociated(with: tokenIn) ?? panic("invalid mockUSDC in type")
2926
let outType: Type = FlowEVMBridgeConfig.getTypeAssociated(with: tokenOut) ?? panic("invalid moreVaultUSDC out type")
30-
// Swapper: tokenPath must be [WFLOW, USDC] for FLOW → USDC
31-
let swapper = UniswapV3SwapConnectors3.Swapper(
27+
28+
let swapper = UniswapV3SwapConnectors.Swapper(
3229
routerAddress: router,
3330
quoterAddress: quoter,
34-
//tokenPath: [wflow, usdc],
3531
tokenPath: [tokenIn, tokenOut],
3632
feePath: [3000], // 0.3%
3733
inVault: inType,
@@ -42,26 +38,27 @@ transaction() {
4238

4339
let tokenInStoragePath = /storage/EVMVMBridgedToken_d431955d55a99ef69beb96ba34718d0f9fbc91b1Vault
4440
let tokenOutStoragePath = /storage/EVMVMBridgedToken_4154d5b0e2931a0a1e5b733f19161aa7d2fc4b95Vault
45-
// Withdraw FLOW
41+
42+
// Withdraw
4643
let withdrawRef = acct.storage
4744
.borrow<auth(FungibleToken.Withdraw) &{FungibleToken.Vault}>(from: tokenInStoragePath)
48-
?? panic("Missing FLOW vault at /storage/flowTokenVault")
45+
?? panic("Missing TokenIn vault at ".concat(tokenInStoragePath.toString()))
4946

5047
let amountIn: UFix64 = 1.0
5148
let vaultIn <- withdrawRef.withdraw(amount: amountIn)
5249

53-
// Quote how much USDC we’ll get
50+
// Quote how much we’ll get
5451
let q = swapper.quoteOut(forProvided: amountIn, reverse: false)
55-
log("Quote out for provided ".concat(amountIn.toString()).concat(" FLOWUSDC: ").concat(q.outAmount.toString()))
52+
log("Quote out for provided ".concat(amountIn.toString()).concat(" TokenInTokenOut: ").concat(q.outAmount.toString()))
5653

5754
// Perform the swap
5855
let vaultOut <- swapper.swap(quote: q, inVault: <-vaultIn)
59-
log("USDC received: ".concat(vaultOut.balance.toString()))
56+
log("TokenOut received: ".concat(vaultOut.balance.toString()))
6057

61-
// Deposit USDC
62-
let usdcReceiver = acct.storage
58+
// Deposit
59+
let tokenOutReceiver = acct.storage
6360
.borrow<&{FungibleToken.Receiver}>(from: tokenOutStoragePath)
64-
?? panic("Missing USDC vault at ".concat(tokenOutStoragePath.toString()))
65-
usdcReceiver.deposit(from: <-vaultOut)
61+
?? panic("Missing TokenOut vault at ".concat(tokenOutStoragePath.toString()))
62+
tokenOutReceiver.deposit(from: <-vaultOut)
6663
}
6764
}

flow.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,7 @@
135135
"aliases": {
136136
"emulator": "f8d6e0586b0a20c7",
137137
"testing": "0000000000000007",
138-
"testnet": "29242c62f18538c9"
139-
}
140-
},
141-
"UniswapV3SwapConnectors3": {
142-
"source": "./lib/TidalProtocol/DeFiActions/cadence/contracts/connectors/evm/UniswapV3SwapConnectors.cdc",
143-
"aliases": {
144-
"emulator": "f8d6e0586b0a20c7",
145-
"testing": "0000000000000007",
146-
"testnet": "29242c62f18538c9"
138+
"testnet": "46be98b71c0a9543"
147139
}
148140
},
149141
"YieldToken": {
@@ -575,6 +567,13 @@
575567
"type": "file",
576568
"location": "testnet-deployer.pkey"
577569
}
570+
},
571+
"testnet-uniswapV3-connectors-deployer": {
572+
"address": "46be98b71c0a9543",
573+
"key": {
574+
"type": "file",
575+
"location": "testnet-uniswapV3-connectors-deployer.pkey"
576+
}
578577
}
579578
},
580579
"deployments": {
@@ -682,7 +681,9 @@
682681
},
683682
"testnet": {
684683
"testnet-deployer": [
685-
"EVMAbiHelpers",
684+
"EVMAbiHelpers"
685+
],
686+
"testnet-uniswapV3-connectors-deployer": [
686687
"UniswapV3SwapConnectors"
687688
]
688689
}

0 commit comments

Comments
 (0)