-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
- Loading branch information
There are no files selected for viewing
+3 −3 | contracts/scripts/files/localConfig.json | |
+3 −3 | contracts/scripts/files/mainnetConfig.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package main | ||
Check failure on line 1 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 1 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
|
||
|
||
import ( | ||
"math/big" | ||
|
||
solimpl "github.com/OffchainLabs/bold/chain-abstraction/sol-implementation" | ||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
"github.com/ethereum/go-ethereum/crypto" | ||
) | ||
|
||
func main() { | ||
validatorPrivateKey, err := crypto.HexToECDSA("182fecf15bdf909556a0f617a63e05ab22f1493d25a9f1e27c228266c772a890") | ||
if err != nil { | ||
panic(err) | ||
} | ||
validatorTxOpts, err := bind.NewKeyedTransactorWithChainID(validatorPrivateKey, l1ChainId) | ||
Check failure on line 16 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 16 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
|
||
if err != nil { | ||
panic(err) | ||
} | ||
mintTokens, ok := new(big.Int).SetString("10000", 10) | ||
if !ok { | ||
panic("could not set stake token value") | ||
} | ||
l1TransactionOpts.Value = mintTokens | ||
Check failure on line 24 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 24 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
|
||
tx, err = tokenBindings.Deposit(l1TransactionOpts) | ||
Check failure on line 25 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 25 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 25 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 25 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
Check failure on line 25 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
Check failure on line 25 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
Check failure on line 25 in tools/bold-challenges/main.go GitHub Actions / Go Tests (challenge)
Check failure on line 25 in tools/bold-challenges/main.go GitHub Actions / Go Tests (challenge)
|
||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// We then have the validator itself authorize the rollup and challenge manager | ||
// contracts to spend its stake tokens. | ||
chain, err := solimpl.NewAssertionChain( | ||
ctx, | ||
Check failure on line 33 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 33 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
|
||
deployedAddresses.Rollup, | ||
Check failure on line 34 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 34 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
|
||
validatorTxOpts, | ||
l1Reader.Client(), | ||
Check failure on line 36 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 36 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
|
||
) | ||
if err != nil { | ||
panic(err) | ||
} | ||
chalManager, err := chain.SpecChallengeManager(ctx) | ||
Check failure on line 41 in tools/bold-challenges/main.go GitHub Actions / Go Tests (defaults)
Check failure on line 41 in tools/bold-challenges/main.go GitHub Actions / Go Tests (race)
|
||
if err != nil { | ||
panic(err) | ||
} | ||
amountToApproveSpend, ok := new(big.Int).SetString("10000", 10) | ||
if !ok { | ||
panic("not ok") | ||
} | ||
tx, err = tokenBindings.TestWETH9Transactor.Approve(validatorTxOpts, deployedAddresses.Rollup, amountToApproveSpend) | ||
if err != nil { | ||
panic(err) | ||
} | ||
ensureTxSucceeds(tx) | ||
tx, err = tokenBindings.TestWETH9Transactor.Approve(validatorTxOpts, chalManager.Address(), amountToApproveSpend) | ||
if err != nil { | ||
panic(err) | ||
} | ||
ensureTxSucceeds(tx) | ||
|
||
} |