Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
796dbda5
Unverified
Commit
796dbda5
authored
Aug 16, 2021
by
Mark Tyneway
Committed by
GitHub
Aug 16, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1344 from ethereum-optimism/sc/contracts-browser-compat
feat: make contracts package browser compatible
parents
3f9941e3
e4fea5e0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
5 deletions
+95
-5
old-roses-behave.md
.changeset/old-roses-behave.md
+5
-0
tall-ravens-learn.md
.changeset/tall-ravens-learn.md
+5
-0
.gitignore
packages/contracts/.gitignore
+1
-0
package.json
packages/contracts/package.json
+3
-2
build.sh
packages/contracts/scripts/build.sh
+2
-1
generate-artifacts.js
packages/contracts/scripts/generate-artifacts.js
+78
-0
OVM_L2StandardTokenFactory.spec.ts
...acts/OVM/bridge/assets/OVM_L2StandardTokenFactory.spec.ts
+1
-2
No files found.
.changeset/old-roses-behave.md
0 → 100644
View file @
796dbda5
---
'
@eth-optimism/message-relayer'
:
patch
---
Use latest contracts package for browser compatibility support
.changeset/tall-ravens-learn.md
0 → 100644
View file @
796dbda5
---
'
@eth-optimism/contracts'
:
patch
---
Makes the contracts package browser compatible.
packages/contracts/.gitignore
0 → 100644
View file @
796dbda5
src/contract-artifacts.ts
packages/contracts/package.json
View file @
796dbda5
...
...
@@ -39,13 +39,14 @@
"lint:fix"
:
"yarn lint:check --fix"
,
"lint:contracts"
:
"yarn solhint -f table contracts/optimistic-ethereum/**/*.sol"
,
"clean"
:
"rm -rf ./dist ./artifacts ./artifacts-ovm ./cache ./cache-ovm ./tsconfig.build.tsbuildinfo"
,
"deploy"
:
"ts-node
\"
./bin/deploy.ts
\"
&& yarn generate
-
markdown"
,
"deploy"
:
"ts-node
\"
./bin/deploy.ts
\"
&& yarn generate
:
markdown"
,
"serve"
:
"./bin/serve_dump.sh"
,
"prepublishOnly"
:
"yarn copyfiles -u 2
\"
contracts/optimistic-ethereum/**/*
\"
./"
,
"postpublish"
:
"rimraf OVM iOVM libraries mockOVM"
,
"prepack"
:
"yarn prepublishOnly"
,
"postpack"
:
"yarn postpublish"
,
"generate-markdown"
:
"node
\"
./scripts/generate-markdown.js
\"
"
,
"generate:markdown"
:
"node
\"
./scripts/generate-markdown.js
\"
"
,
"generate:artifacts"
:
"node
\"
./scripts/generate-artifacts.js
\"
"
,
"pre-commit"
:
"lint-staged"
},
"dependencies"
:
{
...
...
packages/contracts/scripts/build.sh
View file @
796dbda5
...
...
@@ -2,6 +2,7 @@
set
-e
yarn build:typescript &
yarn build:contracts
yarn build:contracts:ovm
yarn generate:artifacts
yarn build:typescript
packages/contracts/scripts/generate-artifacts.js
0 → 100644
View file @
796dbda5
#!/usr/bin/env node
const
path
=
require
(
'
path
'
)
const
glob
=
require
(
'
glob
'
)
const
fs
=
require
(
'
fs
'
)
;(
async
()
=>
{
console
.
log
(
`writing contract artifacts typescript file`
)
const
getContractJsonFiles
=
(
artifactsFolder
)
=>
{
return
glob
.
sync
(
`
${
artifactsFolder
}
/**/*.json`
).
filter
((
match
)
=>
{
return
!
match
.
endsWith
(
'
.dbg.json
'
)
})
}
const
evmArtifactPaths
=
getContractJsonFiles
(
path
.
resolve
(
__dirname
,
`../artifacts/contracts`
)
)
const
ovmArtifactPaths
=
getContractJsonFiles
(
path
.
resolve
(
__dirname
,
`../artifacts-ovm/contracts`
)
)
const
content
=
`
/* eslint-disable @typescript-eslint/no-var-requires, no-empty */
/*
THIS FILE IS AUTOMATICALLY GENERATED.
DO NOT EDIT.
*/
${
ovmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
const
relPath
=
path
.
relative
(
__dirname
,
artifactPath
)
return
`
let ovm__
${
artifact
.
contractName
}
try {
ovm__
${
artifact
.
contractName
}
= require('
${
relPath
}
')
} catch {}
`
})
.
join
(
'
\n
'
)}
${
evmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
const
relPath
=
path
.
relative
(
__dirname
,
artifactPath
)
return
`
let
${
artifact
.
contractName
}
try {
${
artifact
.
contractName
}
= require('
${
relPath
}
')
} catch {}
`
})
.
join
(
'
\n
'
)}
export const getContractArtifact = (name: string, ovm: boolean): any => {
if (ovm) {
return {
${
ovmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
return
`
${
artifact
.
contractName
}
: ovm__
${
artifact
.
contractName
}
`
})
.
join
(
'
,
\n
'
)}
}[name]
} else {
return {
${
evmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
return
`
${
artifact
.
contractName
}
:
${
artifact
.
contractName
}
`
})
.
join
(
'
,
\n
'
)}
}[name]
}
}
`
fs
.
writeFileSync
(
`./src/contract-artifacts.ts`
,
content
)
})().
catch
(
console
.
error
)
packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2StandardTokenFactory.spec.ts
View file @
796dbda5
...
...
@@ -4,10 +4,9 @@ import { expect } from '../../../../setup'
import
{
ethers
}
from
'
hardhat
'
import
{
Signer
,
ContractFactory
,
Contract
}
from
'
ethers
'
import
{
smoddit
}
from
'
@eth-optimism/smock
'
import
{
getContractInterface
}
from
'
@eth-optimism/contracts
'
/* Internal Imports */
import
{
predeploys
}
from
'
../../../../../src
'
import
{
predeploys
,
getContractInterface
}
from
'
../../../../../src
'
describe
(
'
OVM_L2StandardTokenFactory
'
,
()
=>
{
let
signer
:
Signer
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment