Skip to content

Commit

Permalink
add support for codeHash for each contract upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
cfaur09 committed Oct 25, 2023
1 parent 455f3d2 commit a831d51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/indexer/entities/sc.deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface ScDeploy {
address: string;
contract: string;
deployTxHash: string;
initialCodeHash: string;
deployer: string;
timestamp: number;
upgrades: ScDeployUpgrade[];
Expand All @@ -10,5 +11,6 @@ export interface ScDeploy {
export interface ScDeployUpgrade {
upgrader: string;
upgradeTxHash: string;
codeHash: string;
timestamp: number;
}
1 change: 1 addition & 0 deletions src/endpoints/accounts/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ export class AccountService {
const upgrades = details.upgrades.map(item => ApiUtils.mergeObjects(new ContractUpgrades(), {
address: item.upgrader,
txHash: item.upgradeTxHash,
codeHash: item.codeHash,
timestamp: item.timestamp,
})).sortedDescending(item => item.timestamp);

Expand Down
4 changes: 4 additions & 0 deletions src/endpoints/accounts/entities/contract.upgrades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export class ContractUpgrades {
@ApiProperty({ type: String, nullable: true, example: '1c8c6b2148f25621fa2c798a2c9a184df61fdd1991aa0af7ea01eb7b89025d2a' })
txHash: string = '';

@Field(() => String, { description: 'CodeHash details.' })
@ApiProperty({ type: String, nullable: true, example: '1c8c6b2148f25621fa2c798a2c9a184df61fdd1991aa0af7ea01eb7b89025d2a' })
codeHash: string = '';

@Field(() => Float, { description: 'Timestamp details.' })
@ApiProperty({ type: Number, nullable: true, example: '1638577452' })
timestamp: number = 0;
Expand Down

0 comments on commit a831d51

Please sign in to comment.