github.com/koko1123/flow-go-1@v0.29.6/fvm/blueprints/scripts/deployEpochTransactionTemplate.cdc (about)

     1  import FlowClusterQC from 0xQCADDRESS
     2  
     3  transaction(
     4      code: String,
     5      currentEpochCounter: UInt64,
     6      numViewsInEpoch: UInt64,
     7      numViewsInStakingAuction: UInt64,
     8      numViewsInDKGPhase: UInt64,
     9      numCollectorClusters: UInt16,
    10      FLOWsupplyIncreasePercentage: UFix64,
    11      randomSource: String,
    12      clusterWeights: [{String: UInt64}]) {
    13    prepare(serviceAccount: AuthAccount)	{
    14  
    15      // first, construct Cluster objects from cluster weights
    16      let clusters: [FlowClusterQC.Cluster] = []
    17      var clusterIndex: UInt16 = 0
    18      for weightMapping in clusterWeights {
    19         let cluster = FlowClusterQC.Cluster(index: clusterIndex, nodeWeights: weightMapping)
    20        clusterIndex = clusterIndex + 1
    21      }
    22  
    23  	serviceAccount.contracts.add(
    24  		name: "FlowEpoch",
    25  		code: code.decodeHex(),
    26          currentEpochCounter: currentEpochCounter,
    27          numViewsInEpoch: numViewsInEpoch,
    28          numViewsInStakingAuction: numViewsInStakingAuction,
    29          numViewsInDKGPhase: numViewsInDKGPhase,
    30          numCollectorClusters: numCollectorClusters,
    31          FLOWsupplyIncreasePercentage: FLOWsupplyIncreasePercentage,
    32          randomSource: randomSource,
    33  		collectorClusters: clusters,
    34          // NOTE: clusterQCs and dkgPubKeys are empty because these initial values are not used
    35  		clusterQCs: [] as [FlowClusterQC.ClusterQC],
    36  		dkgPubKeys: [] as [String],
    37  	)
    38    }
    39  }