github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/fvm/blueprints/version_beacon.go (about)

     1  package blueprints
     2  
     3  import (
     4  	_ "embed"
     5  	"encoding/hex"
     6  
     7  	"github.com/onflow/cadence"
     8  	jsoncdc "github.com/onflow/cadence/encoding/json"
     9  
    10  	"github.com/onflow/flow-core-contracts/lib/go/contracts"
    11  
    12  	"github.com/onflow/flow-go/model/flow"
    13  )
    14  
    15  //go:embed scripts/deployNodeVersionBeaconTransactionTemplate.cdc
    16  var deployNodeVersionBeaconTransactionTemplate string
    17  
    18  // DeployNodeVersionBeaconTransaction returns the transaction body for the deployment NodeVersionBeacon contract transaction
    19  func DeployNodeVersionBeaconTransaction(
    20  	service flow.Address,
    21  	versionFreezePeriod cadence.UInt64,
    22  ) *flow.TransactionBody {
    23  	return flow.NewTransactionBody().
    24  		SetScript([]byte(deployNodeVersionBeaconTransactionTemplate)).
    25  		AddArgument(jsoncdc.MustEncode(cadence.String(hex.EncodeToString(contracts.NodeVersionBeacon())))).
    26  		AddArgument(jsoncdc.MustEncode(versionFreezePeriod)).
    27  		AddAuthorizer(service)
    28  }