-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* coingecko database addition * ft: adding cron jobs to increase cache hit ratio for oracle data (#157) * ft: adding cron jobs to increase cache hit ratio for oracle data * update version * changes to make native oracle calls only for chainlink * Fix/arb token (#158) * fix for arb token in multi token paymaster * update cron expression for erc20 oracle update cron * comment and version update * Pro 2857 (#153) (#159) * Pro 2857 (#153) * ft: adding support for verifying paymaster * update: package.json version * fix: changing names for mode, minor fix for entry point error message * changes: common whitelist endpoints for v1/v2, removed v2 endpoints for whitelist * adding changelog for backend * chnages: version change, minor response changes for metadata and add stake routes * coingecko database addition * merge bug fixes * updated version * added required env vars to demo env * changed to pro key * changes done as requested * changes to retain v2 endpoints, minor changes for change log * updated changelog --------- Co-authored-by: Nikhil Kumar <[email protected]> Co-authored-by: nikhil kumar <[email protected]>
- Loading branch information
1 parent
ccacb0b
commit 7a2d589
Showing
19 changed files
with
1,038 additions
and
323 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
55 changes: 55 additions & 0 deletions
55
backend/migrations/2024123000001-create-coingecko-tokens.cjs
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,55 @@ | ||
const { Sequelize } = require('sequelize') | ||
|
||
async function up({ context: queryInterface }) { | ||
await queryInterface.createTable('coingecko_tokens', { | ||
"ID": { | ||
type: Sequelize.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
allowNull: false | ||
}, | ||
"TOKEN": { | ||
allowNull: false, | ||
primaryKey: false, | ||
type: Sequelize.TEXT | ||
}, | ||
"ADDRESS": { | ||
type: Sequelize.STRING, | ||
allowNull: false | ||
}, | ||
"CHAIN_ID": { | ||
type: Sequelize.BIGINT, | ||
allowNull: false | ||
}, | ||
"COIN_ID": { | ||
type: Sequelize.STRING, | ||
allowNull: false, | ||
primaryKey: true | ||
}, | ||
"DECIMALS": { | ||
type: Sequelize.INTEGER, | ||
allowNull: false, | ||
}, | ||
"CREATED_AT": { | ||
type: Sequelize.DATE, | ||
allowNull: false, | ||
defaultValue: Sequelize.NOW | ||
}, | ||
"UPDATED_AT": { | ||
type: Sequelize.DATE, | ||
allowNull: false, | ||
defaultValue: Sequelize.NOW | ||
} | ||
}, { | ||
schema: process.env.DATABASE_SCHEMA_NAME | ||
}); | ||
} | ||
|
||
async function down({ context: queryInterface }) { | ||
await queryInterface.dropTable({ | ||
tableName: 'coingecko_tokens', | ||
schema: process.env.DATABASE_SCHEMA_NAME | ||
}); | ||
} | ||
|
||
module.exports = { up, down } |
76 changes: 76 additions & 0 deletions
76
backend/migrations/20241231000001-default_coingecko_tokens.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
backend/migrations/20250106065640-add-vp7-contracts-to-default-key.cjs
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,32 @@ | ||
require('dotenv').config(); | ||
|
||
const vp7Contracts = JSON.stringify({ | ||
31: "0x805650ce74561C85baA44a8Bd13E19633Fd0F79d", | ||
50: "0xABA00E929d66119A4A7F4B2E27150fC387ee801c", | ||
51: "0x2b7cBFA523E0D0546C6d1F706b79dB7B6d910bdA", | ||
97: "0xD9A97785a91086FDeF17980eDC2f9D290d71153F", | ||
114: "0x5952653F151e844346825050d7157A9a6b46A23A", | ||
123: "0xf6E4486156cc2F982eceC15a90B23047F396EcBE", | ||
5003: "0x42963C58DE382D34CB5a7f77b703e645FcE6DD26", | ||
80002: "0x9ddB9DC20E904206823184577e9C571c713d2c57", | ||
84532: "0xD9A97785a91086FDeF17980eDC2f9D290d71153F", | ||
421614: "0x5FD81CfCAa69F44B6d105795961b3E484ac9e7dB", | ||
534351: "0xD9A97785a91086FDeF17980eDC2f9D290d71153F", | ||
11155111: "0x8B57f6b24C7cd85007068Bf0587382804B225DB6", | ||
11155420: "0x51a62e2B1E295CAe7Db5b91886735f9Ce335AcFB", | ||
28122024: "0xc95A2Fb019445C9B3459c2C59e7cd6Ad2c8FBb1E" | ||
}); | ||
|
||
async function up({ context: queryInterface }) { | ||
await queryInterface.sequelize.query( | ||
`UPDATE ${process.env.DATABASE_SCHEMA_NAME}."api_keys" SET "VERIFYING_PAYMASTERS_V2"='${vp7Contracts}' WHERE "API_KEY"='arka_public_key'` | ||
); | ||
} | ||
|
||
async function down({ context: queryInterface }) { | ||
await queryInterface.sequelize.query( | ||
`UPDATE ${process.env.DATABASE_SCHEMA_NAME}."api_keys" SET "VERIFYING_PAYMASTERS_V2"=${null} WHERE "API_KEYS"='arka_public_key'` | ||
); | ||
} | ||
|
||
module.exports = {up, down}; |
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { Sequelize, DataTypes, Model } from 'sequelize'; | ||
|
||
export class CoingeckoTokens extends Model { | ||
public id!: number; // Note that the `null assertion` `!` is required in strict mode. | ||
public token!: string; | ||
public address!: string; | ||
public chainId!: number; | ||
public coinId!: string; | ||
public decimals!: string; | ||
public readonly createdAt!: Date; | ||
public readonly updatedAt!: Date; | ||
} | ||
|
||
const initializeCoingeckoModel = (sequelize: Sequelize, schema: string) => { | ||
CoingeckoTokens.init({ | ||
id: { | ||
type: DataTypes.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
allowNull: false, | ||
field: 'ID' | ||
}, | ||
token: { | ||
type: DataTypes.TEXT, | ||
allowNull: false, | ||
primaryKey: true, | ||
field: 'TOKEN' | ||
}, | ||
address: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
field: 'ADDRESS' | ||
}, | ||
chainId: { | ||
type: DataTypes.BIGINT, | ||
allowNull: false, | ||
field: 'CHAIN_ID', | ||
get() { | ||
const value = this.getDataValue('chainId'); | ||
return +value; | ||
} | ||
}, | ||
coinId: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
primaryKey: true, | ||
field: 'COIN_ID' | ||
}, | ||
decimals: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
field: 'DECIMALS' | ||
}, | ||
createdAt: { | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW, | ||
field: 'CREATED_AT' | ||
}, | ||
updatedAt: { | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW, | ||
field: 'UPDATED_AT' | ||
}, | ||
}, { | ||
sequelize, | ||
tableName: 'coingecko_tokens', | ||
modelName: 'CoingeckoTokens', | ||
timestamps: true, | ||
createdAt: 'createdAt', | ||
updatedAt: 'updatedAt', | ||
freezeTableName: true, | ||
schema: schema, | ||
}); | ||
}; | ||
|
||
export { initializeCoingeckoModel }; |
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.