Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(prover): set AssignmentHook allowance
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Dec 30, 2023
1 parent e294b0b commit 455ee62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/flags/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ var (
}
Allowance = &cli.StringFlag{
Name: "prover.allowance",
Usage: "Amount to approve TaikoL1 contract for TaikoToken usage",
Usage: "Amount to approve AssignmentHook contract for TaikoToken usage",
Category: proverCategory,
}
GuardianProverHealthCheckServerEndpoint = &cli.StringFlag{
Expand Down
14 changes: 7 additions & 7 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ func (p *Prover) setApprovalAmount(ctx context.Context) error {
allowance, err := p.rpc.TaikoToken.Allowance(
&bind.CallOpts{Context: ctx},
p.proverAddress,
p.cfg.TaikoL1Address,
p.cfg.AssignmentHookAddress,
)
if err != nil {
return err
}

log.Info("Existing allowance for TaikoL1 contract", "allowance", allowance.String())
log.Info("Existing allowance for AssignmentHook contract", "allowance", allowance.String())

if allowance.Cmp(p.cfg.Allowance) >= 0 {
log.Info(
Expand All @@ -348,11 +348,11 @@ func (p *Prover) setApprovalAmount(ctx context.Context) error {
}
opts.Context = ctx

log.Info("Approving TaikoL1 for taiko token", "allowance", p.cfg.Allowance.String())
log.Info("Approving AssignmentHook for taiko token", "allowance", p.cfg.Allowance.String())

tx, err := p.rpc.TaikoToken.Approve(
opts,
p.cfg.TaikoL1Address,
p.cfg.AssignmentHookAddress,
p.cfg.Allowance,
)
if err != nil {
Expand All @@ -364,17 +364,17 @@ func (p *Prover) setApprovalAmount(ctx context.Context) error {
return err
}

log.Info("Approved TaikoL1 for taiko token", "txHash", receipt.TxHash.Hex())
log.Info("Approved AssignmentHook for taiko token", "txHash", receipt.TxHash.Hex())

if allowance, err = p.rpc.TaikoToken.Allowance(
&bind.CallOpts{Context: ctx},
p.proverAddress,
p.cfg.TaikoL1Address,
p.cfg.AssignmentHookAddress,
); err != nil {
return err
}

log.Info("New allowance for TaikoL1 contract", "allowance", allowance.String())
log.Info("New allowance for AssignmentHook contract", "allowance", allowance.String())

return nil
}
Expand Down

0 comments on commit 455ee62

Please sign in to comment.