use of org.tron.core.capsule.AssetIssueCapsule in project java-tron by tronprotocol.
the class ParticipateAssetIssueActuatorTest method initAssetIssue.
private void initAssetIssue(long startTimestmp, long endTimestmp) {
AssetIssueContract assetIssueContract = AssetIssueContract.newBuilder().setOwnerAddress(ByteString.copyFrom(ByteArray.fromHexString(TO_ADDRESS))).setName(ByteString.copyFrom(ByteArray.fromString(ASSET_NAME))).setTotalSupply(TOTAL_SUPPLY).setTrxNum(TRX_NUM).setNum(NUM).setStartTime(startTimestmp).setEndTime(endTimestmp).setDecayRatio(DECAY_RATIO).setVoteScore(VOTE_SCORE).setDescription(ByteString.copyFrom(ByteArray.fromString(DESCRIPTION))).setUrl(ByteString.copyFrom(ByteArray.fromString(URL))).build();
AssetIssueCapsule assetIssueCapsule = new AssetIssueCapsule(assetIssueContract);
dbManager.getAssetIssueStore().put(assetIssueCapsule.getName().toByteArray(), assetIssueCapsule);
}
use of org.tron.core.capsule.AssetIssueCapsule in project java-tron by tronprotocol.
the class TransferAssetActuatorTest method createCapsule.
/**
* create temp Capsule test need.
*/
@Before
public void createCapsule() {
AccountCapsule ownerCapsule = new AccountCapsule(ByteString.copyFrom(ByteArray.fromHexString(OWNER_ADDRESS)), ByteString.copyFromUtf8("owner"), AccountType.AssetIssue);
ownerCapsule.addAsset(ASSET_NAME, 10000L);
AccountCapsule toAccountCapsule = new AccountCapsule(ByteString.copyFrom(ByteArray.fromHexString(TO_ADDRESS)), ByteString.copyFromUtf8("toAccount"), AccountType.Normal);
AssetIssueContract assetIssueContract = AssetIssueContract.newBuilder().setOwnerAddress(ByteString.copyFrom(ByteArray.fromHexString(OWNER_ADDRESS))).setName(ByteString.copyFrom(ByteArray.fromString(ASSET_NAME))).setTotalSupply(TOTAL_SUPPLY).setTrxNum(TRX_NUM).setNum(NUM).setStartTime(START_TIME).setEndTime(END_TIME).setDecayRatio(DECAY_RATIO).setVoteScore(VOTE_SCORE).setDescription(ByteString.copyFrom(ByteArray.fromString(DESCRIPTION))).setUrl(ByteString.copyFrom(ByteArray.fromString(URL))).build();
AssetIssueCapsule assetIssueCapsule = new AssetIssueCapsule(assetIssueContract);
dbManager.getAccountStore().put(ownerCapsule.getAddress().toByteArray(), ownerCapsule);
dbManager.getAccountStore().put(toAccountCapsule.getAddress().toByteArray(), toAccountCapsule);
dbManager.getAssetIssueStore().put(assetIssueCapsule.getName().toByteArray(), assetIssueCapsule);
}
Aggregations