Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Release #412

Merged
merged 31 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
76ccb90
feat(webapp): display current distribution rate
warnerHurtado Jan 10, 2023
16b35f6
fix(webapp): make requested changes on line chart
JAMares Jan 11, 2023
c903499
Merge branch 'dev' into feat/display-current-distribution-rate-369
warnerHurtado Jan 11, 2023
6836b2e
fix(webapp): fixed showed data on x axis
JAMares Jan 11, 2023
d750d95
fix(webapp): fixed by mobile version
JAMares Jan 11, 2023
69022c5
fix(webapp): add missing validation
JAMares Jan 11, 2023
bdb73b3
Merge pull request #403 from edenia/fix/bug-aat-is-not-a-function-app…
JAMares Jan 11, 2023
3b30188
Merge pull request #402 from edenia/fix/v2-check-the-margin-spaces-ch…
xavier506 Jan 11, 2023
398506e
fix(webapp): election 1 already appear
warnerHurtado Jan 12, 2023
9d069fc
fix(webapp): change text traslation
warnerHurtado Jan 12, 2023
952bf7e
fix(webapp) solving conflicts
warnerHurtado Jan 12, 2023
b7d528d
fix(webapp): negative results in chart
warnerHurtado Jan 12, 2023
43a9827
fix(webapp): NaN values in table
warnerHurtado Jan 12, 2023
b6d8f30
fix(webapp): delete console.log
warnerHurtado Jan 12, 2023
ac884e4
feat(webapp): add prefill memo to description
JAMares Jan 12, 2023
2bbeb84
feat(contract): add new digest param
warnerHurtado Jan 12, 2023
d0cf905
Merge pull request #394 from edenia/feat/display-current-distribution…
JAMares Jan 13, 2023
3c32038
fix(webapp): update recategorize expend tool for the new feature
warnerHurtado Jan 13, 2023
23b6846
fix(hapi) uncomment functions
warnerHurtado Jan 13, 2023
d4d3af0
Merge pull request #405 from edenia/feat/pre-fill-the-memo-append-act…
JAMares Jan 13, 2023
cc2341b
Merge branch 'dev' into fix/check-the-number-TXs-396
warnerHurtado Jan 13, 2023
54dd075
Merge pull request #406 from edenia/fix/check-the-number-TXs-396
JAMares Jan 13, 2023
31bc307
Merge pull request #404 from edenia/fix/negative-expense-400
JAMares Jan 13, 2023
4efb826
fix(webapp): add missing variable
JAMares Jan 13, 2023
8a18f5f
Merge pull request #408 from edenia/fix/missing-declaration
warnerHurtado Jan 13, 2023
c1fdca8
fix(webapp): fix recategorize error
warnerHurtado Jan 13, 2023
3e00aa4
Merge pull request #410 from edenia/fix/recategorize-error-409
JAMares Jan 14, 2023
7002b77
Delete postgres Database for begin again
fagomezra Jan 16, 2023
b2cbce7
Merge pull request #413 from edenia/delete-bd-postgres
fagomezra Jan 16, 2023
db177e7
feat(webapp): traslate next distribution text
warnerHurtado Jan 16, 2023
35b1d28
Merge pull request #416 from edenia/feat/traslate-next-distribution-t…
xavier506 Jan 16, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/push-dev-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
IMAGE_NAME_HAPI: eden-spending-hapi-dev
IMAGE_NAME_HASURA: eden-spending-hasura-dev
IMAGE_NAME_WALLET: eden-spending-wallet-dev
# Postgres-0
# Postgres
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-prod-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
HAPI_DFUSE_API_KEY: ${{secrets.HAPI_DFUSE_API_KEY}}
HAPI_DFUSE_API: eos.dfuse.eosnation.io
HAPI_DFUSE_FIRST_BLOCK: 209174091
HAPI_DFUSE_FIRST_TREASURY_BLOCK: 183728436
HAPI_DFUSE_FIRST_TREASURY_BLOCK: 205528491
# hasura
HASURA_GRAPHQL_ENABLE_CONSOLE: true
HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }}
Expand Down
5 changes: 3 additions & 2 deletions contract/edenexplorer/include/edenexplorer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ namespace eden {

void categorize( eosio::name account,
std::string &new_memo,
std::string &tx_id );
std::string &tx_id,
std::string &digest );

bool parse_memo( std::string &memo );

