Skip to content

Commit

Permalink
bump bridge storage fee calculation estimate to 400kB per txn
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Oct 26, 2024
1 parent 8c3c54e commit 9c6c01f
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ transaction(nftIdentifier: String, ids: [UInt256]) {
//
// Set a cap on the withdrawable bridge fee
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
) + (FlowEVMBridgeConfig.baseFee * UFix64(ids.length))
// Issue and store bridge-dedicated Provider Capability in storage if necessary
if signer.storage.type(at: FlowEVMBridgeConfig.providerCapabilityStoragePath) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ transaction(nftIdentifier: String, ids: [UInt256], recipient: Address) {
//
// Set a cap on the withdrawable bridge fee
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
) + (FlowEVMBridgeConfig.baseFee * UFix64(ids.length))
// Issue and store bridge-dedicated Provider Capability in storage if necessary
if signer.storage.type(at: FlowEVMBridgeConfig.providerCapabilityStoragePath) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ transaction(nftIdentifier: String, ids: [UInt64], recipient: String) {

// Withdraw the requested NFT & set a cap on the withdrawable bridge fee
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
) + (FlowEVMBridgeConfig.baseFee * UFix64(ids.length))
// Determine if the NFT requires onboarding - this impacts the fee required
self.requiresOnboarding = FlowEVMBridge.typeRequiresOnboarding(self.nftType)
Expand Down
3 changes: 1 addition & 2 deletions cadence/transactions/bridge/nft/batch_bridge_nft_to_evm.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ transaction(nftIdentifier: String, ids: [UInt64]) {

// Withdraw the requested NFT & set a cap on the withdrawable bridge fee
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
) + (FlowEVMBridgeConfig.baseFee * UFix64(ids.length))
// Determine if the NFT requires onboarding - this impacts the fee required
self.requiresOnboarding = FlowEVMBridge.typeRequiresOnboarding(self.nftType)
Expand All @@ -70,7 +70,6 @@ transaction(nftIdentifier: String, ids: [UInt64]) {
if self.requiresOnboarding {
approxFee = approxFee + FlowEVMBridgeConfig.onboardFee
}
log(approxFee)

/* --- Configure a ScopedFTProvider --- */
//
Expand Down
2 changes: 1 addition & 1 deletion cadence/transactions/bridge/nft/bridge_nft_from_evm.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ transaction(nftIdentifier: String, id: UInt256) {
//
// Set a cap on the withdrawable bridge fee
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
)
// Issue and store bridge-dedicated Provider Capability in storage if necessary
if signer.storage.type(at: FlowEVMBridgeConfig.providerCapabilityStoragePath) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ transaction(nftIdentifier: String, id: UInt256, recipient: Address) {
//
// Set a cap on the withdrawable bridge fee
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
)
// Issue and store bridge-dedicated Provider Capability in storage if necessary
if signer.storage.type(at: FlowEVMBridgeConfig.providerCapabilityStoragePath) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ transaction(nftIdentifier: String, id: UInt64, recipient: String) {
// Withdraw the requested NFT & calculate the approximate bridge fee based on NFT storage usage
self.nft <- collection.withdraw(withdrawID: id)
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
)
// Determine if the NFT requires onboarding - this impacts the fee required
self.requiresOnboarding = FlowEVMBridge.typeRequiresOnboarding(self.nft.getType())
Expand Down
2 changes: 1 addition & 1 deletion cadence/transactions/bridge/nft/bridge_nft_to_evm.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ transaction(nftIdentifier: String, id: UInt64) {
// Withdraw the requested NFT & set a cap on the withdrawable bridge fee
self.nft <- collection.withdraw(withdrawID: id)
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
)
// Determine if the NFT requires onboarding - this impacts the fee required
self.requiresOnboarding = FlowEVMBridge.typeRequiresOnboarding(self.nft.getType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ transaction(vaultIdentifier: String, amount: UInt256) {
//
// Set a cap on the withdrawable bridge fee
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
)
// Issue and store bridge-dedicated Provider Capability in storage if necessary
if signer.storage.type(at: FlowEVMBridgeConfig.providerCapabilityStoragePath) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ transaction(vaultIdentifier: String, amount: UInt256, recipient: Address) {
//
// Set a cap on the withdrawable bridge fee
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
)
// Issue and store bridge-dedicated Provider Capability in storage if necessary
if signer.storage.type(at: FlowEVMBridgeConfig.providerCapabilityStoragePath) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ transaction(vaultIdentifier: String, amount: UFix64, recipient: String) {
// Withdraw the requested balance & set a cap on the withdrawable bridge fee
self.sentVault <- vault.withdraw(amount: amount)
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
)
// Determine if the Vault requires onboarding - this impacts the fee required
self.requiresOnboarding = FlowEVMBridge.typeRequiresOnboarding(self.sentVault.getType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ transaction(vaultIdentifier: String, amount: UFix64) {
// Withdraw the requested balance & set a cap on the withdrawable bridge fee
self.sentVault <- vault.withdraw(amount: amount)
var approxFee = FlowEVMBridgeUtils.calculateBridgeFee(
bytes: 200_000 // 200 kB as upper bound on movable storage used in a single transaction
bytes: 400_000 // 400 kB as upper bound on movable storage used in a single transaction
)
// Determine if the Vault requires onboarding - this impacts the fee required
self.requiresOnboarding = FlowEVMBridge.typeRequiresOnboarding(self.sentVault.getType())
Expand Down

0 comments on commit 9c6c01f

Please sign in to comment.