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

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