2022-11-30 10:51:24 +01:00
|
|
|
package tasker
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/ecdsa"
|
|
|
|
"encoding/json"
|
|
|
|
"math/big"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/celo-org/celo-blockchain/common"
|
2022-12-01 14:07:22 +01:00
|
|
|
"github.com/grassrootseconomics/w3-celo-patch"
|
2022-11-30 10:51:24 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
QueueName string
|
|
|
|
TaskName string
|
|
|
|
)
|
|
|
|
|
|
|
|
type SystemContainer struct {
|
2022-12-01 14:07:22 +01:00
|
|
|
Abis map[string]*w3.Func
|
2023-02-12 10:50:43 +01:00
|
|
|
AccountIndexContract common.Address
|
|
|
|
GasFaucetContract common.Address
|
2022-11-30 10:51:24 +01:00
|
|
|
GasRefillThreshold *big.Int
|
|
|
|
GasRefillValue *big.Int
|
|
|
|
GiftableGasValue *big.Int
|
|
|
|
GiftableToken common.Address
|
|
|
|
GiftableTokenValue *big.Int
|
|
|
|
LockPrefix string
|
|
|
|
LockTimeout time.Duration
|
|
|
|
PrivateKey *ecdsa.PrivateKey
|
|
|
|
PublicKey string
|
|
|
|
TokenDecimals int
|
|
|
|
TokenTransferGasLimit uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
type Task struct {
|
|
|
|
Id string `json:"id"`
|
|
|
|
Payload json.RawMessage `json:"payload"`
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
PrepareAccountTask TaskName = "sys:prepare_account"
|
2023-02-12 10:50:43 +01:00
|
|
|
RegisterAccountOnChain TaskName = "sys:register_account"
|
2022-11-30 10:51:24 +01:00
|
|
|
GiftGasTask TaskName = "sys:gift_gas"
|
|
|
|
GiftTokenTask TaskName = "sys:gift_token"
|
|
|
|
RefillGasTask TaskName = "admin:refill_gas"
|
|
|
|
SweepGasTask TaskName = "admin:sweep_gas"
|
|
|
|
AdminTokenApprovalTask TaskName = "admin:token_approval"
|
2023-02-09 12:23:37 +01:00
|
|
|
SignTransferTask TaskName = "usr:sign_transfer"
|
2022-11-30 10:51:24 +01:00
|
|
|
TxDispatchTask TaskName = "rpc:dispatch"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
HighPriority QueueName = "high_priority"
|
|
|
|
DefaultPriority QueueName = "default_priority"
|
|
|
|
)
|