use of com.hedera.services.state.merkle.MerkleToken in project hedera-services by hashgraph.
the class TokenPropertyTest method settersWorks.
@Test
void settersWorks() {
// given:
final MerkleToken target = new MerkleToken();
// and:
final var totalSupplySetter = TOTAL_SUPPLY.setter();
final var decimalsSetter = DECIMALS.setter();
final var adminKeySetter = ADMIN_KEY.setter();
final var freezeKeySetter = FREEZE_KEY.setter();
final var kycKeySetter = KYC_KEY.setter();
final var pauseKeySetter = PAUSE_KEY.setter();
final var supplyKeySetter = SUPPLY_KEY.setter();
final var feeScheduleKeySetter = FEE_SCHEDULE_KEY.setter();
final var wipeKeySetter = WIPE_KEY.setter();
final var deletedSetter = IS_DELETED.setter();
final var pausedSetter = IS_PAUSED.setter();
final var symbolSetter = SYMBOL.setter();
final var nameSetter = NAME.setter();
final var treasurySetter = TREASURY.setter();
final var accountsFrozenByDefaultSetter = ACC_FROZEN_BY_DEFAULT.setter();
final var expirySetter = EXPIRY.setter();
final var autoRenewPeriodSetter = AUTO_RENEW_PERIOD.setter();
final var autoRenewAccountSetter = AUTO_RENEW_ACCOUNT.setter();
final var memoSetter = MEMO.setter();
final var lastUsedSerialNumberSetter = LAST_USED_SERIAL_NUMBER.setter();
final var tokenTypeSetter = TOKEN_TYPE.setter();
final var supplyTypeSetter = SUPPLY_TYPE.setter();
final var maxSupplySetter = MAX_SUPPLY.setter();
final var feeScheduleSetter = FEE_SCHEDULE.setter();
// when:
totalSupplySetter.accept(target, totalSupply);
decimalsSetter.accept(target, decimals);
adminKeySetter.accept(target, adminKey);
freezeKeySetter.accept(target, freezeKey);
kycKeySetter.accept(target, kycKey);
pauseKeySetter.accept(target, pauseKey);
supplyKeySetter.accept(target, supplyKey);
feeScheduleKeySetter.accept(target, feeScheduleKey);
wipeKeySetter.accept(target, wipeKey);
deletedSetter.accept(target, deleted);
pausedSetter.accept(target, paused);
symbolSetter.accept(target, symbol);
nameSetter.accept(target, name);
treasurySetter.accept(target, treasury);
accountsFrozenByDefaultSetter.accept(target, accountsFrozenByDefault);
expirySetter.accept(target, expiry);
autoRenewPeriodSetter.accept(target, autoRenewPeriod);
autoRenewAccountSetter.accept(target, autoRenewAccount);
memoSetter.accept(target, memo);
lastUsedSerialNumberSetter.accept(target, lastUsedSerialNumber);
tokenTypeSetter.accept(target, tokenType);
supplyTypeSetter.accept(target, supplyType);
maxSupplySetter.accept(target, maxSupply);
feeScheduleSetter.accept(target, feeSchedule);
// expect:
assertEquals(totalSupply, target.totalSupply());
assertEquals(decimals, target.decimals());
assertEquals(adminKey, target.getAdminKey());
assertEquals(freezeKey, target.getFreezeKey());
assertEquals(kycKey, target.getKycKey());
assertEquals(pauseKey, target.getPauseKey());
assertEquals(supplyKey, target.getSupplyKey());
assertEquals(feeScheduleKey, target.getFeeScheduleKey());
assertEquals(wipeKey, target.getWipeKey());
assertEquals(deleted, target.isDeleted());
assertEquals(paused, target.isPaused());
assertEquals(symbol, target.symbol());
assertEquals(name, target.name());
assertEquals(treasury, target.treasury());
assertEquals(accountsFrozenByDefault, target.accountsAreFrozenByDefault());
assertEquals(expiry, target.expiry());
assertEquals(autoRenewPeriod, target.autoRenewPeriod());
assertEquals(autoRenewAccount, target.autoRenewAccount());
assertEquals(tokenType, target.tokenType());
assertEquals(supplyType, target.supplyType());
assertEquals(maxSupply, target.maxSupply());
assertEquals(feeSchedule, target.customFeeSchedule());
}
use of com.hedera.services.state.merkle.MerkleToken in project hedera-services by hashgraph.
the class WorldLedgersTest method wrapsAsExpectedWithCommitInterceptors.
@Test
void wrapsAsExpectedWithCommitInterceptors() {
final var liveTokenRels = new TransactionalLedger<>(TokenRelProperty.class, MerkleTokenRelStatus::new, new HashMapBackingTokenRels(), new ChangeSummaryManager<>());
final var liveAccounts = new TransactionalLedger<>(AccountProperty.class, MerkleAccount::new, new HashMapBackingAccounts(), new ChangeSummaryManager<>());
final var liveNfts = new TransactionalLedger<>(NftProperty.class, MerkleUniqueToken::new, new HashMapBackingNfts(), new ChangeSummaryManager<>());
final var liveTokens = new TransactionalLedger<>(TokenProperty.class, MerkleToken::new, new HashMapBackingTokens(), new ChangeSummaryManager<>());
final var liveAliases = new AliasManager();
final var source = new WorldLedgers(liveAliases, liveTokenRels, liveAccounts, liveNfts, liveTokens);
assertTrue(source.areMutable());
final var nullTokenRels = new WorldLedgers(liveAliases, null, liveAccounts, liveNfts, liveTokens);
final var nullAccounts = new WorldLedgers(liveAliases, liveTokenRels, null, liveNfts, liveTokens);
final var nullNfts = new WorldLedgers(liveAliases, liveTokenRels, liveAccounts, null, liveTokens);
final var nullTokens = new WorldLedgers(liveAliases, liveTokenRels, liveAccounts, liveNfts, null);
assertFalse(nullTokenRels.areMutable());
assertFalse(nullAccounts.areMutable());
assertFalse(nullNfts.areMutable());
assertFalse(nullTokens.areMutable());
final var wrappedUnusable = nullAccounts.wrapped(sideEffectsTracker);
assertSame(((StackedContractAliases) wrappedUnusable.aliases()).wrappedAliases(), nullAccounts.aliases());
assertFalse(wrappedUnusable.areMutable());
final var wrappedSource = source.wrapped(sideEffectsTracker);
assertSame(liveTokenRels, wrappedSource.tokenRels().getEntitiesLedger());
assertSame(liveAccounts, wrappedSource.accounts().getEntitiesLedger());
assertSame(liveNfts, wrappedSource.nfts().getEntitiesLedger());
assertSame(liveTokens, wrappedSource.tokens().getEntitiesLedger());
final var stackedAliases = (StackedContractAliases) wrappedSource.aliases();
assertSame(liveAliases, stackedAliases.wrappedAliases());
}
use of com.hedera.services.state.merkle.MerkleToken in project hedera-services by hashgraph.
the class TypedTokenStoreTest method setupToken.
private void setupToken() {
merkleToken = new MerkleToken(expiry, tokenSupply, 0, symbol, name, freezeDefault, true, new EntityId(0, 0, treasuryAccountNum));
merkleToken.setAutoRenewAccount(new EntityId(0, 0, autoRenewAccountNum));
merkleToken.setSupplyKey(supplyKey);
merkleToken.setKycKey(kycKey);
merkleToken.setFreezeKey(freezeKey);
merkleToken.setPauseKey(pauseKey);
merkleToken.setPaused(false);
token.setTreasury(treasuryAccount);
token.setAutoRenewAccount(autoRenewAccount);
token.setTotalSupply(tokenSupply);
token.setKycKey(kycKey);
token.setSupplyKey(supplyKey);
token.setFreezeKey(freezeKey);
token.setPauseKey(pauseKey);
token.setFrozenByDefault(freezeDefault);
token.setIsDeleted(false);
token.setPaused(false);
token.setExpiry(expiry);
}
use of com.hedera.services.state.merkle.MerkleToken in project hedera-services by hashgraph.
the class AbstractLedgerWorldUpdaterTest method setupLedgers.
private void setupLedgers() {
final var tokenRelsLedger = new TransactionalLedger<>(TokenRelProperty.class, MerkleTokenRelStatus::new, new HashMapBackingTokenRels(), new ChangeSummaryManager<>());
final var accountsLedger = new TransactionalLedger<>(AccountProperty.class, MerkleAccount::new, new HashMapBackingAccounts(), new ChangeSummaryManager<>());
final var tokensLedger = new TransactionalLedger<>(TokenProperty.class, MerkleToken::new, new HashMapBackingTokens(), new ChangeSummaryManager<>());
final var nftsLedger = new TransactionalLedger<>(NftProperty.class, MerkleUniqueToken::new, new HashMapBackingNfts(), new ChangeSummaryManager<>());
tokenRelsLedger.begin();
accountsLedger.begin();
nftsLedger.begin();
tokensLedger.begin();
ledgers = new WorldLedgers(aliases, tokenRelsLedger, accountsLedger, nftsLedger, tokensLedger);
}
use of com.hedera.services.state.merkle.MerkleToken in project hedera-services by hashgraph.
the class AbstractStackedLedgerUpdaterTest method setupLedgers.
private void setupLedgers() {
final var tokenRelsLedger = new TransactionalLedger<>(TokenRelProperty.class, MerkleTokenRelStatus::new, new HashMapBackingTokenRels(), new ChangeSummaryManager<>());
final var accountsLedger = new TransactionalLedger<>(AccountProperty.class, MerkleAccount::new, new HashMapBackingAccounts(), new ChangeSummaryManager<>());
final var nftsLedger = new TransactionalLedger<>(NftProperty.class, MerkleUniqueToken::new, new HashMapBackingNfts(), new ChangeSummaryManager<>());
final var tokensLedger = new TransactionalLedger<>(TokenProperty.class, MerkleToken::new, new HashMapBackingTokens(), new ChangeSummaryManager<>());
tokenRelsLedger.begin();
accountsLedger.begin();
nftsLedger.begin();
ledgers = new WorldLedgers(aliases, tokenRelsLedger, accountsLedger, nftsLedger, tokensLedger);
}
Aggregations