-
Notifications
You must be signed in to change notification settings - Fork 670
/
context.go
39 lines (34 loc) · 1.41 KB
/
context.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
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package txstest
import (
"time"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/vms/platformvm/config"
"github.com/ava-labs/avalanchego/vms/platformvm/txs"
"github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
"github.com/ava-labs/avalanchego/wallet/chain/p/builder"
)
func newContext(
ctx *snow.Context,
cfg *config.Config,
timestamp time.Time,
) *builder.Context {
var (
feeCalc = fee.NewStaticCalculator(cfg.StaticFeeConfig, cfg.UpgradeConfig)
createSubnetFee = feeCalc.CalculateFee(&txs.CreateSubnetTx{}, timestamp)
createChainFee = feeCalc.CalculateFee(&txs.CreateChainTx{}, timestamp)
)
return &builder.Context{
NetworkID: ctx.NetworkID,
AVAXAssetID: ctx.AVAXAssetID,
BaseTxFee: cfg.StaticFeeConfig.TxFee,
CreateSubnetTxFee: createSubnetFee,
TransformSubnetTxFee: cfg.StaticFeeConfig.TransformSubnetTxFee,
CreateBlockchainTxFee: createChainFee,
AddPrimaryNetworkValidatorFee: cfg.StaticFeeConfig.AddPrimaryNetworkValidatorFee,
AddPrimaryNetworkDelegatorFee: cfg.StaticFeeConfig.AddPrimaryNetworkDelegatorFee,
AddSubnetValidatorFee: cfg.StaticFeeConfig.AddSubnetValidatorFee,
AddSubnetDelegatorFee: cfg.StaticFeeConfig.AddSubnetDelegatorFee,
}
}