Skip to content

Commit

Permalink
Merge pull request #97 from cardano-foundation/handle_payment_cred_ad…
Browse files Browse the repository at this point in the history
…dress

feat: handle payment_cred in Address
  • Loading branch information
Sotatek-HuyLe3a authored Dec 1, 2023
2 parents bff7eb0 + 3dabab5 commit 3fc0b97
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -548,13 +548,15 @@ private Address buildNewAddressEntity(
AggregatedAddressBalance aggregatedAddressBalance, StakeAddress stakeAddress) {
var address = aggregatedAddressBalance.getAddress().getAddress();
var addressHasScript = aggregatedAddressBalance.isAddressHasScript();
var paymentCred = aggregatedAddressBalance.getAddress().getPaymentCred();

return Address.builder()
.address(address)
.txCount(0L)
.balance(BigInteger.ZERO)
.addressHasScript(addressHasScript)
.stakeAddress(stakeAddress)
.paymentCred(paymentCred)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,8 @@ CREATE TABLE IF NOT EXISTS address
balance numeric(39) NOT NULL,
tx_count bigint,
stake_address_id bigint,
verified_contract boolean
verified_contract boolean,
payment_cred varchar(56)
);

--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,7 @@ CREATE INDEX IF NOT EXISTS tx_witnesses_tx_id_idx ON tx_witnesses (tx_id);
CREATE INDEX IF NOT EXISTS tx_bootstrap_witnesses_tx_id_idx ON tx_bootstrap_witnesses (tx_id);

CREATE INDEX IF NOT EXISTS redeemer_script_hash_idx ON redeemer (script_hash);

CREATE INDEX IF NOT EXISTS address_payment_cred_idx ON address (payment_cred);
CREATE INDEX IF NOT EXISTS redeemer_script_hash_tx_id_idx ON redeemer (script_hash, tx_id);
CREATE INDEX IF NOT EXISTS stake_address_script_hash_idx ON stake_address (script_hash);
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.cardanofoundation.explorer.consumercommon.entity;

import org.cardanofoundation.explorer.consumercommon.validation.Hash28Type;
import org.cardanofoundation.explorer.consumercommon.validation.Word128Type;
import java.math.BigInteger;
import java.util.Objects;
Expand Down Expand Up @@ -53,6 +54,10 @@ public class Address extends BaseEntity {
@Column(name = "verified_contract")
private Boolean verifiedContract;

@Column(name = "payment_cred", length = 56)
@Hash28Type
private String paymentCred;

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down

0 comments on commit 3fc0b97

Please sign in to comment.