-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7423814
commit 842d2ff
Showing
5 changed files
with
146 additions
and
0 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
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 @@ | ||
export * from './models' |
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,113 @@ | ||
import { DataTypes, Sequelize, Model, Association, CreationOptional, InferAttributes, InferCreationAttributes } from 'sequelize' | ||
|
||
// Indexing Fees AKA "DIPs" | ||
|
||
export class IndexingAgreement extends Model< | ||
InferAttributes<IndexingAgreement>, | ||
InferCreationAttributes<IndexingAgreement> | ||
> { | ||
declare id: CreationOptional<string>; | ||
declare signature: Buffer; | ||
declare signed_payload: Buffer; | ||
declare protocol_network: string; | ||
declare chain_id: string; | ||
declare price_per_block: string; | ||
declare price_per_entity: string; | ||
declare subgraph_deployment_id: string; | ||
declare service: string; | ||
declare payee: string; | ||
declare payer: string; | ||
declare created_at: Date; | ||
declare updated_at: Date; | ||
declare cancelled_at: Date | null; | ||
declare signed_cancellation_payload: Buffer | null; | ||
declare current_allocation_id: string | null; | ||
declare last_allocation_id: string | null; | ||
} | ||
|
||
export interface IndexingFeesModels { | ||
IndexingAgreement: typeof IndexingAgreement | ||
} | ||
|
||
export const defineIndexingFeesModels = (sequelize: Sequelize): IndexingFeesModels => { | ||
IndexingAgreement.init( | ||
{ | ||
id: { | ||
type: DataTypes.UUID, | ||
primaryKey: true, | ||
}, | ||
signature: { | ||
type: DataTypes.BLOB, // == BYTEA in postgres | ||
allowNull: false, | ||
}, | ||
signed_payload: { | ||
type: DataTypes.BLOB, // == BYTEA in postgres | ||
allowNull: false, | ||
}, | ||
protocol_network: { | ||
type: DataTypes.STRING(255), | ||
allowNull: false, | ||
}, | ||
chain_id: { | ||
type: DataTypes.STRING(255), | ||
allowNull: false, | ||
}, | ||
price_per_block: { | ||
type: DataTypes.DECIMAL(39), | ||
allowNull: false, | ||
}, | ||
price_per_entity: { | ||
type: DataTypes.DECIMAL(39), | ||
allowNull: false, | ||
}, | ||
subgraph_deployment_id: { | ||
type: DataTypes.STRING(255), | ||
allowNull: false, | ||
}, | ||
service: { | ||
type: DataTypes.CHAR(40), | ||
allowNull: false, | ||
}, | ||
payee: { | ||
type: DataTypes.CHAR(40), | ||
allowNull: false, | ||
}, | ||
payer: { | ||
type: DataTypes.CHAR(40), | ||
allowNull: false, | ||
}, | ||
created_at: { | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
}, | ||
updated_at: { | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
}, | ||
cancelled_at: { | ||
type: DataTypes.DATE, | ||
allowNull: true, | ||
}, | ||
signed_cancellation_payload: { | ||
type: DataTypes.BLOB, | ||
allowNull: true, | ||
}, | ||
current_allocation_id: { | ||
type: DataTypes.CHAR(40), | ||
allowNull: true, | ||
}, | ||
last_allocation_id: { | ||
type: DataTypes.CHAR(40), | ||
allowNull: true, | ||
}, | ||
}, | ||
{ | ||
modelName: 'IndexingAgreement', | ||
sequelize, | ||
}, | ||
) | ||
|
||
return { | ||
['IndexingAgreement']: IndexingAgreement, | ||
} | ||
} |
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