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