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
77683af8
Commit
77683af8
authored
Nov 04, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
factor out deployment
parent
6ea43350
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
9 deletions
+31
-9
deploy.js
scripts/deploy.js
+13
-0
lib.js
scripts/lib.js
+14
-0
challenge_test.js
test/challenge_test.js
+4
-9
No files found.
scripts/deploy.js
0 → 100644
View file @
77683af8
const
{
deploy
}
=
require
(
"
../scripts/lib
"
)
async
function
main
()
{
var
[
c
,
m
,
mm
]
=
await
deploy
()
console
.
log
(
"
deployed at
"
,
c
.
address
,
m
.
address
,
mm
.
address
)
}
main
()
.
then
(()
=>
process
.
exit
(
0
))
.
catch
((
error
)
=>
{
console
.
error
(
error
);
process
.
exit
(
1
);
});
scripts/lib.js
0 → 100644
View file @
77683af8
const
goldenRoot
=
"
0x1f6285b6d372ee187815a8580d1af3ab348cea34abbee18a8e13272454a4c4af
"
async
function
deploy
()
{
const
MIPS
=
await
ethers
.
getContractFactory
(
"
MIPS
"
)
const
m
=
await
MIPS
.
deploy
()
const
mm
=
await
ethers
.
getContractAt
(
"
MIPSMemory
"
,
await
m
.
m
())
const
Challenge
=
await
ethers
.
getContractFactory
(
"
Challenge
"
)
const
c
=
await
Challenge
.
deploy
(
m
.
address
,
goldenRoot
)
return
[
c
,
m
,
mm
]
}
module
.
exports
=
{
deploy
}
test/challenge_test.js
View file @
77683af8
const
{
expect
}
=
require
(
"
chai
"
);
const
fs
=
require
(
"
fs
"
);
const
{
expect
}
=
require
(
"
chai
"
)
const
fs
=
require
(
"
fs
"
)
const
{
deploy
}
=
require
(
"
../scripts/lib
"
)
// golden minigeth.bin hash
const
goldenRoot
=
"
0x1f6285b6d372ee187815a8580d1af3ab348cea34abbee18a8e13272454a4c4af
"
describe
(
"
Challenge contract
"
,
function
()
{
beforeEach
(
async
function
()
{
// this mips can be reused for other challenges
const
MIPS
=
await
ethers
.
getContractFactory
(
"
MIPS
"
)
const
m
=
await
MIPS
.
deploy
()
mm
=
await
ethers
.
getContractAt
(
"
MIPSMemory
"
,
await
m
.
m
())
const
Challenge
=
await
ethers
.
getContractFactory
(
"
Challenge
"
)
c
=
await
Challenge
.
deploy
(
m
.
address
,
goldenRoot
)
[
c
,
m
,
mm
]
=
await
deploy
()
})
it
(
"
challenge contract deploys
"
,
async
function
()
{
console
.
log
(
"
Challenge deployed at
"
,
c
.
address
)
...
...
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