Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions backend/migrations/2025073000001-seed-data.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require('dotenv').config();
const ethers = require('ethers');

async function up({ context: queryInterface }) {
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xdAC17F958D2ee523a2206206994597C13D831ec7')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x3E7d1eAB13ad0104d2750B8863b489D65364e32D', 1, 6, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6', 1, 6, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0x514910771AF9Ca656af840dff83E8264EcF986CA')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c', 1, 18, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xB8c77482e45F1F44dE1745F52C74426C631bDD52')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x14e613AC84a31f709eadbdF89C6CC390fDc9540A', 1, 18, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x31697852a68433DbCc2Ff612c516d69E3D9bd08F', 1, 18, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0xBAEbEFc1D023c0feCcc047Bff42E75F15Ff213E6', 1, 18, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x7bAC85A8a13A4BcD8abb3eB7d6b4d632c5a57676', 1, 18, NOW(), NOW(), 'EPV_07')`);
Comment on lines +5 to +11
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Paymaster address mismatch with constants file.

The paymaster address 0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990 used in this migration differs from the one defined in MultiTokenPaymasterCronJob.ts for chain 1 (0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5). This inconsistency could lead to issues.

Please verify which address is correct and ensure consistency across all files.

🤖 Prompt for AI Agents
In backend/migrations/2025073000001-seed-data.cjs around lines 5 to 11, the
paymaster address used in the INSERT statements does not match the paymaster
address defined in MultiTokenPaymasterCronJob.ts for chain 1. Verify the correct
paymaster address and update all occurrences in this migration file to use the
consistent, correct address matching the constants file to avoid discrepancies.

}

async function down({ context: queryInterface }) {
await queryInterface.sequelize.query(`DELETE IF EXISTS FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
}
Comment on lines +14 to +16
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix SQL syntax error in DELETE statement.

The SQL syntax is incorrect. DELETE IF EXISTS is not valid SQL syntax.

-    await queryInterface.sequelize.query(`DELETE IF EXISTS FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
+    await queryInterface.sequelize.query(`DELETE FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async function down({ context: queryInterface }) {
await queryInterface.sequelize.query(`DELETE IF EXISTS FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
}
async function down({ context: queryInterface }) {
await queryInterface.sequelize.query(`DELETE FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
}
🤖 Prompt for AI Agents
In backend/migrations/2025073000001-seed-data.cjs around lines 14 to 16, the SQL
statement uses invalid syntax "DELETE IF EXISTS". Replace this with a valid SQL
DELETE statement, such as "DELETE FROM" without "IF EXISTS". If conditional
deletion is needed, consider using a WHERE clause or check existence in
application logic before deletion.


module.exports = { up, down }
Loading
Loading