Skip to content

Commit

Permalink
Merge branch 'master' into fix/swarm-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Cafe137 authored Oct 25, 2024
2 parents 0af2b0b + 314ebca commit f45d66a
Show file tree
Hide file tree
Showing 88 changed files with 298 additions and 1,945 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/pr-reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@ name: PRs reviews reminder
on:
schedule:
- cron: "0 8 * * 1-5"
- cron: '0 9 * * 1-5'
workflow_dispatch:

jobs:
pr-reviews-reminder:
runs-on: ubuntu-latest
steps:
- uses: Aniket-Engg/pr-reviews-reminder-action@master
- name: Reminder about PRs pending to review
if: github.event.schedule == '0 8 * * 1-5'
uses: Aniket-Engg/pr-reviews-reminder-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
freeze-date: '2024-11-04T18:00:00Z'
- name: Reminder for standup
if: github.event.schedule == '0 9 * * 1-5'
uses: Aniket-Engg/pr-reviews-reminder-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
freeze-date: '2024-10-21T18:00:00Z'
4 changes: 4 additions & 0 deletions apps/contract-verification/src/app/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ body {
margin: 0;
}

a:focus {
background-color: var(bg-light) !important;
}

.fa-arrow-up-right-from-square::before { content: "\f08e"; }
.fa-xmark::before { content: "\f00d"; }
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export const ContractDropdown: React.FC<ContractDropdownProps> = ({ label, id, s
return (
<div className="form-group">
<label htmlFor={id}>{label}</label>
<select value={selectedContract ? JSON.stringify(selectedContract) : ''} className={`form-control custom-select pr-4 ${!hasContracts ? 'disabled-cursor' : ''} ${!hasContracts ? 'text-muted' : ''}`} id={id} disabled={!hasContracts} onChange={handleSelectContract}>
<select value={selectedContract ? JSON.stringify(selectedContract) : ''}
className={`form-control custom-select pr-4 ${!hasContracts ? 'disabled-cursor text-warning' : ''}`}
id={id}
disabled={!hasContracts}
onChange={handleSelectContract}
>
{hasContracts ? (
Object.keys(compilationOutput).map((compilationTriggerFileName) => (
<optgroup key={compilationTriggerFileName} label={`Compilation trigger: ${compilationTriggerFileName}`}>
Expand Down
10 changes: 6 additions & 4 deletions apps/contract-verification/src/app/components/NavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ interface NavItemProps {

const NavItem: React.FC<NavItemProps> = ({ to, icon, title }) => {
return (
<NavLink to={to} className={({ isActive }) => 'text-decoration-none d-flex flex-column justify-content-center py-2 px-1 small ' + (isActive ? 'bg-light' : 'bg-transparent')}>
<span>
<NavLink
to={to}
className={({ isActive }) => 'text-decoration-none d-flex px-1 py-1 flex-column justify-content-center small ' + (isActive ? "bg-light border-top border-left border-right" : "border-0 bg-transparent")}
>
<span className=''>
<span>{icon}</span>
<span className="ml-2">{title}</span>
</span>
Expand All @@ -20,12 +23,11 @@ const NavItem: React.FC<NavItemProps> = ({ to, icon, title }) => {

export const NavMenu = () => {
return (
<nav className="d-flex flex-row justify-start w-100">
<nav className="d-flex medium flex-row w-100" style={{backgroundColor: 'var(--body-bg)!important'}}>
<NavItem to="/" icon={<i className="fas fa-home"></i>} title="Verify" />
<NavItem to="/receipts" icon={<i className="fas fa-receipt"></i>} title="Receipts" />
<NavItem to="/lookup" icon={<i className="fas fa-search"></i>} title="Lookup" />
<NavItem to="/settings" icon={<i className="fas fa-cog"></i>} title="Settings" />
<div className="flex-grow-1"></div>
</nav>
)
}
2 changes: 1 addition & 1 deletion apps/contract-verification/src/app/layouts/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const DefaultLayout = ({ children, title, description }: PropsWithChildre
return (
<div className="d-flex flex-column h-100">
<NavMenu />
<div className="py-4 px-3 flex-grow-1" style={{ overflowY: 'auto' }}>
<div className="py-4 px-3 flex-grow-1 bg-light" style={{ overflowY: 'auto' }}>
<div>
<p className="text-center" style={{ fontSize: '0.8rem' }}>
{description}
Expand Down
23 changes: 17 additions & 6 deletions apps/contract-verification/src/app/views/LookupView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export const LookupView = () => {
}
}

const sendToMatomo = async (eventAction: string, eventName: string) => {
await clientInstance.call('matomo' as any, 'track', ['trackEvent', 'ContractVerification', eventAction, eventName]);
}

const handleOpenInRemix = async (lookupResponse: LookupResponse) => {
for (const source of lookupResponse.sourceFiles ?? []) {
try {
Expand All @@ -70,6 +74,7 @@ export const LookupView = () => {
}
try {
await clientInstance.call('fileManager', 'open', lookupResponse.targetFilePath)
await sendToMatomo('lookup', "openInRemix On: " + selectedChain)
} catch (err) {
console.error(`Error focusing file ${lookupResponse.targetFilePath}: ${err.message}`)
}
Expand All @@ -79,15 +84,20 @@ export const LookupView = () => {
<>
<form onSubmit={handleLookup}>
<SearchableChainDropdown label="Chain" id="network-dropdown" selectedChain={selectedChain} setSelectedChain={setSelectedChain} />

<ContractAddressInput label="Contract Address" id="contract-address" contractAddress={contractAddress} setContractAddress={setContractAddress} contractAddressError={contractAddressError} setContractAddressError={setContractAddressError} />

<button type="submit" className="btn btn-primary" disabled={submitDisabled}>
<ContractAddressInput
label="Contract Address"
id="contract-address"
contractAddress={contractAddress}
setContractAddress={setContractAddress}
contractAddressError={contractAddressError}
setContractAddressError={setContractAddressError}
/>
<button type="submit" className="btn w-100 btn-primary" disabled={submitDisabled}>
Lookup
</button>
</form>
<div className="pt-3">
{chainSettings &&
{ chainSettings &&
VERIFIERS.map((verifierId) => {
if (!validConfiguration(chainSettings, verifierId)) {
return (
Expand Down Expand Up @@ -149,7 +159,8 @@ export const LookupView = () => {
)}
</div>
)
})}
})
}
</div>
</>
)
Expand Down
77 changes: 60 additions & 17 deletions apps/contract-verification/src/app/views/VerifyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { VerifyFormContext } from '../VerifyFormContext'
import { useSourcifySupported } from '../hooks/useSourcifySupported'

export const VerifyView = () => {
const { compilationOutput, setSubmittedContracts, settings } = useContext(AppContext)
const { compilationOutput, setSubmittedContracts, settings, clientInstance } = useContext(AppContext)
const { selectedChain, setSelectedChain, contractAddress, setContractAddress, contractAddressError, setContractAddressError, selectedContract, setSelectedContract, proxyAddress, setProxyAddress, proxyAddressError, setProxyAddressError, abiEncodedConstructorArgs, setAbiEncodedConstructorArgs, abiEncodingError, setAbiEncodingError } = useContext(VerifyFormContext)
const [enabledVerifiers, setEnabledVerifiers] = useState<Partial<Record<VerifierIdentifier, boolean>>>({})
const [hasProxy, setHasProxy] = useState(!!proxyAddress)
Expand Down Expand Up @@ -41,9 +41,14 @@ export const VerifyView = () => {
setEnabledVerifiers({ ...enabledVerifiers, [verifierId]: checked })
}


const sendToMatomo = async (eventAction: string, eventName: string) => {
await clientInstance.call("matomo" as any, 'track', ['trackEvent', 'ContractVerification', eventAction, eventName]);
}

const handleVerify = async (e) => {
e.preventDefault()

const { triggerFilePath, filePath, contractName } = selectedContract
const compilerAbstract = compilationOutput[triggerFilePath]
if (!compilerAbstract) {
Expand All @@ -63,6 +68,9 @@ export const VerifyView = () => {
name: verifierId as VerifierIdentifier,
}
receipts.push({ verifierInfo, status: 'pending', contractId, isProxyReceipt: false, failedChecks: 0 })
if (enabledVerifiers.Blockscout) await sendToMatomo('verify', "verifyWith: Blockscout On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress))
if (enabledVerifiers.Etherscan) await sendToMatomo('verify', "verifyWithEtherscan On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress))
if (enabledVerifiers.Sourcify) await sendToMatomo('verify', "verifyWithSourcify On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress))
}

const newSubmittedContract: SubmittedContract = {
Expand Down Expand Up @@ -173,21 +181,39 @@ export const VerifyView = () => {
return (
<form onSubmit={handleVerify}>
<SearchableChainDropdown label="Chain" id="network-dropdown" selectedChain={selectedChain} setSelectedChain={setSelectedChain} />

<ContractAddressInput label="Contract Address" id="contract-address" contractAddress={contractAddress} setContractAddress={setContractAddress} contractAddressError={contractAddressError} setContractAddressError={setContractAddressError} />

<ContractDropdown label="Contract Name" id="contract-dropdown-1" selectedContract={selectedContract} setSelectedContract={setSelectedContract} />

{selectedContract && <ConstructorArguments abiEncodedConstructorArgs={abiEncodedConstructorArgs} setAbiEncodedConstructorArgs={setAbiEncodedConstructorArgs} selectedContract={selectedContract} abiEncodingError={abiEncodingError} setAbiEncodingError={setAbiEncodingError} />}

<ContractAddressInput
label="Contract Address"
id="contract-address"
contractAddress={contractAddress}
setContractAddress={setContractAddress}
contractAddressError={contractAddressError}
setContractAddressError={setContractAddressError}
/>
<CustomTooltip tooltipText="Please compile and select the solidity contract you need to verify.">
<ContractDropdown label="Contract Name" id="contract-dropdown-1" selectedContract={selectedContract} setSelectedContract={setSelectedContract} />
</CustomTooltip>
{selectedContract && <ConstructorArguments
abiEncodedConstructorArgs={abiEncodedConstructorArgs}
setAbiEncodedConstructorArgs={setAbiEncodedConstructorArgs}
selectedContract={selectedContract}
abiEncodingError={abiEncodingError}
setAbiEncodingError={setAbiEncodingError}
/>}
<div className="pt-3">
<div className="d-flex py-1 align-items-center custom-control custom-checkbox">
<input id="has-proxy" className="form-check-input custom-control-input" type="checkbox" checked={!!hasProxy} onChange={(e) => setHasProxy(e.target.checked)} />
<label htmlFor="has-proxy" className="m-0 form-check-label custom-control-label" style={{ paddingTop: '2px' }}>
The deployed contract is behind a proxy
</label>
</div>
{hasProxy && <ContractAddressInput label="Proxy Address" id="proxy-address" contractAddress={proxyAddress} setContractAddress={setProxyAddress} contractAddressError={proxyAddressError} setContractAddressError={setProxyAddressError} />}
{hasProxy && <ContractAddressInput
label="Proxy Address"
id="proxy-address"
contractAddress={proxyAddress}
setContractAddress={setProxyAddress}
contractAddressError={proxyAddressError}
setContractAddressError={setProxyAddressError}
/>}
</div>

<div className="pt-3">
Expand All @@ -198,9 +224,19 @@ export const VerifyView = () => {
return (
<div key={verifierId} className="pt-2">
<div className="d-flex py-1 align-items-center custom-control custom-checkbox">
<input className="form-check-input custom-control-input" type="checkbox" id={`verifier-${verifierId}`} checked={!!enabledVerifiers[verifierId]} onChange={(e) => handleVerifierCheckboxClick(verifierId, e.target.checked)} disabled={disabledVerifier} />

<label htmlFor={`verifier-${verifierId}`} className={`m-0 form-check-label custom-control-label large font-weight-bold${!disabledVerifier ? '' : ' text-secondary'}`} style={{ fontSize: '1rem', lineHeight: '1.5', color: 'var(--text)' }}>
<input
className="form-check-input custom-control-input"
type="checkbox"
id={`verifier-${verifierId}`}
checked={!!enabledVerifiers[verifierId]}
onChange={(e) => handleVerifierCheckboxClick(verifierId, e.target.checked)}
disabled={disabledVerifier}
/>
<label
htmlFor={`verifier-${verifierId}`}
className={`m-0 form-check-label custom-control-label large font-weight-bold${!disabledVerifier ? '' : ' text-secondary'}`}
style={{ fontSize: '1rem', lineHeight: '1.5', color: 'var(--text)' }}
>
{verifierId}
</label>
</div>
Expand All @@ -227,10 +263,17 @@ export const VerifyView = () => {
)
})}
</div>

<button type="submit" className="btn btn-primary mt-3" disabled={submitDisabled}>
Verify
</button>
<CustomTooltip tooltipText={submitDisabled ? (
(!!contractAddressError || !contractAddress) ? "Please provide a valid contract address." :
!selectedChain ? "Please select the chain." :
!selectedContract ? "Please select the contract (compile if needed)." :
((hasProxy && !!proxyAddressError) || (hasProxy && !proxyAddress)) ? "Please provide a valid proxy contract address." :
"Please provide all necessary data to verify") // Is not expected to be a case
: "Verify with selected tools"}>
<button type="submit" className="w-100 btn btn-primary mt-3" disabled={submitDisabled}>
Verify
</button>
</CustomTooltip>
</form>
)
}
2 changes: 1 addition & 1 deletion apps/contract-verification/src/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"documentation": "https://remix-ide.readthedocs.io/en/latest/contract_verification.html",
"maintainedBy": "Remix",
"authorContact": "[email protected]"
}
}
9 changes: 0 additions & 9 deletions apps/etherscan/.babelrc

This file was deleted.

16 changes: 0 additions & 16 deletions apps/etherscan/.browserslistrc

This file was deleted.

3 changes: 0 additions & 3 deletions apps/etherscan/.eslintrc

This file was deleted.

34 changes: 0 additions & 34 deletions apps/etherscan/.eslintrc.json

This file was deleted.

Loading

0 comments on commit f45d66a

Please sign in to comment.