diff --git a/solution.javascript b/solution.javascript new file mode 100644 index 0000000..5d6b5d7 --- /dev/null +++ b/solution.javascript @@ -0,0 +1,23 @@ +--- a/src/components/AddRemoveMarginModal/AddRemoveMarginModal.js ++++ b/src/components/AddRemoveMarginModal/AddRemoveMarginModal.js +@@ -12,16 +12,16 @@ class AddRemoveMarginModal extends Component { +
+

Add/Remove Margin

+

Current {action} margin: {formatCurrency(margin, { maximumFractionDigits: 2 })}

+

Available wallet balance: {formatCurrency(walletBalance, { maximumFractionDigits: 2 })}

+
+@@ -35,7 +35,7 @@ class AddRemoveMarginModal extends Component { + render() { + const { action, margin, walletBalance, formatCurrency } = this.props; + + return ( +
+

Add/Remove Margin

+-

Current {action} margin: {formatCurrency(margin, { maximumFractionDigits: 2 })}

+-

Available wallet balance: {formatCurrency(walletBalance, { maximumFractionDigits: 2 })}

++

Available margin: {formatCurrency(walletBalance, { maximumFractionDigits: 2 })}

++

Current {action} margin: {formatCurrency(margin, { maximumFractionDigits: 2 })}

++

Available wallet balance: {formatCurrency(walletBalance, { maximumFractionDigits: 2 })}

+
+ ); + } diff --git a/src/components/AddRemoveMarginModal.js b/src/components/AddRemoveMarginModal.js new file mode 100644 index 0000000..480423a --- /dev/null +++ b/src/components/AddRemoveMarginModal.js @@ -0,0 +1,21 @@ +import React, { useState, useEffect } from 'react'; +import { BigNumber, ethers } from 'ethers'; + +const AddRemoveMargin = ({ positionManager, userAddress, token }) => { + // Your solution would go here + return ( +
+

Add/Remove Margin

+
+ {positionManager && ( +
+

Position: {positionManager.id}

+

Wallet Balance: {positionManager.margin}

+

Available for removal: {positionManager.margin}

+
+ )} +
+
+ ); +}; +export default AddRemoveMargin; \ No newline at end of file diff --git a/src/components/Trading/Modals/AddRemoveMarginModal.js b/src/components/Trading/Modals/AddRemoveMarginModal.js new file mode 100644 index 0000000..e71faa5 --- /dev/null +++ b/src/components/Trading/Modals/AddRemoveMarginModal.js @@ -0,0 +1,2 @@ + "private": "false" +} \ No newline at end of file diff --git a/src/components/modals/AddRemoveMargin.svelte b/src/components/modals/AddRemoveMargin.svelte new file mode 100644 index 0000000..941a94e --- /dev/null +++ b/src/components/modals/AddRemoveMargin.svelte @@ -0,0 +1,59 @@ +