mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2024-12-22 09:47:32 +01:00
feat: settable approve session timeout
This commit is contained in:
parent
99cdb6d0aa
commit
07b079749a
@ -58,6 +58,7 @@ func main() {
|
||||
natsConn, jsCtx := initJetStream()
|
||||
|
||||
custodial, err := custodial.NewCustodial(custodial.Opts{
|
||||
ApprovalTimeout: ko.MustDuration("system.approve_timeout"),
|
||||
CeloProvider: celoProvider,
|
||||
LockProvider: lockProvider,
|
||||
Logg: lo,
|
||||
|
@ -13,6 +13,7 @@ registry_address = ""
|
||||
[system]
|
||||
private_key = ""
|
||||
public_key = ""
|
||||
approve_timeout = "30m"
|
||||
|
||||
[postgres]
|
||||
dsn = ""
|
||||
|
@ -3,6 +3,7 @@ package custodial
|
||||
import (
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"time"
|
||||
|
||||
"github.com/bsm/redislock"
|
||||
"github.com/celo-org/celo-blockchain/common"
|
||||
@ -19,6 +20,7 @@ import (
|
||||
|
||||
type (
|
||||
Opts struct {
|
||||
ApprovalTimeout time.Duration
|
||||
CeloProvider *celoutils.Provider
|
||||
LockProvider *redislock.Client
|
||||
Logg logf.Logger
|
||||
@ -32,6 +34,7 @@ type (
|
||||
}
|
||||
|
||||
Custodial struct {
|
||||
ApprovalTimeout time.Duration
|
||||
Abis map[string]*w3.Func
|
||||
CeloProvider *celoutils.Provider
|
||||
LockProvider *redislock.Client
|
||||
@ -69,6 +72,7 @@ func NewCustodial(o Opts) (*Custodial, error) {
|
||||
}
|
||||
|
||||
return &Custodial{
|
||||
ApprovalTimeout: o.ApprovalTimeout,
|
||||
Abis: initAbis(),
|
||||
CeloProvider: o.CeloProvider,
|
||||
LockProvider: o.LockProvider,
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"github.com/bsm/redislock"
|
||||
"github.com/celo-org/celo-blockchain/common/hexutil"
|
||||
@ -159,7 +158,7 @@ func SignTransferAuthorizationProcessor(cu *custodial.Custodial) func(context.Co
|
||||
&tasker.Task{
|
||||
Payload: taskPayload,
|
||||
},
|
||||
asynq.ProcessIn(time.Minute*15),
|
||||
asynq.ProcessIn(cu.ApprovalTimeout),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user