Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions dkg/modules/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,24 +386,16 @@ def create(
if token_amount:
estimated_publishing_cost = token_amount
else:
time_until_next_epoch = self.blockchain_service.time_until_next_epoch()
epoch_length = self.blockchain_service.epoch_length()
stake_weighted_average_ask = (
self.blockchain_service.get_stake_weighted_average_ask()
)

# Convert to integers and perform calculation
estimated_publishing_cost = (
(
int(stake_weighted_average_ask)
* (
int(epochs_num) * int(1e18)
+ (int(time_until_next_epoch) * int(1e18)) // int(epoch_length)
)
* int(dataset_size)
)
int(stake_weighted_average_ask)
* int(epochs_num)
* int(dataset_size)
// 1024
// int(1e18)
)

knowledge_collection_id = None
Expand Down
16 changes: 3 additions & 13 deletions dkg/modules/asset/async_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,26 +398,16 @@ async def create(
if token_amount:
estimated_publishing_cost = token_amount
else:
time_until_next_epoch = (
await self.blockchain_service.time_until_next_epoch()
)
epoch_length = await self.blockchain_service.epoch_length()
stake_weighted_average_ask = (
await self.blockchain_service.get_stake_weighted_average_ask()
)

# Convert to integers and perform calculation
estimated_publishing_cost = (
(
int(stake_weighted_average_ask)
* (
int(epochs_num) * int(1e18)
+ (int(time_until_next_epoch) * int(1e18)) // int(epoch_length)
)
* int(dataset_size)
)
int(stake_weighted_average_ask)
* int(epochs_num)
* int(dataset_size)
// 1024
// int(1e18)
)

knowledge_collection_id = None
Expand Down