-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Test Community Migrations and Modify Chain Model (#1150)
* add yearn and fei as chains * modify chain model * add migration * add icons
- Loading branch information
Showing
6 changed files
with
89 additions
and
5 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,11 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.addColumn('Chains', 'snapshot', { type: Sequelize.STRING }); | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.removeColumn('Chains', 'snapshot'); | ||
} | ||
}; |
70 changes: 70 additions & 0 deletions
70
server/migrations/20210426074254-add_yearn_and_fei_chains.js
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,70 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.bulkInsert('Chains', [{ | ||
id: 'yearn', | ||
symbol: 'YFI', | ||
name: 'Yearn', | ||
icon_url: '/static/img/protocols/yearn.png', | ||
type: 'token', | ||
network: 'yearn', | ||
active: true, | ||
description: 'A general-purpose confidential smart contract platform for DApps and DeFi.', | ||
telegram: 'https://t.me/yearnfinance', | ||
website: 'https://yearn.finance', | ||
discord: 'http://discord.yearn.finance', | ||
github: 'https://github.com/iearn-finance', | ||
collapsed_on_homepage: false, | ||
base: 'ethereum', | ||
snapshot: 'ybaby.eth' | ||
}, { | ||
id: 'fei', | ||
symbol: 'FEI', | ||
name: 'fei', | ||
icon_url: '/static/img/protocols/fei.png', | ||
type: 'token', | ||
network: 'fei', | ||
active: true, | ||
description: 'The stablecoin for DeFi.', | ||
telegram: 'https://t.me/feiprotocol', | ||
website: 'https://fei.money/', | ||
discord: 'https://discord.com/invite/2prhYdQ5jP', | ||
github: 'https://github.com/fei-protocol/fei-protocol-core', | ||
collapsed_on_homepage: false, | ||
base: 'ethereum', | ||
snapshot: 'fei.eth' | ||
} | ||
], { transaction: t }); | ||
|
||
await queryInterface.bulkInsert('ChainNodes', [{ | ||
chain: 'yearn', | ||
url: 'wss://mainnet.infura.io/ws', | ||
}, { | ||
chain: 'fei', | ||
url: 'wss://mainnet.infura.io/ws', | ||
}], { transaction: t }); | ||
}); | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.bulkDelete('OffchainReactions', { chain: 'yearn' }, { transaction: t }); | ||
await queryInterface.bulkDelete('OffchainComments', { chain: 'yearn' }, { transaction: t }); | ||
await queryInterface.bulkDelete('OffchainThreads', { chain: 'yearn' }, { transaction: t }); | ||
await queryInterface.bulkDelete('Addresses', { chain: 'yearn' }, { transaction: t }); | ||
await queryInterface.bulkDelete('ChainEventTypes', { chain: 'yearn' }, { transaction: t }); | ||
await queryInterface.bulkDelete('ChainNodes', { chain: 'yearn' }, { transaction: t }); | ||
await queryInterface.bulkDelete('Chains', { id: ['yearn'] }, { transaction: t }); | ||
|
||
await queryInterface.bulkDelete('OffchainReactions', { chain: 'fei' }, { transaction: t }); | ||
await queryInterface.bulkDelete('OffchainComments', { chain: 'fei' }, { transaction: t }); | ||
await queryInterface.bulkDelete('OffchainThreads', { chain: 'fei' }, { transaction: t }); | ||
await queryInterface.bulkDelete('Addresses', { chain: 'fei' }, { transaction: t }); | ||
await queryInterface.bulkDelete('ChainEventTypes', { chain: 'fei' }, { transaction: t }); | ||
await queryInterface.bulkDelete('ChainNodes', { chain: 'fei' }, { transaction: t }); | ||
await queryInterface.bulkDelete('Chains', { id: ['fei'] }, { transaction: t }); | ||
}); | ||
} | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.