Skip to content

Commit

Permalink
refactor: Remove WorldExtensions
Browse files Browse the repository at this point in the history
  • Loading branch information
OnedgeLee committed Nov 13, 2023
1 parent 94f4a17 commit 5ac8c76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
12 changes: 6 additions & 6 deletions Libplanet.Action/FeeCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public IWorld Mortgage(IWorld world)
return world;
}

IAccount account = world.GetFungibleAssetsAccount();
IAccount account = world.GetAccount(_context.SystemAccounts.FeeAccount);
var balance = account.GetBalance(_context.Signer, realGasPrice.Currency);
if (balance < realGasPrice * _context.GasLimit())
{
Expand All @@ -86,7 +86,7 @@ public IWorld Mortgage(IWorld world)
_context.Signer,
realGasPrice * _context.GasLimit());
_state = FeeCollectState.Mortgage;
return world.SetFungibleAssetsAccount(nextAccount);
return world.SetAccount(_context.SystemAccounts.FeeAccount, nextAccount);
}

public IWorld Refund(IWorld world)
Expand All @@ -108,12 +108,12 @@ public IWorld Refund(IWorld world)
return world;
}

IAccount nextAccount = world.GetFungibleAssetsAccount().MintAsset(
IAccount nextAccount = world.GetAccount(_context.SystemAccounts.FeeAccount).MintAsset(
_context,
_context.Signer,
(_context.GasLimit() - _context.GasUsed()) * realGasPrice);
_state = FeeCollectState.Refund;
return world.SetFungibleAssetsAccount(nextAccount);
return world.SetAccount(_context.SystemAccounts.FeeAccount, nextAccount);
}

public IWorld Reward(IWorld world)
Expand All @@ -135,12 +135,12 @@ public IWorld Reward(IWorld world)
return world;
}

IAccount nextAccount = world.GetFungibleAssetsAccount().MintAsset(
IAccount nextAccount = world.GetAccount(_context.SystemAccounts.FeeAccount).MintAsset(
_context,
_context.Miner,
realGasPrice * _context.GasUsed());
_state = FeeCollectState.Reward;
return world.SetFungibleAssetsAccount(nextAccount);
return world.SetAccount(_context.SystemAccounts.FeeAccount, nextAccount);
}

public IFeeCollector Next(IActionContext context)
Expand Down
20 changes: 0 additions & 20 deletions Libplanet.Action/State/WorldExtensions.cs

This file was deleted.

0 comments on commit 5ac8c76

Please sign in to comment.