Skip to content

Commit

Permalink
Merge pull request #155 from bitholla/testnet
Browse files Browse the repository at this point in the history
HollaEx Kit v1.5.0 Release
  • Loading branch information
kycfeel authored May 26, 2020
2 parents 140a9e5 + 16580b6 commit 0eb2f38
Show file tree
Hide file tree
Showing 107 changed files with 6,411 additions and 23,593 deletions.
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM bitholla/hollaex-core:1.22.0

RUN apt-get update && apt-get install -y git
FROM bitholla/hollaex-core:1.23.1

COPY ./mail /app/mail

Expand All @@ -12,8 +10,6 @@ COPY ./db/seeders /app/db/seeders

COPY ./db/models /app/db/models

EXPOSE 10011

RUN npm install -g nodemon --loglevel=error && \
cd plugins && npm install --loglevel=error && \
for d in ./*/ ; do (cd "$d" && npm install --loglevel=error); done && \
Expand Down
25 changes: 25 additions & 0 deletions db/migrations/20200402042047-add-deposits-flags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

const TABLE = 'Deposits';
const COLUMN1 = 'processing';
const COLUMN2 = 'waiting';

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface
.addColumn(TABLE, COLUMN1, {
type: Sequelize.BOOLEAN,
defaultValue: false
})
.then(() => {
return queryInterface.addColumn(TABLE, COLUMN2, {
type: Sequelize.BOOLEAN,
defaultValue: false
});
});
},
down: (queryInterface) => {
return queryInterface.removeColumn(TABLE, COLUMN1)
.then(() => queryInterface.removeColumn(TABLE, COLUMN2));
}
};
56 changes: 56 additions & 0 deletions db/migrations/20200511023924-create-announcement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
'use strict';

const TABLE = 'Announcements';

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable(
TABLE,
{
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
created_by: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
allowNull: false,
references: {
model: 'Users',
key: 'id'
}
},
title: {
type: Sequelize.STRING,
allowNull: false
},
message: {
type: Sequelize.TEXT,
allowNull: false
},
type: {
type: Sequelize.STRING,
allowNull: false,
defaultValue: 'info'
},
created_at: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: Sequelize.literal('NOW()')
},
updated_at: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: Sequelize.literal('NOW()')
}
},
{
timestamps: true,
underscored: true
}
);
},
down: (queryInterface) => queryInterface.dropTable(TABLE)
};
32 changes: 32 additions & 0 deletions db/migrations/20200518080849-add-user-affiliation_rate-discount.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

const TABLE = 'Users';
const COLUMN1 = 'affiliation_rate';
const COLUMN2 = 'discount';

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
TABLE,
COLUMN1,
{
type: Sequelize.DOUBLE,
defaultValue: 0,
})
.then(() => {
return queryInterface.addColumn(
TABLE,
COLUMN2,
{
type: Sequelize.DOUBLE,
defaultValue: 0,
});
});
},
down: (queryInterface) => {
return queryInterface.removeColumn(TABLE, COLUMN1)
.then(() => {
return queryInterface.removeColumn(TABLE, COLUMN2);
});
},
};
16 changes: 16 additions & 0 deletions db/models/affiliation.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,21 @@ module.exports = function(sequelize, DataTypes) {
underscored: true
}
);

Affiliation.associate = (models) => {
Affiliation.belongsTo(models.User, {
as: 'user',
foreignKey: 'user_id',
targetKey: 'id',
onDelete: 'CASCADE',
});
Affiliation.belongsTo(models.User, {
as: 'referer',
foreignKey: 'referer_id',
targetKey: 'id',
onDelete: 'CASCADE',
});
};

return Affiliation;
};
40 changes: 40 additions & 0 deletions db/models/announcement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = function(sequelize, DataTypes) {
const Announcement = sequelize.define(
'Announcement',
{
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: DataTypes.INTEGER
},
created_by: {
type: DataTypes.INTEGER,
onDelete: 'CASCADE',
allowNull: false,
references: {
model: 'Users',
key: 'id'
}
},
title: {
type: DataTypes.STRING,
allowNull: false
},
message: {
type: DataTypes.TEXT,
allowNull: false
},
type: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: 'info'
}
},
{
timestamps: true,
underscored: true
}
);
return Announcement;
};
8 changes: 8 additions & 0 deletions db/models/deposit.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ module.exports = function(sequelize, DataTypes) {
type: DataTypes.BOOLEAN,
defaultValue: false
},
processing: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
waiting: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
description: {
type: DataTypes.STRING,
defaultValue: ''
Expand Down
2 changes: 2 additions & 0 deletions db/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ model = sequelize.import('status', require('./status'));
db[model.name] = model;
model = sequelize.import('fee', require('./fee'));
db[model.name] = model;
model = sequelize.import('announcement', require('./announcement'));
db[model.name] = model;

Object.keys(db).forEach(function(modelName) {
if ('associate' in db[modelName]) {
Expand Down
15 changes: 14 additions & 1 deletion db/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ module.exports = function(sequelize, DataTypes) {
custom_fee: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
affiliation_rate: {
type: DataTypes.DOUBLE,
defaultValue: 0
},
discount: {
type: DataTypes.DOUBLE,
defaultValue: 0
}
},
{
Expand Down Expand Up @@ -198,7 +206,12 @@ module.exports = function(sequelize, DataTypes) {
});
User.hasMany(models.OtpCode);
User.hasMany(models.Login);
User.hasMany(models.Affiliation);
User.hasMany(models.Affiliation, {
foreignKey: 'user_id'
});
User.hasMany(models.Affiliation, {
foreignKey: 'referer_id'
});
User.hasMany(models.Order);
User.hasMany(models.Trade, {
foreignKey: 'maker_id'
Expand Down
10 changes: 9 additions & 1 deletion db/seeders/20190825120350-add-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const {
SNS_SECRETACCESSKEY,
VAULT_KEY,
VAULT_SECRET,
ZENDESK_HOST,
ZENDESK_KEY,
FRESHDESK_HOST,
FRESHDESK_KEY,
FRESHDESK_AUTH,
Expand All @@ -46,6 +48,7 @@ const status = [{
constants: JSON.stringify({
api_name: API_NAME || '',
description: '',
color: {},
title: '',
links: {
twitter: '',
Expand Down Expand Up @@ -113,7 +116,8 @@ const status = [{
name: VAULT_NAME || '',
key: VAULT_KEY,
secret: VAULT_SECRET,
connected_coins: []
connected_coins: [],
cron_task_interval: 15
},
plugins: {
s3: {
Expand All @@ -136,6 +140,10 @@ const status = [{
host: FRESHDESK_HOST || '',
key: FRESHDESK_KEY || '',
auth: FRESHDESK_AUTH || ''
},
zendesk: {
host: ZENDESK_HOST || '',
key: ZENDESK_KEY || ''
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions mail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const sendEmail = (
case MAILTYPE.USER_VERIFICATION_REJECT:
case MAILTYPE.ACCOUNT_UPGRADE:
case MAILTYPE.ACCOUNT_VERIFY:
case MAILTYPE.INVALID_ADDRESS:
case MAILTYPE.USER_DEACTIVATED:
case MAILTYPE.WITHDRAWAL_REQUEST: {
to.BccAddresses = BCC_ADDRESSES();
Expand All @@ -70,6 +71,7 @@ const sendEmail = (
to.BccAddresses = BCC_ADDRESSES();
break;
}
case MAILTYPE.ALERT:
case MAILTYPE.SUSPICIOUS_DEPOSIT:
case MAILTYPE.USER_VERIFICATION:
case MAILTYPE.CONTACT_FORM: {
Expand Down
19 changes: 19 additions & 0 deletions mail/strings/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,23 @@ const WITHDRAWALREQUEST = {
CLOSING: COMMON.CLOSING
};

const INVALIDADDRESS = {
TITLE: 'Invalid Withdrawal Address',
GREETING: (name) => COMMON.GREETING(name),
BODY: {
1: (currency, amount) => `Your ${currency} withdrawal for ${amount} was being sent to an invalid address and is rejected.`,
2: (address) => `Address: ${address}`
},
CLOSING: COMMON.CLOSING
};

const ALERT = {
TITLE: (title) => `ALERT: ${title}`,
BODY: {
1: (type) => `Alert: ${type}`
}
};

const USERVERIFICATIONREJECT = {
TITLE: (type) =>
type === 'id'
Expand Down Expand Up @@ -272,7 +289,9 @@ module.exports = {
WITHDRAWALREQUEST,
USERVERIFICATION,
SUSPICIOUSDEPOSIT,
INVALIDADDRESS,
CONTACTFORM,
USERDEACTIVATED,
ALERT,
SMS
};
4 changes: 3 additions & 1 deletion mail/strings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const MAILTYPE = {
CONTACT_FORM: 'contactForm',
SUSPICIOUS_DEPOSIT: 'suspiciousDeposit',
USER_VERIFICATION: 'userVerification',
USER_DEACTIVATED: 'userDeactivated'
USER_DEACTIVATED: 'userDeactivated',
INVALID_ADDRESS: 'invalidAddress',
ALERT: 'alert'
};

const languageFile = (lang) => {
Expand Down
19 changes: 19 additions & 0 deletions mail/strings/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,23 @@ const WITHDRAWALREQUEST = {
CLOSING: COMMON.CLOSING
};

const INVALIDADDRESS = {
TITLE: 'Invalid Withdrawal Address',
GREETING: (name) => COMMON.GREETING(name),
BODY: {
1: (currency, amount) => `Your ${currency} withdrawal for ${amount} was being sent to an invalid address and is rejected.`,
2: (address) => `Address: ${address}`
},
CLOSING: COMMON.CLOSING
};

const ALERT = {
TITLE: (title) => `ALERT: ${title}`,
BODY: {
1: (type) => `Alert: ${type}`
}
};

const USERVERIFICATIONREJECT = {
TITLE: (type) =>
type === 'id' ? 'ID 인증 거절' : '새로운 은행정보 등록 거절',
Expand Down Expand Up @@ -267,7 +284,9 @@ module.exports = {
WITHDRAWALREQUEST,
USERVERIFICATION,
SUSPICIOUSDEPOSIT,
INVALIDADDRESS,
CONTACTFORM,
USERDEACTIVATED,
ALERT,
SMS
};
Loading

0 comments on commit 0eb2f38

Please sign in to comment.