From 93f94320320c1d648b8a2d5f449ab07612dedcf8 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 5 Aug 2020 15:32:55 +0200 Subject: [PATCH] configurable market fee values --- .env.example | 4 +++- app.config.js | 4 +++- src/components/pages/Publish/index.tsx | 4 +++- src/hooks/useSiteMetadata.ts | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 77b9d04de..7a07fae82 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,6 @@ # Network, possible values: development, pacific, rinkeby, mainnet GATSBY_NETWORK="rinkeby" -#GATSBY_INFURA_PROJECT_ID="xxx" \ No newline at end of file +#GATSBY_INFURA_PROJECT_ID="xxx" +#GATSBY_MARKET_FEE_ADDRESS="0xxx" +#GATSBY_MARKET_FEE_AMOUNT="xxx" \ No newline at end of file diff --git a/app.config.js b/app.config.js index 9636066b9..eef68476a 100644 --- a/app.config.js +++ b/app.config.js @@ -15,7 +15,9 @@ const appConfig = { verbose: 3 }, network, - infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx' + infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx', + marketFeeAddress: process.env.GATSBY_MARKET_FEE_ADDRESS || '0xxxx', + marketFeeAmount: process.env.GATSBY_MARKET_FEE_AMOUNT || '0.03' // in % } module.exports = { diff --git a/src/components/pages/Publish/index.tsx b/src/components/pages/Publish/index.tsx index b9d0deade..c308bb3a6 100644 --- a/src/components/pages/Publish/index.tsx +++ b/src/components/pages/Publish/index.tsx @@ -11,12 +11,14 @@ import { initialValues, validationSchema } from '../../../models/FormPublish' import { transformPublishFormToMetadata } from './utils' import Preview from './Preview' import { MetadataPublishForm } from '../../../@types/MetaData' +import { useSiteMetadata } from '../../../hooks/useSiteMetadata' export default function PublishPage({ content }: { content: { form: FormContent } }): ReactElement { + const { marketFeeAmount } = useSiteMetadata() const { accountId, ocean } = useOcean() const { publish, publishError } = usePublish() const navigate = useNavigate() @@ -59,7 +61,7 @@ export default function PublishPage({ ddo.dataToken, tokensToMint.toString(), '9', - '0.03' + marketFeeAmount ) } } diff --git a/src/hooks/useSiteMetadata.ts b/src/hooks/useSiteMetadata.ts index acf0994cb..a0f6da708 100644 --- a/src/hooks/useSiteMetadata.ts +++ b/src/hooks/useSiteMetadata.ts @@ -16,6 +16,8 @@ const query = graphql` appConfig { infuraProjectId network + marketFeeAddress + marketFeeAmount } } }