-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
logging_helpers.go
57 lines (51 loc) · 2.24 KB
/
logging_helpers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package vrfv2plus
import (
"fmt"
"math/big"
"github.com/rs/zerolog"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
vrfv2plus_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2plus"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_coordinator_v2_5"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_v2plus_upgraded_version"
)
func LogRandRequest(
l zerolog.Logger,
consumer string,
coordinator string,
subID *big.Int,
isNativeBilling bool,
keyHash [32]byte,
config *vrfv2plus_config.General,
keyNum int,
) {
l.Info().
Int("KeyNum", keyNum).
Str("Consumer", consumer).
Str("Coordinator", coordinator).
Str("SubID", subID.String()).
Bool("IsNativePayment", isNativeBilling).
Uint16("MinimumConfirmations", *config.MinimumConfirmations).
Uint32("CallbackGasLimit", *config.CallbackGasLimit).
Uint32("NumberOfWords", *config.NumberOfWords).
Str("KeyHash", fmt.Sprintf("0x%x", keyHash)).
Uint16("RandomnessRequestCountPerRequest", *config.RandomnessRequestCountPerRequest).
Uint16("RandomnessRequestCountPerRequestDeviation", *config.RandomnessRequestCountPerRequestDeviation).
Msg("Requesting randomness")
}
func LogMigrationCompletedEvent(l zerolog.Logger, migrationCompletedEvent *vrf_coordinator_v2_5.VRFCoordinatorV25MigrationCompleted, coordinator contracts.Coordinator) {
l.Info().
Str("Subscription ID", migrationCompletedEvent.SubId.String()).
Str("Migrated From Coordinator", coordinator.Address()).
Str("Migrated To Coordinator", migrationCompletedEvent.NewCoordinator.String()).
Msg("MigrationCompleted Event")
}
func LogSubDetailsAfterMigration(l zerolog.Logger, newCoordinator contracts.Coordinator, subID *big.Int, migratedSubscription vrf_v2plus_upgraded_version.GetSubscription) {
l.Info().
Str("New Coordinator", newCoordinator.Address()).
Str("Subscription ID", subID.String()).
Str("Juels Balance", migratedSubscription.Balance.String()).
Str("Native Token Balance", migratedSubscription.NativeBalance.String()).
Str("Subscription Owner", migratedSubscription.SubOwner.String()).
Interface("Subscription Consumers", migratedSubscription.Consumers).
Msg("Subscription Data After Migration to New Coordinator")
}