-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2743 from energywebfoundation/feat/registry-extended
feat(issuer): Add RegistryExtended contract
- Loading branch information
Showing
37 changed files
with
529 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
## `RegistryExtended` | ||
|
||
|
||
|
||
|
||
|
||
|
||
### `constructor(string _uri)` (public) | ||
|
||
|
||
|
||
|
||
|
||
### `batchIssueMultiple(address[] _to, bytes[] _validityData, uint256[] _topics, uint256[] _values, bytes[] _data) → uint256[] ids` (external) | ||
|
||
Similar to {IERC1888-batchIssue}, but not a part of the ERC-1888 standard. | ||
|
||
|
||
Allows batch issuing to an array of _to addresses. | ||
`_to` cannot be the zero addresses. | ||
`_to`, `_data`, `_values`, `_topics` and `_validityData` must have the same length. | ||
|
||
### `safeBatchTransferFromMultiple(address[] _from, address[] _to, uint256[] _ids, uint256[] _values, bytes[] _data)` (external) | ||
|
||
Similar to {ERC1155-safeBatchTransferFrom}, but not a part of the ERC-1155 standard. | ||
|
||
|
||
Allows batch transferring to/from an array of addresses. | ||
|
||
### `safeBatchTransferAndClaimFromMultiple(address[] _from, address[] _to, uint256[] _ids, uint256[] _values, bytes[] _data, bytes[] _claimData)` (external) | ||
|
||
Similar to {IERC1888-safeBatchTransferAndClaimFrom}, but not a part of the ERC-1888 standard. | ||
|
||
|
||
Allows batch claiming to/from an array of addresses. | ||
|
||
|
||
### `TransferBatchMultiple(address operator, address[] from, address[] to, uint256[] ids, uint256[] values)` | ||
|
||
|
||
|
||
|
||
|
||
### `ClaimBatchMultiple(address[] _claimIssuer, address[] _claimSubject, uint256[] _topics, uint256[] _ids, uint256[] _values, bytes[] _claimData)` | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 2 additions & 7 deletions
9
...traceability/issuer-api/src/pods/certificate/commands/batch-claim-certificates.command.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { IClaimData } from '@energyweb/issuer'; | ||
import { CertificateAmount } from '../types'; | ||
import { CertificateBatchOperations } from '@energyweb/issuer'; | ||
|
||
export class BatchClaimCertificatesCommand { | ||
constructor( | ||
public readonly certificateAmounts: CertificateAmount[], | ||
public readonly claimData: IClaimData, | ||
public readonly forAddress: string | ||
) {} | ||
constructor(public readonly claims: CertificateBatchOperations.BatchCertificateClaim[]) {} | ||
} |
14 changes: 0 additions & 14 deletions
14
...ges/traceability/issuer-api/src/pods/certificate/commands/batch-claim-certificates.dto.ts
This file was deleted.
Oops, something went wrong.
8 changes: 2 additions & 6 deletions
8
...ceability/issuer-api/src/pods/certificate/commands/batch-transfer-certificates.command.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
import { CertificateAmount } from '../types'; | ||
import { CertificateBatchOperations } from '@energyweb/issuer'; | ||
|
||
export class BatchTransferCertificatesCommand { | ||
constructor( | ||
public readonly certificateAmounts: CertificateAmount[], | ||
public readonly to: string, | ||
public readonly forAddress: string | ||
) {} | ||
constructor(public readonly transfers: CertificateBatchOperations.BatchCertificateTransfer[]) {} | ||
} |
13 changes: 0 additions & 13 deletions
13
.../traceability/issuer-api/src/pods/certificate/commands/batch-transfer-certificates.dto.ts
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
packages/traceability/issuer-api/src/pods/certificate/commands/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/traceability/issuer-api/src/pods/certificate/dto/batch-certificate-claim.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger'; | ||
import { IsObject, IsEthereumAddress } from 'class-validator'; | ||
|
||
import { CertificateBatchOperations, IClaimData } from '@energyweb/issuer'; | ||
import { BatchCertificateTransferDTO } from './batch-certificate-transfer.dto'; | ||
|
||
export class BatchCertificateClaimDTO | ||
extends OmitType(BatchCertificateTransferDTO, ['to'] as const) | ||
implements Omit<CertificateBatchOperations.BatchCertificateClaim, 'amount'> | ||
{ | ||
@ApiProperty({ type: Object }) | ||
@IsObject() | ||
claimData: IClaimData; | ||
|
||
@ApiPropertyOptional({ type: String }) | ||
@IsEthereumAddress() | ||
to?: string; | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/traceability/issuer-api/src/pods/certificate/dto/batch-certificate-transfer.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ApiProperty, ApiPropertyOptional, PickType } from '@nestjs/swagger'; | ||
import { Validate, IsOptional, IsEthereumAddress } from 'class-validator'; | ||
|
||
import { IntUnitsOfEnergy } from '@energyweb/origin-backend-utils'; | ||
import { CertificateBatchOperations } from '@energyweb/issuer'; | ||
|
||
import { CertificateDTO } from './certificate.dto'; | ||
|
||
export class BatchCertificateTransferDTO | ||
extends PickType(CertificateDTO, ['id'] as const) | ||
implements Omit<CertificateBatchOperations.BatchCertificateTransfer, 'amount'> | ||
{ | ||
@ApiProperty({ type: String }) | ||
@IsEthereumAddress() | ||
to: string; | ||
|
||
@ApiPropertyOptional({ type: String }) | ||
@IsOptional() | ||
@IsEthereumAddress() | ||
from?: string; | ||
|
||
@ApiPropertyOptional({ type: String }) | ||
@IsOptional() | ||
@Validate(IntUnitsOfEnergy) | ||
amount?: string; | ||
} |
14 changes: 0 additions & 14 deletions
14
packages/traceability/issuer-api/src/pods/certificate/dto/certificate-amount.dto.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.