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

Staging #259

Merged
merged 74 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
2b3a3cc
update bridge sdk
elclandestin0 Dec 9, 2024
8a63e3a
added multi-approval allowance modal
elclandestin0 Dec 9, 2024
10398ff
updates
elclandestin0 Dec 9, 2024
1d22da3
updates
elclandestin0 Dec 9, 2024
c65af36
multi approval
elclandestin0 Dec 10, 2024
01a0948
approve() -> approveNative()
elclandestin0 Dec 10, 2024
0296484
double allowance check
elclandestin0 Dec 10, 2024
3379546
checkpoint on allowance check
elclandestin0 Dec 10, 2024
97b28e5
change nativebalance to lownetwork
elclandestin0 Dec 10, 2024
1a63cdd
log allowance
elclandestin0 Dec 11, 2024
4237c91
working
elclandestin0 Dec 11, 2024
648e643
testing l2->l3
elclandestin0 Dec 11, 2024
99b1f08
fix error
elclandestin0 Dec 11, 2024
ec9085c
Merge pull request #243 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 11, 2024
7279a4d
show usdc again
elclandestin0 Dec 11, 2024
0f68668
fix error
elclandestin0 Dec 11, 2024
34f242f
Merge pull request #244 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 11, 2024
d6a416e
flow working well
elclandestin0 Dec 11, 2024
355c123
massive updates
elclandestin0 Dec 11, 2024
50fefc2
Merge pull request #245 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 11, 2024
372b667
fix allowance selector and currenttokenindex
elclandestin0 Dec 12, 2024
74b79e4
Merge pull request #246 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 12, 2024
4c29d42
fix allowance selector
elclandestin0 Dec 12, 2024
b13bffa
remove logs
elclandestin0 Dec 12, 2024
3733633
Merge pull request #247 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 12, 2024
13e3d96
added filter and change tx summary
elclandestin0 Dec 12, 2024
bcbfa75
ready for demo
elclandestin0 Dec 12, 2024
ddd89d6
Merge pull request #249 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 12, 2024
dd265ce
added new hook
elclandestin0 Dec 13, 2024
c08d037
deposit / withdrawal flow on testnet looking a-ok
elclandestin0 Dec 13, 2024
dfd8303
Merge pull request #250 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 13, 2024
6173edb
update with gas fees
elclandestin0 Dec 13, 2024
6fbb53d
Merge pull request #251 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 13, 2024
b3b1a0f
fix bug of setting init. amount
elclandestin0 Dec 16, 2024
aa8fbbb
Merge pull request #252 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 16, 2024
4e64a0f
fix errors on approval flow
elclandestin0 Dec 16, 2024
d68098d
Merge pull request #253 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 16, 2024
7ab68c8
fix bug allowancesverified
elclandestin0 Dec 16, 2024
b90632e
mitigated allowances errors
elclandestin0 Dec 16, 2024
c842b37
Merge pull request #254 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 16, 2024
3ecb44f
Added tooltip
elclandestin0 Dec 16, 2024
1cb5fe6
update on dropdown
elclandestin0 Dec 16, 2024
11c8171
update
elclandestin0 Dec 17, 2024
9222b09
fix error of withdrawals coming back undef.
elclandestin0 Dec 17, 2024
4a72d23
so the cctp wont rescue me but let me be me so lets just see
elclandestin0 Dec 17, 2024
f357d1d
update deposit
elclandestin0 Dec 17, 2024
aff4eb6
update
elclandestin0 Dec 17, 2024
7fae955
update
elclandestin0 Dec 18, 2024
9b22fbe
fix structure of deposit and withdrawal
elclandestin0 Dec 18, 2024
dc4bfe2
claim on dep. looking good
elclandestin0 Dec 18, 2024
a80fb45
ready to merge with staging
elclandestin0 Dec 18, 2024
021df7b
add ui/ux
elclandestin0 Dec 18, 2024
80b1548
Merge pull request #257 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 18, 2024
1ca61d2
empty cell update
elclandestin0 Dec 18, 2024
c492e04
added deposit cctp case for notifications
elclandestin0 Dec 18, 2024
65b3f62
fix notifications
elclandestin0 Dec 19, 2024
28039d9
Merge pull request #258 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 19, 2024
c4a8cf6
removed gas fee view
elclandestin0 Dec 19, 2024
a15203d
Merge pull request #260 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 19, 2024
c2575fe
fix 0.0 eth err.
elclandestin0 Dec 19, 2024
0bc1b80
cleared errors
elclandestin0 Dec 19, 2024
fea6969
Merge pull request #261 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 19, 2024
db856db
remove patch and remove console logs
elclandestin0 Dec 20, 2024
adb1bfb
fixes for PR
elclandestin0 Dec 20, 2024
c2655e1
push some comment resolving
elclandestin0 Dec 20, 2024
e67ff89
re-added gas fee estimations
elclandestin0 Dec 20, 2024
a794c93
Merge remote-tracking branch 'origin/feat/update-bridge-sdk' into fea…
elclandestin0 Dec 20, 2024
58584c0
let's go!
elclandestin0 Dec 20, 2024
f27f237
added links
elclandestin0 Dec 20, 2024
304c3ee
Merge pull request #263 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 20, 2024
15a6309
getProvider() from bcContext
elclandestin0 Dec 20, 2024
ad09c5e
bridger not null
elclandestin0 Dec 20, 2024
e3e64e8
filter out falsy
elclandestin0 Dec 20, 2024
3c02b9b
Merge pull request #265 from G7DAO/feat/update-bridge-sdk
elclandestin0 Dec 20, 2024
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
4 changes: 2 additions & 2 deletions webapps/world-builder-dashboard/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const L3_NETWORK: HighNetworkInterface = {
chainId: 13746,
name: 'game7Testnet',
displayName: 'G7 Sepolia',
rpcs: ['https://testnet-rpc.game7.io'],
rpcs: ['https://x.game7-testnet.nodes.game7.build'],
blockExplorerUrls: ['https://testnet.game7.io'],
nativeCurrency: {
decimals: 18,
Expand Down Expand Up @@ -93,7 +93,7 @@ export const L3_MAIN_NETWORK: NetworkInterface = {
nativeCurrency: {
decimals: 18,
name: 'Game7 Token',
symbol: 'G7T'
symbol: 'G7'
},
g7TokenAddress: '0x0000000000000000000000000000000000000000',
retryableCreationTimeout: 15 * 60,
Expand Down
23 changes: 19 additions & 4 deletions webapps/world-builder-dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion webapps/world-builder-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"clsx": "^1.2.1",
"dayjs": "^1.11.11",
"dotenv": "^16.4.7",
"game7-bridge-sdk": "^0.0.68",
"game7-bridge-sdk": "^0.0.77",
"history": "^5.3.0",
"prettier-plugin-tailwindcss": "^0.6.5",
"react": "^18.2.0",
Expand All @@ -45,6 +45,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"eslint-plugin-tailwindcss": "^3.15.1",
"patch-package": "^8.0.0",
"postcss": "^8.4.38",
"postcss-preset-mantine": "^1.15.0",
"postcss-simple-vars": "^7.0.1",
Expand Down
9 changes: 9 additions & 0 deletions webapps/world-builder-dashboard/src/assets/IconChevronUp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const IconChevronUp: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' {...props}>
<path d='M15 12.5L10 7.5L5 12.5' stroke='#B9B9B9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' />
</svg>
)

export default IconChevronUp;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
.container, .containerDisabled {
.container,
.containerDisabled {
display: flex;
gap: 8px;
justify-content: space-between;
align-items: center;
padding: 7px 13px;

border-radius: 8px;
border: 1px solid #F2F4F7;
background: var(--Base-White, #FFF);
color: var(--Gray-700, #344054);
border: 1px solid #393939;
background: #171717;
color: #FFF;

/* Text sm/Medium */
font-family: Inter, sans-serif;
font-size: 14px;
font-style: normal;
line-height: 20px; /* 142.857% */
line-height: 20px;
/* 142.857% */
width: 100%;
cursor: pointer;
}
Expand All @@ -25,10 +27,24 @@

.containerDisabled {
cursor: not-allowed;
background: #393939;
}

.value {
flex: 1;
flex: 1 0 0;
color: #FFF;
font-family: Inter;
font-size: 14px;
font-style: normal;
font-weight: 500;
line-height: 20px;
}

.tokenAmountContainer {
display: flex;
align-items: center;
gap: 8px;
flex: 1 0 0;
}

.rightSection {
Expand All @@ -54,7 +70,8 @@
font-size: 12px;
font-style: normal;
font-weight: 500;
line-height: 18px; /* 150% */
line-height: 18px;
/* 150% */
}

.minButton:disabled {
Expand Down Expand Up @@ -86,11 +103,14 @@

.dropdownContainer {
border-radius: 8px !important;
border: 1px solid var(--Gray-200, #EAECF0) !important;;
background: var(--Base-White, #FFF) !important;;
border: 1px solid var(--Gray-200, #EAECF0) !important;
;
background: var(--Base-White, #FFF) !important;
;

/* Shadow/lg */
box-shadow: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03) !important;;
box-shadow: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03) !important;
;
}

.optionPercent {
Expand All @@ -100,7 +120,8 @@
font-size: 14px;
font-style: normal;
font-weight: 500;
line-height: 20px; /* 142.857% */
line-height: 20px;
/* 142.857% */
}

.optionValue {
Expand All @@ -113,6 +134,7 @@
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px; /* 142.857% */
line-height: 20px;
/* 142.857% */
margin-right: auto;
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
import styles from './AllowanceSelector.module.css'
import { ethers } from 'ethers'
import { Combobox, Tooltip, useCombobox } from 'summon-ui/mantine'
import IconAlertCircle from '@/assets/IconChevronDownToggle'
import { Combobox, useCombobox } from 'summon-ui/mantine'
import IconCheck from '@/assets/IconCheck'
import IconChevronDown from '@/assets/IconChevronDown'
import { formatBigNumber } from '@/utils/web3utils'
import { Token } from '@/utils/tokens'

type AllowanceSelectorProps = {
balance: ethers.BigNumber
onChange: (newAllowance: ethers.BigNumber) => void
allowance: ethers.BigNumber
amount: ethers.BigNumber
disabled: boolean
token: Token
}

const AllowanceSelector = ({ balance, onChange, allowance, amount, disabled }: AllowanceSelectorProps) => {
const AllowanceSelector = ({ balance, onChange, allowance, amount, disabled, token }: AllowanceSelectorProps) => {
const combobox = useCombobox({
onDropdownClose: () => combobox.resetSelectedOption()
})

const formatAllowanceDisplay = () => {
if (allowance.eq(ethers.constants.MaxUint256)) {
return `Infinite ${token?.symbol}`
}
const formattedAllowance = ethers.utils.formatUnits(allowance, token.decimals)
return `${formattedAllowance} ${token?.symbol}`
}

return (
<Combobox
store={combobox}
variant='unstyled'
onOptionSubmit={(val: string) => {
const amountInWei = ethers.utils.parseUnits(val, 18)
try {
onChange(ethers.BigNumber.from(amountInWei))
const amountInWei = ethers.utils.parseUnits(val, token.decimals)
onChange(amountInWei)
} catch (e) {
console.log(e)
console.error('Error parsing units:', e)
}
combobox.closeDropdown()
}}
Expand All @@ -39,7 +47,12 @@ const AllowanceSelector = ({ balance, onChange, allowance, amount, disabled }: A
className={disabled ? styles.containerDisabled : styles.container}
onClick={() => combobox.toggleDropdown()}
>
<div className={styles.value}>{formatBigNumber(allowance)}</div>
<div className={styles.tokenAmountContainer}>
{token?.Icon && <token.Icon />}
<div className={styles.value}>
{formatAllowanceDisplay()}
</div>
</div>
<button
className={styles.minButton}
onClick={(e) => {
Expand All @@ -50,36 +63,37 @@ const AllowanceSelector = ({ balance, onChange, allowance, amount, disabled }: A
>
MIN
</button>

<IconChevronDown className={styles.chevron} />
</div>
</Combobox.Target>

<Combobox.Dropdown className={styles.dropdownContainer}>
<Combobox.Options>
{[25, 50, 75, 100]
.map((n) => {
const percentage = balance.mul(ethers.BigNumber.from(n)).div(ethers.BigNumber.from(100))
return { n, percentage }
})
.filter(({ percentage }) => percentage.gt(amount))
// Only show percentages that are greater than the required amount
.filter(({ percentage }) => percentage.gte(amount))
.map(({ n, percentage }) => (
<Combobox.Option className={styles.optionContainer} value={ethers.utils.formatEther(percentage)} key={n}>
<Combobox.Option
className={styles.optionContainer}
value={ethers.utils.formatUnits(percentage, token.decimals)}
key={n}
>
<div className={styles.optionPercent}>{`${n}%`}</div>
<div className={styles.optionValue}>{formatBigNumber(percentage)}</div>
<div className={styles.optionValue}>
{ethers.utils.formatUnits(percentage, token.decimals)} {token?.symbol}
</div>
{allowance.eq(percentage) && <IconCheck />}
</Combobox.Option>
))}
<Combobox.Option
className={styles.optionContainer}
value={ethers.utils.formatEther(ethers.constants.MaxUint256)}
value={ethers.utils.formatUnits(ethers.constants.MaxUint256, token.decimals)}
>
<div className={styles.optionPercent}>Infinite</div>
<div className={styles.optionValue}>
(Testnet Only)
<Tooltip arrowSize={8} radius={'8px'} label={'For developers and testnet purposes only.'} withArrow>
<IconAlertCircle className={styles.chevron} />
</Tooltip>
</div>

{allowance.eq(ethers.constants.MaxUint256) && <IconCheck />}
</Combobox.Option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { useBlockchainContext } from '@/contexts/BlockchainContext'
import { ERC20AllowanceProps } from '@/types'
import { approve } from '@/utils/bridge/approveERC20'
import { formatBigNumber } from '@/utils/web3utils'

interface ApproveAllowanceProps {
onSuccess: () => void
onClose: () => void
Expand All @@ -18,7 +17,7 @@ interface ApproveAllowanceProps {
}
const ApproveAllowance: React.FC<ApproveAllowanceProps> = ({ amount, balance, onClose, onSuccess, allowanceProps }) => {
const [newAllowance, setNewAllowance] = useState(amount)
const { getProvider } = useBlockchainContext()
const { getProvider, selectedBridgeToken } = useBlockchainContext()

const approveAllowance = useMutation(
async ({
Expand Down Expand Up @@ -54,8 +53,12 @@ const ApproveAllowance: React.FC<ApproveAllowanceProps> = ({ amount, balance, on
<div className={styles.container}>
<div className={styles.header}>
<div className={styles.titleAndCloseButton}>
<div className={styles.title}>Approve Allowance</div>
<IconClose onClick={onClose} className={styles.closeButton} />
<div className={styles.titleAndCloseButtonContainer}>
<div className={styles.title}>
Approve Allowance
</div>
<IconClose onClick={onClose} className={styles.closeButton} />
</div>
</div>
<div className={styles.supportingText}>
We need permission for token allowances in order to facilitate transactions.
Expand All @@ -72,6 +75,7 @@ const ApproveAllowance: React.FC<ApproveAllowanceProps> = ({ amount, balance, on
onChange={(value) => setNewAllowance(value)}
allowance={newAllowance}
disabled={approveAllowance.isLoading}
token={selectedBridgeToken}
/>
</div>
</div>
Expand Down
Loading
Loading