Expand All @@ -35,6 +36,6 @@ namespace eden {

EOSIO_ACTIONS( edenexplorer_contract,
"edenexplorer"_n,
action( categorize, account, new_memo, tx_id ) )
action( categorize, account, new_memo, tx_id, digest ) )

} // namespace eden
4 changes: 3 additions & 1 deletion contract/edenexplorer/src/edenexplorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace eden {

void edenexplorer_contract::categorize( eosio::name account,
std::string &new_memo,
std::string &tx_id ) {
std::string &tx_id,
std::string &digest ) {
require_auth( account );

eosio::action{ { get_self(), "active"_n },
Expand All @@ -20,6 +21,7 @@ namespace eden {
"Incorrect format or category, use: 'eden_expense: "
"<category>/<description>'" );
eosio::check( tx_id.length() == 64, "Incorrect length transaction id" );
eosio::check( digest.length() == 64, "Incorrect length digest id" );
}

bool edenexplorer_contract::exist_category( std::string &category_name ) {
Expand Down
19 changes: 18 additions & 1 deletion contract/edenexplorer/tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ TEST_CASE( "Require to be an eden member" ) {
tester t;

expect( t.edenexplorer.trace< eden::actions::categorize >( "alice"_n,
"testing",
"testing",
"testing" ),
"missing authority of alice" );
Expand All @@ -16,6 +17,7 @@ TEST_CASE( "Requiere the right memo format" ) {
tester t;

expect( t.edenexplorer.trace< eden::actions::categorize >( "edenexplorer"_n,
"testing",
"testing",
"testing" ),
"assertion failure with message: Incorrect format or category, use: "
Expand All @@ -28,6 +30,7 @@ TEST_CASE( "Requiere a right category" ) {
expect( t.edenexplorer.trace< eden::actions::categorize >(
"edenexplorer"_n,
"eden_expense: testing/expense for pay EOSIO developers",
"testing",
"testing" ),
"assertion failure with message: Incorrect format or category, use: "
"'eden_expense: <category>/<description>'" );
Expand All @@ -39,15 +42,29 @@ TEST_CASE( "Requiere the right length for tx_id" ) {
expect( t.bob.trace< eden::actions::categorize >(
"bob"_n,
"eden_expense: development/expense for pay EOSIO developers",
"testing",
"testing" ),
"assertion failure with message: Incorrect length transaction id" );
}

TEST_CASE( "Requiere the right length for digest" ) {
tester t;

expect(
t.bob.trace< eden::actions::categorize >(
"bob"_n,
"eden_expense: development/expense for pay EOSIO developers",
"96dda25da00b945e5b696a8a4b01453c97973c78dc766a885b73e28bd42f6cc5",
"testing" ),
"assertion failure with message: Incorrect length digest id" );
}

TEST_CASE( "Succes action" ) {
tester t;

expect( t.bob.trace< eden::actions::categorize >(
"bob"_n,
"eden_expense: infrastructure/expense for pay EOSIO developers",
"96dda25da00b945e5b696a8a4b01453c97973c78dc766a885b73e28bd42f6cc5" ) );
"96dda25da00b945e5b696a8a4b01453c97973c78dc766a885b73e28bd42f6cc5",
"f3f57eaf6efe030d6af4c77818daec081e505fde4c2b15cfdad950f636400b8b" ) );
}
1 change: 1 addition & 0 deletions hapi/src/gql/eden-transaction.gql.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const get = async (where, getMany = false) => {
txid
type
updated_at
digest
}
}
`
Expand Down
3 changes: 1 addition & 2 deletions hapi/src/services/dfuse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ const runUpdaters = async actions => {

await updater.apply({
transaction_id: id,
json: matchingAction.json,
timestamp,
ation: matchingAction.name,
election: edenElectionId,
action: matchingAction,
updater
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ module.exports = {
type: 'edenexplorer:categorize',
apply: async action => {
try {
const { new_memo, tx_id, account } = action.json
const { new_memo, tx_id, account, digest = undefined } = action.json
const [, memo] = new_memo?.split(':') || ''

if (!memo) return

const { category, description } = updaterUtil.memoSplit(memo)
const transactionToEditQuery = {
txid: { _eq: tx_id },
type: { _eq: 'expense' },
eden_election: { eden_delegate: { account: { _eq: account } } }
...(digest && { digest: { _eq: digest } })
}

const transactionToEdit = await edenTransactionGql.get(
Expand All @@ -34,7 +33,7 @@ module.exports = {
const updateQuery = {
where: {
id: { _eq: transactionToEdit.id },
type: { _eq: 'expense' }
...(digest && { digest: { _eq: digest } })
},
_set: { category, description, id_election }
}
Expand Down
28 changes: 21 additions & 7 deletions hapi/src/services/dfuse/updaters/eosiotoken-transfer.updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,31 @@ let LASTEST_RATE_DATA_CONSULTED = null
module.exports = {
type: `eosio.token:transfer`,
apply: async action => {
const { quantity, memo, to, from } = action.json
const { quantity, memo, to, from } = action.action.json
const amount = Number(quantity.split(' ')[0] || 0)

const registeredTransaction = await edenTransactionGql.get({
txid: { _eq: action.transaction_id },
amount: { _eq: amount },
memo: { _eq: memo },
recipient: { _eq: to },
type: { _eq: 'expense' }
digest: { _eq: action.action.receipt.digest }
})

if (registeredTransaction) return

const registeredTxWithoutDigest = await edenTransactionGql.get({
txid: { _eq: action.transaction_id },
digest: { _eq: action.transaction_id }
})

if (registeredTxWithoutDigest) {
await edenTransactionGql.update({
where: {
id: { _eq: registeredTxWithoutDigest.id }
},
_set: { digest: action.action.receipt.digest }
})
return
}

let { category, description } = updaterUtil.memoSplit(
memo.split(':')[1] || ''
)
Expand Down Expand Up @@ -72,12 +84,14 @@ module.exports = {
type: 'expense',
eos_exchange: LASTEST_RATE_DATA_CONSULTED,
usd_total: amount * LASTEST_RATE_DATA_CONSULTED,
memo: memo
digest: action.action.receipt.digest
}

await edenTransactionGql.save(transactionData)
} catch (error) {
console.error(`transfer sync error ${action.action}: ${error.message}`)
console.error(
`transfer sync error ${action.action.name}: ${error.message}`
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ module.exports = {
type: `${edenConfig.edenContract}:fundtransfer`,
apply: async action => {
try {
const { amount: quantity, from, distribution_time, rank } = action.json
const {
amount: quantity,
from,
distribution_time,
rank
} = action.action.json
const amount = Number(quantity.split(' ')[0])

const existTx = await edenTransactionGql.get({
Expand Down Expand Up @@ -72,13 +77,13 @@ module.exports = {
const newAmount = existUnclaimedTx.amount - amount

if (newAmount <= 0) {
await deleteTx({
await edenTransactionGql.deleteTx({
where: {
id: { _eq: existUnclaimedTx.id }
}
})
} else {
await update({
await edenTransactionGql.update({
where: {
id: { _eq: existUnclaimedTx.id }
},
Expand All @@ -95,7 +100,7 @@ module.exports = {
}
} catch (error) {
console.error(
`fundtransfer sync error ${action.action}: ${error.message}`
`fundtransfer sync error ${action.action.action.name}: ${error.message}`
)
}
}
Expand Down
3 changes: 3 additions & 0 deletions hapi/src/utils/dfuse.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const getfundTransferQuery = ({ query, lowBlockNum }) => {
}
id
matchingActions {
receipt {
digest
}
account
name
json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ insert_permissions:
permission:
check: {}
columns:
- amount
- category
- created_at
- date
- description
- memo
- digest
- eos_exchange
- id
- id_election
- recipient
- txid
- type
- amount
- eos_exchange
- usd_total
- created_at
- date
- updated_at
- id
- id_election
- usd_total
select_permissions:
- role: guest
permission:
Expand All @@ -33,10 +33,10 @@ select_permissions:
- created_at
- date
- description
- digest
- eos_exchange
- id
- id_election
- memo
- recipient
- txid
- type
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."eden_transaction" add column "digest" varchar
-- null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."eden_transaction" add column "digest" varchar
null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment on column "public"."eden_transaction"."memo" is E'Eden Transaction Accounting Standard';
alter table "public"."eden_transaction" alter column "memo" drop not null;
alter table "public"."eden_transaction" add column "memo" varchar;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."eden_transaction" drop column "memo" cascade;
18 changes: 9 additions & 9 deletions webapp/src/components/BarChartReport/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const BarChartReport = ({
const { t } = useTranslation()
const [selectedUSD, setSelected] = useState(false)
const [coinType, setCoinType] = useState('EOS')
const width = window.innerWidth

const handleChange = event => {
setSelected(event.target.checked)
Expand Down Expand Up @@ -166,12 +167,7 @@ const BarChartReport = ({
</div>
</div>
<div className={classes.chartContainer}>
<ResponsiveContainer
minWidth={600}
width="100%"
height={300}
marginTop="16px"
>
<ResponsiveContainer width="100%" height={300} marginTop="16px">
<ComposedChart height={300} data={data} ref={barRef}>
<CartesianGrid stroke="#f0f0f0" />
<XAxis
Expand All @@ -197,7 +193,7 @@ const BarChartReport = ({
)}
<Bar
dataKey={`${coinType}_UN${category.toLocaleUpperCase()}`}
barSize={35}
barSize={width > 600 ? 35 : 15}
fill="#f4d35e"
>
{data.map(({ election }) => (
Expand All @@ -206,14 +202,18 @@ const BarChartReport = ({
</Bar>
<Bar
dataKey={`${coinType}_${category.toLocaleUpperCase()}`}
barSize={35}
barSize={width > 600 ? 35 : 15}
fill="#ee964b"
>
{data.map(({ election }) => (
<Cell key={`cell-${election}`} />
))}
</Bar>
<Bar dataKey={`${coinType}_TOTAL`} barSize={35} fill="#19647e">
<Bar
dataKey={`${coinType}_TOTAL`}
barSize={width > 600 ? 35 : 15}
fill="#19647e"
>
{data.map(({ election }) => (
<Cell key={`cell-${election}`} />
))}
Expand Down
10 changes: 8 additions & 2 deletions webapp/src/components/BarChartReport/styles.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
export default theme => ({
root: {
margin: theme.spacing(6, 6, 6, 6)
margin: theme.spacing(6, 6, 6, 6),
[theme.breakpoints.down('sm')]: {
margin: theme.spacing(6, 1, 6, 1)
}
},
chartContainer: {
whiteSpace: 'nowrap',
overflowY: 'hidden'
overflowY: 'hidden',
[theme.breakpoints.down('sm')]: {
overflowX: 'hidden'
}
},
title: {
'& span': {
Expand Down
Loading