Class IWorldExtensions
Inheritance
Namespace: Libplanet.Action.State
Assembly: Libplanet.Action.dll
Syntax
public static class IWorldExtensions : object
Methods
| Improve this Doc View SourceBurnAsset(IWorld, IActionContext, Address, FungibleAssetValue)
Burns the fungible asset value
(i.e., in-game monetary) from
owner
's balance.
Declaration
public static IWorld BurnAsset(this IWorld world, IActionContext context, Address owner, FungibleAssetValue value)
Parameters
Type | Name | Description |
---|---|---|
IWorld | world | The IWorld to manipulate. |
IAction |
context | The IAction |
Address | owner | The address who owns the fungible asset to burn. |
Fungible |
value | The fungible asset |
Returns
Type | Description |
---|---|
IWorld | A new IWorld instance that the given |
Exceptions
Type | Condition |
---|---|
Currency |
Thrown when a transaction signer (or a miner in case of block actions) is not a member of the Currency's Minters. |
Insufficient |
Thrown when the |
GetBalance(IWorldState, Address, Currency)
Queries address
's balance of the currency
.
Declaration
public static FungibleAssetValue GetBalance(this IWorldState worldState, Address address, Currency currency)
Parameters
Type | Name | Description |
---|---|---|
IWorld |
worldState | The IWorld |
Address | address | The owner address to query. |
Currency | currency | The currency type to query. |
Returns
Type | Description |
---|---|
Fungible |
The |
GetTotalSupply(IWorldState, Currency)
Returns the total supply of currency
.
The total supply of a given Currency is determined by the following:
-
If Version is less than
Currency
Account , it is the amount of total supply for the Currency in question if the value of TotalProtocol Version Supply is true, and zero otherwise. That is, an untracked Currency's total supply is always considered zero.Trackable -
If Version is greater than or equal to
Currency
Account , it is the amount of total supply for the Currency in question regardless of the value of TotalProtocol Version Supply .Trackable
Declaration
public static FungibleAssetValue GetTotalSupply(this IWorldState worldState, Currency currency)
Parameters
Type | Name | Description |
---|---|---|
IWorld |
worldState | The IWorld |
Currency | currency | The currency type to query. |
Returns
Type | Description |
---|---|
Fungible |
The total supply of the |
GetValidatorSet(IWorldState)
Returns the validator set.
Declaration
public static ValidatorSet GetValidatorSet(this IWorldState worldState)
Parameters
Type | Name | Description |
---|---|---|
IWorld |
worldState | The IWorld |
Returns
Type | Description |
---|---|
Validator |
The validator set of type Validator |
MintAsset(IWorld, IActionContext, Address, FungibleAssetValue)
Mints the fungible asset value
(i.e., in-game monetary),
and give it to the recipient
.
Declaration
public static IWorld MintAsset(this IWorld world, IActionContext context, Address recipient, FungibleAssetValue value)
Parameters
Type | Name | Description |
---|---|---|
IWorld | world | The IWorld to manipulate. |
IAction |
context | The IAction |
Address | recipient | The address who receives the minted asset. |
Fungible |
value | The asset value to mint. |
Returns
Exceptions
Type | Condition |
---|---|
Currency |
Thrown when a transaction signer (or a miner in case of block actions) is not a member of the Currency's Minters. |
Supply |
Thrown when the sum of the
|
SetValidatorSet(IWorld, ValidatorSet)
Sets validatorSet
to the stored Validator
Declaration
public static IWorld SetValidatorSet(this IWorld world, ValidatorSet validatorSet)
Parameters
Type | Name | Description |
---|---|---|
IWorld | world | The IWorld to manipulate. |
Validator |
validatorSet | The Validator |
Returns
| Improve this Doc View SourceTransferAsset(IWorld, IActionContext, Address, Address, FungibleAssetValue)
Transfers the fungible asset value
(i.e., in-game monetary)
from the sender
to the recipient
.
Declaration
public static IWorld TransferAsset(this IWorld world, IActionContext context, Address sender, Address recipient, FungibleAssetValue value)
Parameters
Type | Name | Description |
---|---|---|
IWorld | world | The IWorld to manipulate. |
IAction |
context | The IAction |
Address | sender | The address who sends the fungible asset to
the |
Address | recipient | The address who receives the fungible asset from
the |
Fungible |
value | The asset value to transfer. |
Returns
Type | Description |
---|---|
IWorld | A new IWorld instance that the given |
Remarks
The behavior is different depending on context
's
Block
Exceptions
Type | Condition |
---|---|
Insufficient |
Thrown when the |