Skip to content

Commit f8b5055

Browse files
authored
feat: enhance logging for contract deployments in polycli loadtest (#626)
1 parent 996514b commit f8b5055

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

cmd/loadtest/loadtest.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,14 +983,15 @@ func getLoadTestContract(ctx context.Context, c *ethclient.Client, tops *bind.Tr
983983
func getERC20Contract(ctx context.Context, c *ethclient.Client, tops *bind.TransactOpts, cops *bind.CallOpts) (erc20Addr ethcommon.Address, erc20Contract *tokens.ERC20, err error) {
984984
erc20Addr = ethcommon.HexToAddress(*inputLoadTestParams.ERC20Address)
985985
if *inputLoadTestParams.ERC20Address == "" {
986+
log.Info().Msg("Deploying ERC20 contract")
986987
erc20Addr, _, _, err = tokens.DeployERC20(tops, c)
987988
if err != nil {
988989
log.Error().Err(err).Msg("Unable to deploy ERC20 contract")
989990
return
990991
}
991992
// Tokens already minted and sent to the address of the deployer.
992993
}
993-
log.Trace().Interface("contractaddress", erc20Addr).Msg("ERC20 contract address")
994+
log.Info().Interface("contractaddress", erc20Addr).Msg("ERC20 contract address")
994995

995996
erc20Contract, err = tokens.NewERC20(erc20Addr, c)
996997
if err != nil {
@@ -1017,14 +1018,15 @@ func getERC721Contract(ctx context.Context, c *ethclient.Client, tops *bind.Tran
10171018
erc721Addr = ethcommon.HexToAddress(*inputLoadTestParams.ERC721Address)
10181019
shouldMint := true
10191020
if *inputLoadTestParams.ERC721Address == "" {
1021+
log.Info().Msg("Deploying ERC721 contract")
10201022
erc721Addr, _, _, err = tokens.DeployERC721(tops, c)
10211023
if err != nil {
10221024
log.Error().Err(err).Msg("Unable to deploy ERC721 contract")
10231025
return
10241026
}
10251027
shouldMint = false
10261028
}
1027-
log.Trace().Interface("contractaddress", erc721Addr).Msg("ERC721 contract address")
1029+
log.Info().Interface("contractaddress", erc721Addr).Msg("ERC721 contract address")
10281030

10291031
erc721Contract, err = tokens.NewERC721(erc721Addr, c)
10301032
if err != nil {
@@ -1043,6 +1045,7 @@ func getERC721Contract(ctx context.Context, c *ethclient.Client, tops *bind.Tran
10431045
return
10441046
}
10451047

1048+
log.Info().Msg("Mint one ERC721 token")
10461049
err = util.BlockUntilSuccessful(ctx, c, func() error {
10471050
_, err = erc721Contract.MintBatch(tops, *inputLoadTestParams.FromETHAddress, new(big.Int).SetUint64(1))
10481051
return err

cmd/loadtest/uniswapv3.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ func init() {
104104

105105
// Initialise UniswapV3 loadtest.
106106
func initUniswapV3Loadtest(ctx context.Context, c *ethclient.Client, tops *bind.TransactOpts, cops *bind.CallOpts, uniswapAddresses uniswapv3loadtest.UniswapV3Addresses, recipient common.Address) (uniswapV3Config uniswapv3loadtest.UniswapV3Config, poolConfig uniswapv3loadtest.PoolConfig, err error) {
107-
log.Debug().Msg("🦄 Deploying UniswapV3 contracts...")
107+
log.Info().Msg("Deploying UniswapV3 contracts...")
108108
uniswapV3Config, err = uniswapv3loadtest.DeployUniswapV3(ctx, c, tops, cops, uniswapAddresses, recipient)
109109
if err != nil {
110110
return
111111
}
112-
log.Debug().Interface("addresses", uniswapV3Config.GetAddresses()).Msg("UniswapV3 deployed")
112+
log.Info().Interface("addresses", uniswapV3Config.GetAddresses()).Msg("UniswapV3 deployed")
113113

114-
log.Debug().Msg("🪙 Deploying ERC20 tokens...")
114+
log.Info().Msg("Deploying ERC20 tokens...")
115115
var token0 uniswapv3loadtest.ContractConfig[tokens.ERC20]
116116
token0, err = uniswapv3loadtest.DeployERC20(
117117
ctx, c, tops, cops, uniswapV3Config, "SwapperA", "SA", uniswapv3loadtest.MintAmount, recipient, common.HexToAddress(*uniswapv3LoadTestParams.UniswapPoolToken0))

cmd/loadtest/uniswapv3/deploy.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type (
7373
// Deploy the full UniswapV3 contract suite in 15 different steps.
7474
// Source: https://github.com/Uniswap/deploy-v3
7575
func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.TransactOpts, cops *bind.CallOpts, knownAddresses UniswapV3Addresses, ownerAddress common.Address) (config UniswapV3Config, err error) {
76-
log.Debug().Msg("Step 0: WETH9 deployment")
76+
log.Info().Msg("Step 0: WETH9 deployment")
7777
config.WETH9.Address, config.WETH9.Contract, err = deployOrInstantiateContract(
7878
ctx, c, tops, cops,
7979
knownAddresses.WETH9,
@@ -88,7 +88,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
8888
return
8989
}
9090

91-
log.Debug().Msg("Step 1: UniswapV3Factory deployment")
91+
log.Info().Msg("Step 1: UniswapV3Factory deployment")
9292
config.FactoryV3.Address, config.FactoryV3.Contract, err = deployOrInstantiateContract(
9393
ctx, c, tops, cops,
9494
knownAddresses.FactoryV3,
@@ -103,12 +103,12 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
103103
return
104104
}
105105

106-
log.Debug().Msg("Step 2: Enable fee amount")
106+
log.Info().Msg("Step 2: Enable fee amount")
107107
if err = enableFeeAmount(config.FactoryV3.Contract, tops, cops, oneBPFee, oneBPTickSpacing); err != nil {
108108
return
109109
}
110110

111-
log.Debug().Msg("Step 3: UniswapInterfaceMulticall deployment")
111+
log.Info().Msg("Step 3: UniswapInterfaceMulticall deployment")
112112
config.Multicall.Address, config.Multicall.Contract, err = deployOrInstantiateContract(
113113
ctx, c, tops, cops,
114114
knownAddresses.Multicall,
@@ -123,7 +123,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
123123
return
124124
}
125125

126-
log.Debug().Msg("Step 4: ProxyAdmin deployment")
126+
log.Info().Msg("Step 4: ProxyAdmin deployment")
127127
config.ProxyAdmin.Address, config.ProxyAdmin.Contract, err = deployOrInstantiateContract(
128128
ctx, c, tops, cops,
129129
knownAddresses.ProxyAdmin,
@@ -138,7 +138,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
138138
return
139139
}
140140

141-
log.Debug().Msg("Step 5: TickLens deployment")
141+
log.Info().Msg("Step 5: TickLens deployment")
142142
config.TickLens.Address, config.TickLens.Contract, err = deployOrInstantiateContract(
143143
ctx, c, tops, cops,
144144
knownAddresses.TickLens,
@@ -155,7 +155,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
155155
return
156156
}
157157

158-
log.Debug().Msg("Step 6: NFTDescriptorLib deployment")
158+
log.Info().Msg("Step 6: NFTDescriptorLib deployment")
159159
config.NFTDescriptorLib.Address, _, err = deployOrInstantiateContract(
160160
ctx, c, tops, cops,
161161
knownAddresses.NFTDescriptorLib,
@@ -170,7 +170,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
170170
return
171171
}
172172

173-
log.Debug().Msg("Step 7: NFTPositionDescriptor deployment")
173+
log.Info().Msg("Step 7: NFTPositionDescriptor deployment")
174174
config.NonfungibleTokenPositionDescriptor.Address, config.NonfungibleTokenPositionDescriptor.Contract, err = deployOrInstantiateContract(
175175
ctx, c, tops, cops,
176176
knownAddresses.NonfungibleTokenPositionDescriptor,
@@ -201,7 +201,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
201201
return
202202
}
203203

204-
log.Debug().Msg("Step 8: TransparentUpgradeableProxy deployment")
204+
log.Info().Msg("Step 8: TransparentUpgradeableProxy deployment")
205205
config.TransparentUpgradeableProxy.Address, config.TransparentUpgradeableProxy.Contract, err = deployOrInstantiateContract(
206206
ctx, c, tops, cops,
207207
knownAddresses.TransparentUpgradeableProxy,
@@ -222,7 +222,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
222222
return
223223
}
224224

225-
log.Debug().Msg("Step 9: NonfungiblePositionManager deployment")
225+
log.Info().Msg("Step 9: NonfungiblePositionManager deployment")
226226
config.NonfungiblePositionManager.Address, config.NonfungiblePositionManager.Contract, err = deployOrInstantiateContract(
227227
ctx, c, tops, cops,
228228
knownAddresses.NonfungiblePositionManager,
@@ -239,7 +239,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
239239
return
240240
}
241241

242-
log.Debug().Msg("Step 10: V3Migrator deployment")
242+
log.Info().Msg("Step 10: V3Migrator deployment")
243243
config.Migrator.Address, config.Migrator.Contract, err = deployOrInstantiateContract(
244244
ctx, c, tops, cops,
245245
knownAddresses.Migrator,
@@ -257,13 +257,13 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
257257
}
258258

259259
if knownAddresses.FactoryV3 == (common.Address{}) {
260-
log.Debug().Msg("Step 11: Transfer UniswapV3Factory ownership")
260+
log.Info().Msg("Step 11: Transfer UniswapV3Factory ownership")
261261
if err = transferUniswapV3FactoryOwnership(config.FactoryV3.Contract, tops, cops, ownerAddress); err != nil {
262262
return
263263
}
264264
}
265265

266-
log.Debug().Msg("Step 12: UniswapV3Staker deployment")
266+
log.Info().Msg("Step 12: UniswapV3Staker deployment")
267267
config.Staker.Address, config.Staker.Contract, err = deployOrInstantiateContract(
268268
ctx, c, tops, cops,
269269
knownAddresses.Staker,
@@ -280,7 +280,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
280280
return
281281
}
282282

283-
log.Debug().Msg("Step 13: QuoterV2 deployment")
283+
log.Info().Msg("Step 13: QuoterV2 deployment")
284284
config.QuoterV2.Address, config.QuoterV2.Contract, err = deployOrInstantiateContract(
285285
ctx, c, tops, cops,
286286
knownAddresses.QuoterV2,
@@ -297,7 +297,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
297297
return
298298
}
299299

300-
log.Debug().Msg("Step 14: SwapRouter02 deployment")
300+
log.Info().Msg("Step 14: SwapRouter02 deployment")
301301
config.SwapRouter02.Address, config.SwapRouter02.Contract, err = deployOrInstantiateContract(
302302
ctx, c, tops, cops,
303303
knownAddresses.SwapRouter02,
@@ -316,7 +316,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa
316316
}
317317

318318
if knownAddresses.ProxyAdmin == (common.Address{}) {
319-
log.Debug().Msg("Step 15: Transfer ProxyAdmin ownership")
319+
log.Info().Msg("Step 15: Transfer ProxyAdmin ownership")
320320
if err = transferProxyAdminOwnership(config.ProxyAdmin.Contract, tops, cops, ownerAddress); err != nil {
321321
return
322322
}

0 commit comments

Comments
 (0)