diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d25f9516..bf0200b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,10 @@ on: push: branches: - main - paths: ['.github/workflows/**', '**/Makefile', '**/*.go'] + paths: ['.github/workflows/**', '**/Makefile', '**/*.go', '**/*.json', '**/*.yml', '**/*.ts', '**/*.js'] + pull_request: + types: [opened, reopened, synchronize] + paths: ['.github/workflows/**', '**/Makefile', '**/*.go', '**/*.json', '**/*.yml', '**/*.ts', '**/*.js'] concurrency: group: ci-${{ github.ref }} @@ -32,7 +35,16 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.21.x' - cache-dependency-path: launcher/go.sum + cache-dependency-path: | + launcher/go.sum + proxy-router/go.sum + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + cache-dependency-path: ui-desktop/yarn.lock - name: Install dependencies run: | @@ -40,6 +52,8 @@ jobs: go mod tidy cd ../proxy-router go mod download + cd ../ui-desktop + yarn install --network-timeout 600000 - name: Build id: build @@ -48,6 +62,8 @@ jobs: make cd ../proxy-router make build + cd ../ui-desktop + yarn build:linux - name: Determine tag name id: tag @@ -61,12 +77,12 @@ jobs: ARTIFACT=mor-launch-${{ steps.tag.outputs.name }}-ubuntu-x64.zip LLAMACPP=llama-b2699-bin-ubuntu-x64.zip MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf - wget https://github.com/ggerganov/llama.cpp/releases/download/b2699/$LLAMACPP - wget https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL + wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b2699/$LLAMACPP + wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL unzip -o -j $LLAMACPP build/bin/server - echo '{"run":["./server -m ./'$MODEL'","./proxy-router"]}' > mor-launch.json + echo '{"run":["./server -m ./'$MODEL'","./proxy-router","./ui-desktop-1.0.0.AppImage"]}' > mor-launch.json cp ./proxy-router/.env.example .env - zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch server ./proxy-router/bin/proxy-router .env $MODEL mor-launch.json + zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch server ./proxy-router/bin/proxy-router .env $MODEL mor-launch.json ./ui-desktop/dist/ui-desktop-1.0.0.AppImage - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -85,7 +101,16 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.21.x' - cache-dependency-path: launcher/go.sum + cache-dependency-path: | + launcher/go.sum + proxy-router/go.sum + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + cache-dependency-path: ui-desktop/yarn.lock - name: Install dependencies run: | @@ -93,6 +118,8 @@ jobs: go mod tidy cd ../proxy-router go mod download + cd ../ui-desktop + yarn install --network-timeout 600000 - name: Build id: build @@ -101,6 +128,8 @@ jobs: make cd ../proxy-router make build + cd ../ui-desktop + yarn build:mac - name: Determine tag name id: tag @@ -114,12 +143,14 @@ jobs: ARTIFACT=mor-launch-${{ steps.tag.outputs.name }}-macos-x64.zip LLAMACPP=llama-b2699-bin-macos-x64.zip MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf - wget https://github.com/ggerganov/llama.cpp/releases/download/b2699/$LLAMACPP - wget https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL + wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b2699/$LLAMACPP + wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL unzip -o -j $LLAMACPP build/bin/server - echo '{"run":["./server -m ./'$MODEL'","./proxy-router"]}' > mor-launch.json + echo '{"run":["./server -m ./'$MODEL'","./proxy-router","./ui-desktop.app/Contents/MacOS/ui-desktop"]}' > mor-launch.json cp ./proxy-router/.env.example .env + unzip ./ui-desktop/dist/ui-desktop-1.0.0-mac.zip zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch ./proxy-router/bin/proxy-router .env server $MODEL mor-launch.json + zip -r $ARTIFACT ui-desktop.app - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -138,7 +169,16 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.21.x' - cache-dependency-path: launcher/go.sum + cache-dependency-path: | + launcher/go.sum + proxy-router/go.sum + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + cache-dependency-path: ui-desktop/yarn.lock - name: Install dependencies run: | @@ -146,6 +186,8 @@ jobs: go mod tidy cd ../proxy-router go mod download + cd ../ui-desktop + yarn install --network-timeout 600000 - name: Build id: build @@ -154,6 +196,8 @@ jobs: make cd ../proxy-router make build + cd ../ui-desktop + yarn build:mac - name: Determine tag name id: tag @@ -167,12 +211,14 @@ jobs: ARTIFACT=mor-launch-${{ steps.tag.outputs.name }}-macos-arm64.zip LLAMACPP=llama-b2699-bin-macos-arm64.zip MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf - wget https://github.com/ggerganov/llama.cpp/releases/download/b2699/$LLAMACPP - wget https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL + wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b2699/$LLAMACPP + wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL unzip -o -j $LLAMACPP build/bin/server - echo '{"run":["./server -m ./'$MODEL'","./proxy-router"]}' > mor-launch.json + echo '{"run":["./server -m ./'$MODEL'","./proxy-router","./ui-desktop.app/Contents/MacOS/ui-desktop"]}' > mor-launch.json cp ./proxy-router/.env.example .env + unzip ./ui-desktop/dist/ui-desktop-1.0.0-arm64-mac.zip zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch ./proxy-router/bin/proxy-router .env server $MODEL mor-launch.json + zip -r $ARTIFACT ui-desktop.app - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -180,13 +226,87 @@ jobs: path: mor-launch-${{ steps.tag.outputs.name }}-macos-arm64.zip name: mor-launch-macos-arm64.zip + Windows-avx2-x64: + runs-on: windows-latest + steps: + - name: Clone + uses: actions/checkout@v4 + id: checkout + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.21.x' + cache-dependency-path: | + launcher/go.sum + proxy-router/go.sum + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + cache-dependency-path: ui-desktop/yarn.lock + + - name: Install wget + run: | + choco install wget --no-progress + + - name: Install dependencies + run: | + cd launcher + go mod tidy + cd ../proxy-router + go mod download + cd ../ui-desktop + yarn install --network-timeout 600000 + + - name: Build + id: build + run: | + cd launcher + make + cd ../proxy-router + make build + cd ../ui-desktop + yarn build:win + + - name: Determine tag name + id: tag + run: | + SHORT_HASH="$(git rev-parse --short=7 HEAD)" + echo "name=${SHORT_HASH}" >> $GITHUB_OUTPUT + + - name: Pack artifacts + id: pack_artifacts + run: | + ARTIFACT=mor-launch-${{ steps.tag.outputs.name }}-win-x64.zip + LLAMACPP=llama-b2699-bin-win-avx2-x64.zip + MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf + wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b2699/$LLAMACPP + wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL + unzip -o -j $LLAMACPP server.exe llama.dll + echo '{"run":["./server.exe -m ./'$MODEL'","./proxy-router.exe","./ui-desktop-1.0.0.exe"]}' > mor-launch.json + cp ./proxy-router/.env.example .env + mv ./proxy-router/bin/proxy-router proxy-router.exe + mv ./launcher/mor-launch mor-launch.exe + mv "./ui-desktop/dist/ui-desktop 1.0.0.exe" ui-desktop-1.0.0.exe + 7z a $ARTIFACT LICENSE mor-launch.exe proxy-router.exe .env server.exe llama.dll $MODEL mor-launch.json ui-desktop-1.0.0.exe + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + path: mor-launch-${{ steps.tag.outputs.name }}-win-x64.zip + name: mor-launch-win-x64.zip + release: - if: ${{ github.event.inputs.create_release == 'true' }} + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }} runs-on: ubuntu-latest needs: - Ubuntu-22-x64 - macOS-12-x64 - macOS-14-arm64 + - Windows-avx2-x64 steps: - name: Clone id: checkout diff --git a/launcher/cmd/main.go b/launcher/cmd/main.go index 417217ca..6bb010df 100644 --- a/launcher/cmd/main.go +++ b/launcher/cmd/main.go @@ -7,6 +7,7 @@ import ( "io" "os" "os/exec" + "path/filepath" "sync" "github.com/google/shlex" ) @@ -15,20 +16,29 @@ type Config struct { Run []string `json:"run"` } -func findConfig(fileName string) (string, error) { - homeFile := path.Join(os.Getenv("HOME"), fileName) +func findConfig(fileName string, base string) (string, error) { if _, err := os.Stat(fileName); err == nil { return fileName, nil - } else if _, err := os.Stat(homeFile); err == nil { + } + homeFile := path.Join(os.Getenv("HOME"), fileName) + if _, err := os.Stat(homeFile); err == nil { return homeFile, nil - } else { - return "", os.ErrNotExist } + siblingFile := path.Join(base, fileName) + if _, err := os.Stat(siblingFile); err == nil { + return siblingFile, nil + } + return "", os.ErrNotExist } func main() { + exepath, err := os.Executable() + if err != nil { + log.Panic(err) + } + base := filepath.Dir(exepath) confName := "mor-launch.json" - confFile, err := findConfig(confName) + confFile, err := findConfig(confName, base) if err != nil { log.Fatalf("Error finding %s: %v", confName, err) } @@ -58,6 +68,7 @@ func main() { return } cmd := exec.Command(args[0], args[1:]...) + cmd.Dir = base stdout, err := cmd.StdoutPipe() if err != nil { log.Print(err) diff --git a/proxy-router/.env.example b/proxy-router/.env.example index 975ea4d1..b9fa7702 100644 --- a/proxy-router/.env.example +++ b/proxy-router/.env.example @@ -1,18 +1,17 @@ -ETH_NODE_ADDRESS=https://rpc.ankr.com/eth -ETH_NODE_LEGACY_TX=false +DIAMOND_CONTRACT_ADDRESS=0x70768f0fF919e194E11aBFC3a2eDF43213359dc1 ENVIRONMENT=development - -WALLET_PRIVATE_KEY= - +ETH_NODE_ADDRESS=https://arbitrum-sepolia.blockpi.network/v1/rpc/public +ETH_NODE_LEGACY_TX=false +EXPLORER_API_URL="https://api-sepolia.arbiscan.io/api" LOG_COLOR=true +LOG_FOLDER_PATH= LOG_LEVEL_APP=info -LOG_LEVEL_SCHEDULER=info -LOG_LEVEL_PROXY=info LOG_LEVEL_CONNECTION=info -LOG_FOLDER_PATH=./logs/ - +LOG_LEVEL_PROXY=info +LOG_LEVEL_SCHEDULER=info +MOR_TOKEN_ADDRESS=0xc1664f994fd3991f98ae944bc16b9aed673ef5fd +OPENAI_BASE_URL=http://localhost:11434/v1 PROXY_ADDRESS=0.0.0.0:3333 - SYS_ENABLE=false SYS_LOCAL_PORT_RANGE=1024 65535 SYS_NET_DEV_MAX_BACKLOG=100000 @@ -20,9 +19,6 @@ SYS_RLIMIT_HARD=524288 SYS_RLIMIT_SOFT=524288 SYS_SOMAXCONN=100000 SYS_TCP_MAX_SYN_BACKLOG=100000 - -WEB_PUBLIC_URL= -PROVIDER_REGISTRY_ADDRESS= -MODEL_REGISTRY_ADDRESS= -MARKETPLACE_ADDRESS= +WALLET_PRIVATE_KEY= WEB_ADDRESS=0.0.0.0:8080 +WEB_PUBLIC_URL= diff --git a/proxy-router/build.sh b/proxy-router/build.sh index 04f27f64..16cc237f 100755 --- a/proxy-router/build.sh +++ b/proxy-router/build.sh @@ -1,3 +1,5 @@ +#!/bin/sh + VERSION=$(grep '^VERSION=' .version | cut -d '=' -f 2-) echo VERSION=$VERSION diff --git a/proxy-router/cmd/main.go b/proxy-router/cmd/main.go index 52600778..4ff6ba9c 100644 --- a/proxy-router/cmd/main.go +++ b/proxy-router/cmd/main.go @@ -19,8 +19,10 @@ import ( "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/morrpc" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/proxyapi" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/repositories/registries" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/repositories/transport" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/rpcproxy" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/storages" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/system" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" @@ -192,31 +194,40 @@ func start() error { return err } - tcpServer := transport.NewTCPServer(cfg.Proxy.Address, connLog.Named("TCP")) - morTcpHandler := tcphandlers.NewMorRpcHandler(cfg.Marketplace.WalletPrivateKey, publicKey, derived.WalletAddress, morrpc.NewMorRpc()) - tcpHandler := tcphandlers.NewTCPHandler( - log, connLog, schedulerLogFactory, morTcpHandler, - ) - tcpServer.SetConnectionHandler(tcpHandler) + sessionStorage := storages.NewSessionStorage() - providerRegistryAddr := common.HexToAddress(cfg.Marketplace.ProviderRegistryAddress) - modelRegistryAddr := common.HexToAddress(cfg.Marketplace.ModelRegistryAddress) - marketplaceAddr := common.HexToAddress(cfg.Marketplace.MarketplaceAddress) + diamondContractAddr := common.HexToAddress(cfg.Marketplace.DiamondContractAddress) + morContractAddr := common.HexToAddress(cfg.Marketplace.MorTokenAddress) - proxyRouterApi := proxyapi.NewProxyRouterApi(sysConfig, publicUrl, publicKey, cfg.Marketplace.WalletPrivateKey, &cfg, derived, time.Now(), contractLogStorage, log) - rpcProxy := rpcproxy.NewRpcProxy(ethClient, providerRegistryAddr, modelRegistryAddr, marketplaceAddr, proxyLog) + rpcProxy := rpcproxy.NewRpcProxy(ethClient, diamondContractAddr, morContractAddr, cfg.Blockchain.ExplorerApiUrl, cfg.Marketplace.WalletPrivateKey, proxyLog, cfg.Blockchain.EthLegacyTx) + proxyRouterApi := proxyapi.NewProxyRouterApi(sysConfig, publicUrl, publicKey, cfg.Marketplace.WalletPrivateKey, &cfg, derived, time.Now(), contractLogStorage, sessionStorage, log) aiEngine := aiengine.NewAiEngine() + + sessionRouter := registries.NewSessionRouter(diamondContractAddr, ethClient, log) + eventListener := rpcproxy.NewEventsListener(ethClient, sessionStorage, sessionRouter, log) + apiBus := apibus.NewApiBus(rpcProxy, aiEngine, proxyRouterApi) handl := httphandlers.NewHTTPHandler(apiBus) httpServer := transport.NewServer(cfg.Web.Address, handl, log.Named("HTTP")) + tcpServer := transport.NewTCPServer(cfg.Proxy.Address, connLog.Named("TCP")) + morTcpHandler := tcphandlers.NewMorRpcHandler(cfg.Marketplace.WalletPrivateKey, publicKey, derived.WalletAddress, morrpc.NewMorRpc(), sessionStorage, apiBus) + tcpHandler := tcphandlers.NewTCPHandler( + log, connLog, schedulerLogFactory, morTcpHandler, + ) + tcpServer.SetConnectionHandler(tcpHandler) + ctx, cancel = context.WithCancel(ctx) g, errCtx := errgroup.WithContext(ctx) g.Go(func() error { return tcpServer.Run(errCtx) }) + g.Go(func() error { + return eventListener.Run(errCtx) + }) + g.Go(func() error { for { select { diff --git a/proxy-router/contracts/agentregistry/AgentRegistry.go b/proxy-router/contracts/agentregistry/AgentRegistry.go index 9f252d89..d464f44e 100644 --- a/proxy-router/contracts/agentregistry/AgentRegistry.go +++ b/proxy-router/contracts/agentregistry/AgentRegistry.go @@ -34,7 +34,7 @@ type AgentRegistryAgent struct { AgentId [32]byte Fee *big.Int Stake *big.Int - Timestamp *big.Int + CreatedAt *big.Int Owner common.Address Name string Tags []string @@ -42,7 +42,7 @@ type AgentRegistryAgent struct { // AgentRegistryMetaData contains all meta data concerning the AgentRegistry contract. var AgentRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"}],\"name\":\"Deregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"MinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"}],\"name\":\"RegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"deregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAll\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"internalType\":\"structAgentRegistry.Agent[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getIds\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"setMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"}],\"name\":\"Deregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"MinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"}],\"name\":\"RegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"deregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAll\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"internalType\":\"structAgentRegistry.Agent[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getIds\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"setMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // AgentRegistryABI is the input ABI used to generate the binding from. @@ -224,7 +224,7 @@ func (_AgentRegistry *AgentRegistryCallerSession) Exists(id [32]byte) (bool, err // GetAll is a free data retrieval call binding the contract method 0x53ed5143. // -// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint256,address,string,string[])[]) +// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint128,address,string,string[])[]) func (_AgentRegistry *AgentRegistryCaller) GetAll(opts *bind.CallOpts) ([]AgentRegistryAgent, error) { var out []interface{} err := _AgentRegistry.contract.Call(opts, &out, "getAll") @@ -241,14 +241,14 @@ func (_AgentRegistry *AgentRegistryCaller) GetAll(opts *bind.CallOpts) ([]AgentR // GetAll is a free data retrieval call binding the contract method 0x53ed5143. // -// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint256,address,string,string[])[]) +// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint128,address,string,string[])[]) func (_AgentRegistry *AgentRegistrySession) GetAll() ([]AgentRegistryAgent, error) { return _AgentRegistry.Contract.GetAll(&_AgentRegistry.CallOpts) } // GetAll is a free data retrieval call binding the contract method 0x53ed5143. // -// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint256,address,string,string[])[]) +// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint128,address,string,string[])[]) func (_AgentRegistry *AgentRegistryCallerSession) GetAll() ([]AgentRegistryAgent, error) { return _AgentRegistry.Contract.GetAll(&_AgentRegistry.CallOpts) } @@ -286,12 +286,12 @@ func (_AgentRegistry *AgentRegistryCallerSession) GetIds() ([][32]byte, error) { // Map is a free data retrieval call binding the contract method 0x0ae186a8. // -// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint256 timestamp, address owner, string name) +// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint128 createdAt, address owner, string name) func (_AgentRegistry *AgentRegistryCaller) Map(opts *bind.CallOpts, arg0 [32]byte) (struct { AgentId [32]byte Fee *big.Int Stake *big.Int - Timestamp *big.Int + CreatedAt *big.Int Owner common.Address Name string }, error) { @@ -302,7 +302,7 @@ func (_AgentRegistry *AgentRegistryCaller) Map(opts *bind.CallOpts, arg0 [32]byt AgentId [32]byte Fee *big.Int Stake *big.Int - Timestamp *big.Int + CreatedAt *big.Int Owner common.Address Name string }) @@ -313,7 +313,7 @@ func (_AgentRegistry *AgentRegistryCaller) Map(opts *bind.CallOpts, arg0 [32]byt outstruct.AgentId = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) outstruct.Fee = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) outstruct.Stake = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.Timestamp = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.CreatedAt = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) outstruct.Owner = *abi.ConvertType(out[4], new(common.Address)).(*common.Address) outstruct.Name = *abi.ConvertType(out[5], new(string)).(*string) @@ -323,12 +323,12 @@ func (_AgentRegistry *AgentRegistryCaller) Map(opts *bind.CallOpts, arg0 [32]byt // Map is a free data retrieval call binding the contract method 0x0ae186a8. // -// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint256 timestamp, address owner, string name) +// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint128 createdAt, address owner, string name) func (_AgentRegistry *AgentRegistrySession) Map(arg0 [32]byte) (struct { AgentId [32]byte Fee *big.Int Stake *big.Int - Timestamp *big.Int + CreatedAt *big.Int Owner common.Address Name string }, error) { @@ -337,12 +337,12 @@ func (_AgentRegistry *AgentRegistrySession) Map(arg0 [32]byte) (struct { // Map is a free data retrieval call binding the contract method 0x0ae186a8. // -// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint256 timestamp, address owner, string name) +// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint128 createdAt, address owner, string name) func (_AgentRegistry *AgentRegistryCallerSession) Map(arg0 [32]byte) (struct { AgentId [32]byte Fee *big.Int Stake *big.Int - Timestamp *big.Int + CreatedAt *big.Int Owner common.Address Name string }, error) { diff --git a/proxy-router/contracts/marketplace/Marketplace.go b/proxy-router/contracts/marketplace/Marketplace.go index 28c8ad3b..84337e98 100644 --- a/proxy-router/contracts/marketplace/Marketplace.go +++ b/proxy-router/contracts/marketplace/Marketplace.go @@ -29,19 +29,19 @@ var ( _ = abi.ConvertType ) -// MarketplaceBid is an auto generated low-level Go binding around an user-defined struct. -type MarketplaceBid struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int +// Bid is an auto generated low-level Go binding around an user-defined struct. +type Bid struct { + Provider common.Address + ModelAgentId [32]byte + PricePerSecond *big.Int + Nonce *big.Int + CreatedAt *big.Int + DeletedAt *big.Int } // MarketplaceMetaData contains all meta data concerning the Marketplace contract. var MarketplaceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"ActiveBidNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelOrAgentNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughWithdrawableBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"BidDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"BidPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"modelFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"agentFee\",\"type\":\"uint256\"}],\"name\":\"FeeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"agentBidFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"}],\"name\":\"deleteModelAgentBid\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"}],\"name\":\"getActiveBidsByModelAgent\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"internalType\":\"structMarketplace.Bid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"getActiveBidsByProvider\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"internalType\":\"structMarketplace.Bid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getBidsByModelAgent\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"internalType\":\"structMarketplace.Bid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getBidsByProvider\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"internalType\":\"structMarketplace.Bid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"modelRegistryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"providerRegistryAddr\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"modelBidFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"modelRegistry\",\"outputs\":[{\"internalType\":\"contractModelRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"providerAddr\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"postModelBid\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"providerModelAgentNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"providerRegistry\",\"outputs\":[{\"internalType\":\"contractProviderRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"modelFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"agentFee\",\"type\":\"uint256\"}],\"name\":\"setBidFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"ActiveBidNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BidNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BidTaken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelOrAgentNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_contractOwner\",\"type\":\"address\"}],\"name\":\"NotContractOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ProviderNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"BidDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"BidPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bidFee\",\"type\":\"uint256\"}],\"name\":\"FeeUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"bidFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"}],\"name\":\"bidMap\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"deletedAt\",\"type\":\"uint128\"}],\"internalType\":\"structBid\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"}],\"name\":\"deleteModelAgentBid\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"}],\"name\":\"getActiveBidsByModelAgent\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"deletedAt\",\"type\":\"uint128\"}],\"internalType\":\"structBid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"getActiveBidsByProvider\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"deletedAt\",\"type\":\"uint128\"}],\"internalType\":\"structBid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getBidsByModelAgent\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"deletedAt\",\"type\":\"uint128\"}],\"internalType\":\"structBid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getBidsByProvider\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"deletedAt\",\"type\":\"uint128\"}],\"internalType\":\"structBid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"providerAddr\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"}],\"name\":\"postModelBid\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bidFee\",\"type\":\"uint256\"}],\"name\":\"setBidFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // MarketplaceABI is the input ABI used to generate the binding from. @@ -190,12 +190,12 @@ func (_Marketplace *MarketplaceTransactorRaw) Transact(opts *bind.TransactOpts, return _Marketplace.Contract.contract.Transact(opts, method, params...) } -// AgentBidFee is a free data retrieval call binding the contract method 0x113d91c9. +// BidFee is a free data retrieval call binding the contract method 0xe14a2115. // -// Solidity: function agentBidFee() view returns(uint256) -func (_Marketplace *MarketplaceCaller) AgentBidFee(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function bidFee() view returns(uint256) +func (_Marketplace *MarketplaceCaller) BidFee(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "agentBidFee") + err := _Marketplace.contract.Call(opts, &out, "bidFee") if err != nil { return *new(*big.Int), err @@ -207,32 +207,63 @@ func (_Marketplace *MarketplaceCaller) AgentBidFee(opts *bind.CallOpts) (*big.In } -// AgentBidFee is a free data retrieval call binding the contract method 0x113d91c9. +// BidFee is a free data retrieval call binding the contract method 0xe14a2115. // -// Solidity: function agentBidFee() view returns(uint256) -func (_Marketplace *MarketplaceSession) AgentBidFee() (*big.Int, error) { - return _Marketplace.Contract.AgentBidFee(&_Marketplace.CallOpts) +// Solidity: function bidFee() view returns(uint256) +func (_Marketplace *MarketplaceSession) BidFee() (*big.Int, error) { + return _Marketplace.Contract.BidFee(&_Marketplace.CallOpts) } -// AgentBidFee is a free data retrieval call binding the contract method 0x113d91c9. +// BidFee is a free data retrieval call binding the contract method 0xe14a2115. // -// Solidity: function agentBidFee() view returns(uint256) -func (_Marketplace *MarketplaceCallerSession) AgentBidFee() (*big.Int, error) { - return _Marketplace.Contract.AgentBidFee(&_Marketplace.CallOpts) +// Solidity: function bidFee() view returns(uint256) +func (_Marketplace *MarketplaceCallerSession) BidFee() (*big.Int, error) { + return _Marketplace.Contract.BidFee(&_Marketplace.CallOpts) +} + +// BidMap is a free data retrieval call binding the contract method 0xf141c9a3. +// +// Solidity: function bidMap(bytes32 bidId) view returns((address,bytes32,uint256,uint256,uint128,uint128)) +func (_Marketplace *MarketplaceCaller) BidMap(opts *bind.CallOpts, bidId [32]byte) (Bid, error) { + var out []interface{} + err := _Marketplace.contract.Call(opts, &out, "bidMap", bidId) + + if err != nil { + return *new(Bid), err + } + + out0 := *abi.ConvertType(out[0], new(Bid)).(*Bid) + + return out0, err + +} + +// BidMap is a free data retrieval call binding the contract method 0xf141c9a3. +// +// Solidity: function bidMap(bytes32 bidId) view returns((address,bytes32,uint256,uint256,uint128,uint128)) +func (_Marketplace *MarketplaceSession) BidMap(bidId [32]byte) (Bid, error) { + return _Marketplace.Contract.BidMap(&_Marketplace.CallOpts, bidId) +} + +// BidMap is a free data retrieval call binding the contract method 0xf141c9a3. +// +// Solidity: function bidMap(bytes32 bidId) view returns((address,bytes32,uint256,uint256,uint128,uint128)) +func (_Marketplace *MarketplaceCallerSession) BidMap(bidId [32]byte) (Bid, error) { + return _Marketplace.Contract.BidMap(&_Marketplace.CallOpts, bidId) } // GetActiveBidsByModelAgent is a free data retrieval call binding the contract method 0x873d94d5. // -// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCaller) GetActiveBidsByModelAgent(opts *bind.CallOpts, modelAgentId [32]byte) ([]MarketplaceBid, error) { +// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceCaller) GetActiveBidsByModelAgent(opts *bind.CallOpts, modelAgentId [32]byte) ([]Bid, error) { var out []interface{} err := _Marketplace.contract.Call(opts, &out, "getActiveBidsByModelAgent", modelAgentId) if err != nil { - return *new([]MarketplaceBid), err + return *new([]Bid), err } - out0 := *abi.ConvertType(out[0], new([]MarketplaceBid)).(*[]MarketplaceBid) + out0 := *abi.ConvertType(out[0], new([]Bid)).(*[]Bid) return out0, err @@ -240,30 +271,30 @@ func (_Marketplace *MarketplaceCaller) GetActiveBidsByModelAgent(opts *bind.Call // GetActiveBidsByModelAgent is a free data retrieval call binding the contract method 0x873d94d5. // -// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceSession) GetActiveBidsByModelAgent(modelAgentId [32]byte) ([]MarketplaceBid, error) { +// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceSession) GetActiveBidsByModelAgent(modelAgentId [32]byte) ([]Bid, error) { return _Marketplace.Contract.GetActiveBidsByModelAgent(&_Marketplace.CallOpts, modelAgentId) } // GetActiveBidsByModelAgent is a free data retrieval call binding the contract method 0x873d94d5. // -// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCallerSession) GetActiveBidsByModelAgent(modelAgentId [32]byte) ([]MarketplaceBid, error) { +// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceCallerSession) GetActiveBidsByModelAgent(modelAgentId [32]byte) ([]Bid, error) { return _Marketplace.Contract.GetActiveBidsByModelAgent(&_Marketplace.CallOpts, modelAgentId) } // GetActiveBidsByProvider is a free data retrieval call binding the contract method 0x9fdaffd0. // -// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCaller) GetActiveBidsByProvider(opts *bind.CallOpts, provider common.Address) ([]MarketplaceBid, error) { +// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceCaller) GetActiveBidsByProvider(opts *bind.CallOpts, provider common.Address) ([]Bid, error) { var out []interface{} err := _Marketplace.contract.Call(opts, &out, "getActiveBidsByProvider", provider) if err != nil { - return *new([]MarketplaceBid), err + return *new([]Bid), err } - out0 := *abi.ConvertType(out[0], new([]MarketplaceBid)).(*[]MarketplaceBid) + out0 := *abi.ConvertType(out[0], new([]Bid)).(*[]Bid) return out0, err @@ -271,331 +302,82 @@ func (_Marketplace *MarketplaceCaller) GetActiveBidsByProvider(opts *bind.CallOp // GetActiveBidsByProvider is a free data retrieval call binding the contract method 0x9fdaffd0. // -// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceSession) GetActiveBidsByProvider(provider common.Address) ([]MarketplaceBid, error) { +// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceSession) GetActiveBidsByProvider(provider common.Address) ([]Bid, error) { return _Marketplace.Contract.GetActiveBidsByProvider(&_Marketplace.CallOpts, provider) } // GetActiveBidsByProvider is a free data retrieval call binding the contract method 0x9fdaffd0. // -// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCallerSession) GetActiveBidsByProvider(provider common.Address) ([]MarketplaceBid, error) { +// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceCallerSession) GetActiveBidsByProvider(provider common.Address) ([]Bid, error) { return _Marketplace.Contract.GetActiveBidsByProvider(&_Marketplace.CallOpts, provider) } // GetBidsByModelAgent is a free data retrieval call binding the contract method 0xa87665ec. // -// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCaller) GetBidsByModelAgent(opts *bind.CallOpts, modelAgentId [32]byte, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { +// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns(bytes32[], (address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceCaller) GetBidsByModelAgent(opts *bind.CallOpts, modelAgentId [32]byte, offset *big.Int, limit uint8) ([][32]byte, []Bid, error) { var out []interface{} err := _Marketplace.contract.Call(opts, &out, "getBidsByModelAgent", modelAgentId, offset, limit) if err != nil { - return *new([]MarketplaceBid), err + return *new([][32]byte), *new([]Bid), err } - out0 := *abi.ConvertType(out[0], new([]MarketplaceBid)).(*[]MarketplaceBid) + out0 := *abi.ConvertType(out[0], new([][32]byte)).(*[][32]byte) + out1 := *abi.ConvertType(out[1], new([]Bid)).(*[]Bid) - return out0, err + return out0, out1, err } // GetBidsByModelAgent is a free data retrieval call binding the contract method 0xa87665ec. // -// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceSession) GetBidsByModelAgent(modelAgentId [32]byte, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { +// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns(bytes32[], (address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceSession) GetBidsByModelAgent(modelAgentId [32]byte, offset *big.Int, limit uint8) ([][32]byte, []Bid, error) { return _Marketplace.Contract.GetBidsByModelAgent(&_Marketplace.CallOpts, modelAgentId, offset, limit) } // GetBidsByModelAgent is a free data retrieval call binding the contract method 0xa87665ec. // -// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCallerSession) GetBidsByModelAgent(modelAgentId [32]byte, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { +// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns(bytes32[], (address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceCallerSession) GetBidsByModelAgent(modelAgentId [32]byte, offset *big.Int, limit uint8) ([][32]byte, []Bid, error) { return _Marketplace.Contract.GetBidsByModelAgent(&_Marketplace.CallOpts, modelAgentId, offset, limit) } // GetBidsByProvider is a free data retrieval call binding the contract method 0x2f817685. // -// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCaller) GetBidsByProvider(opts *bind.CallOpts, provider common.Address, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { +// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns(bytes32[], (address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceCaller) GetBidsByProvider(opts *bind.CallOpts, provider common.Address, offset *big.Int, limit uint8) ([][32]byte, []Bid, error) { var out []interface{} err := _Marketplace.contract.Call(opts, &out, "getBidsByProvider", provider, offset, limit) if err != nil { - return *new([]MarketplaceBid), err + return *new([][32]byte), *new([]Bid), err } - out0 := *abi.ConvertType(out[0], new([]MarketplaceBid)).(*[]MarketplaceBid) + out0 := *abi.ConvertType(out[0], new([][32]byte)).(*[][32]byte) + out1 := *abi.ConvertType(out[1], new([]Bid)).(*[]Bid) - return out0, err + return out0, out1, err } // GetBidsByProvider is a free data retrieval call binding the contract method 0x2f817685. // -// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceSession) GetBidsByProvider(provider common.Address, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { +// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns(bytes32[], (address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceSession) GetBidsByProvider(provider common.Address, offset *big.Int, limit uint8) ([][32]byte, []Bid, error) { return _Marketplace.Contract.GetBidsByProvider(&_Marketplace.CallOpts, provider, offset, limit) } // GetBidsByProvider is a free data retrieval call binding the contract method 0x2f817685. // -// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCallerSession) GetBidsByProvider(provider common.Address, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { +// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns(bytes32[], (address,bytes32,uint256,uint256,uint128,uint128)[]) +func (_Marketplace *MarketplaceCallerSession) GetBidsByProvider(provider common.Address, offset *big.Int, limit uint8) ([][32]byte, []Bid, error) { return _Marketplace.Contract.GetBidsByProvider(&_Marketplace.CallOpts, provider, offset, limit) } -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(address provider, bytes32 modelAgentId, uint256 amount, uint256 nonce, uint256 createdAt, uint256 deletedAt) -func (_Marketplace *MarketplaceCaller) Map(opts *bind.CallOpts, arg0 [32]byte) (struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int -}, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "map", arg0) - - outstruct := new(struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Provider = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - outstruct.ModelAgentId = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) - outstruct.Amount = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.Nonce = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) - outstruct.CreatedAt = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) - outstruct.DeletedAt = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(address provider, bytes32 modelAgentId, uint256 amount, uint256 nonce, uint256 createdAt, uint256 deletedAt) -func (_Marketplace *MarketplaceSession) Map(arg0 [32]byte) (struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int -}, error) { - return _Marketplace.Contract.Map(&_Marketplace.CallOpts, arg0) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(address provider, bytes32 modelAgentId, uint256 amount, uint256 nonce, uint256 createdAt, uint256 deletedAt) -func (_Marketplace *MarketplaceCallerSession) Map(arg0 [32]byte) (struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int -}, error) { - return _Marketplace.Contract.Map(&_Marketplace.CallOpts, arg0) -} - -// ModelBidFee is a free data retrieval call binding the contract method 0x7c785e73. -// -// Solidity: function modelBidFee() view returns(uint256) -func (_Marketplace *MarketplaceCaller) ModelBidFee(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "modelBidFee") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// ModelBidFee is a free data retrieval call binding the contract method 0x7c785e73. -// -// Solidity: function modelBidFee() view returns(uint256) -func (_Marketplace *MarketplaceSession) ModelBidFee() (*big.Int, error) { - return _Marketplace.Contract.ModelBidFee(&_Marketplace.CallOpts) -} - -// ModelBidFee is a free data retrieval call binding the contract method 0x7c785e73. -// -// Solidity: function modelBidFee() view returns(uint256) -func (_Marketplace *MarketplaceCallerSession) ModelBidFee() (*big.Int, error) { - return _Marketplace.Contract.ModelBidFee(&_Marketplace.CallOpts) -} - -// ModelRegistry is a free data retrieval call binding the contract method 0x2ba36f78. -// -// Solidity: function modelRegistry() view returns(address) -func (_Marketplace *MarketplaceCaller) ModelRegistry(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "modelRegistry") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// ModelRegistry is a free data retrieval call binding the contract method 0x2ba36f78. -// -// Solidity: function modelRegistry() view returns(address) -func (_Marketplace *MarketplaceSession) ModelRegistry() (common.Address, error) { - return _Marketplace.Contract.ModelRegistry(&_Marketplace.CallOpts) -} - -// ModelRegistry is a free data retrieval call binding the contract method 0x2ba36f78. -// -// Solidity: function modelRegistry() view returns(address) -func (_Marketplace *MarketplaceCallerSession) ModelRegistry() (common.Address, error) { - return _Marketplace.Contract.ModelRegistry(&_Marketplace.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Marketplace *MarketplaceCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Marketplace *MarketplaceSession) Owner() (common.Address, error) { - return _Marketplace.Contract.Owner(&_Marketplace.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Marketplace *MarketplaceCallerSession) Owner() (common.Address, error) { - return _Marketplace.Contract.Owner(&_Marketplace.CallOpts) -} - -// ProviderModelAgentNonce is a free data retrieval call binding the contract method 0x93ec6bc5. -// -// Solidity: function providerModelAgentNonce(bytes32 ) view returns(uint256) -func (_Marketplace *MarketplaceCaller) ProviderModelAgentNonce(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "providerModelAgentNonce", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// ProviderModelAgentNonce is a free data retrieval call binding the contract method 0x93ec6bc5. -// -// Solidity: function providerModelAgentNonce(bytes32 ) view returns(uint256) -func (_Marketplace *MarketplaceSession) ProviderModelAgentNonce(arg0 [32]byte) (*big.Int, error) { - return _Marketplace.Contract.ProviderModelAgentNonce(&_Marketplace.CallOpts, arg0) -} - -// ProviderModelAgentNonce is a free data retrieval call binding the contract method 0x93ec6bc5. -// -// Solidity: function providerModelAgentNonce(bytes32 ) view returns(uint256) -func (_Marketplace *MarketplaceCallerSession) ProviderModelAgentNonce(arg0 [32]byte) (*big.Int, error) { - return _Marketplace.Contract.ProviderModelAgentNonce(&_Marketplace.CallOpts, arg0) -} - -// ProviderRegistry is a free data retrieval call binding the contract method 0x545921d9. -// -// Solidity: function providerRegistry() view returns(address) -func (_Marketplace *MarketplaceCaller) ProviderRegistry(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "providerRegistry") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// ProviderRegistry is a free data retrieval call binding the contract method 0x545921d9. -// -// Solidity: function providerRegistry() view returns(address) -func (_Marketplace *MarketplaceSession) ProviderRegistry() (common.Address, error) { - return _Marketplace.Contract.ProviderRegistry(&_Marketplace.CallOpts) -} - -// ProviderRegistry is a free data retrieval call binding the contract method 0x545921d9. -// -// Solidity: function providerRegistry() view returns(address) -func (_Marketplace *MarketplaceCallerSession) ProviderRegistry() (common.Address, error) { - return _Marketplace.Contract.ProviderRegistry(&_Marketplace.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_Marketplace *MarketplaceCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_Marketplace *MarketplaceSession) Token() (common.Address, error) { - return _Marketplace.Contract.Token(&_Marketplace.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_Marketplace *MarketplaceCallerSession) Token() (common.Address, error) { - return _Marketplace.Contract.Token(&_Marketplace.CallOpts) -} - // DeleteModelAgentBid is a paid mutator transaction binding the contract method 0x42856b75. // // Solidity: function deleteModelAgentBid(bytes32 bidId) returns() @@ -617,109 +399,46 @@ func (_Marketplace *MarketplaceTransactorSession) DeleteModelAgentBid(bidId [32] return _Marketplace.Contract.DeleteModelAgentBid(&_Marketplace.TransactOpts, bidId) } -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address modelRegistryAddr, address providerRegistryAddr) returns() -func (_Marketplace *MarketplaceTransactor) Initialize(opts *bind.TransactOpts, _token common.Address, modelRegistryAddr common.Address, providerRegistryAddr common.Address) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "initialize", _token, modelRegistryAddr, providerRegistryAddr) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address modelRegistryAddr, address providerRegistryAddr) returns() -func (_Marketplace *MarketplaceSession) Initialize(_token common.Address, modelRegistryAddr common.Address, providerRegistryAddr common.Address) (*types.Transaction, error) { - return _Marketplace.Contract.Initialize(&_Marketplace.TransactOpts, _token, modelRegistryAddr, providerRegistryAddr) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address modelRegistryAddr, address providerRegistryAddr) returns() -func (_Marketplace *MarketplaceTransactorSession) Initialize(_token common.Address, modelRegistryAddr common.Address, providerRegistryAddr common.Address) (*types.Transaction, error) { - return _Marketplace.Contract.Initialize(&_Marketplace.TransactOpts, _token, modelRegistryAddr, providerRegistryAddr) -} - // PostModelBid is a paid mutator transaction binding the contract method 0xede96bb1. // -// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 amount) returns(bytes32 bidId) -func (_Marketplace *MarketplaceTransactor) PostModelBid(opts *bind.TransactOpts, providerAddr common.Address, modelId [32]byte, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "postModelBid", providerAddr, modelId, amount) +// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 pricePerSecond) returns(bytes32 bidId) +func (_Marketplace *MarketplaceTransactor) PostModelBid(opts *bind.TransactOpts, providerAddr common.Address, modelId [32]byte, pricePerSecond *big.Int) (*types.Transaction, error) { + return _Marketplace.contract.Transact(opts, "postModelBid", providerAddr, modelId, pricePerSecond) } // PostModelBid is a paid mutator transaction binding the contract method 0xede96bb1. // -// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 amount) returns(bytes32 bidId) -func (_Marketplace *MarketplaceSession) PostModelBid(providerAddr common.Address, modelId [32]byte, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.PostModelBid(&_Marketplace.TransactOpts, providerAddr, modelId, amount) +// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 pricePerSecond) returns(bytes32 bidId) +func (_Marketplace *MarketplaceSession) PostModelBid(providerAddr common.Address, modelId [32]byte, pricePerSecond *big.Int) (*types.Transaction, error) { + return _Marketplace.Contract.PostModelBid(&_Marketplace.TransactOpts, providerAddr, modelId, pricePerSecond) } // PostModelBid is a paid mutator transaction binding the contract method 0xede96bb1. // -// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 amount) returns(bytes32 bidId) -func (_Marketplace *MarketplaceTransactorSession) PostModelBid(providerAddr common.Address, modelId [32]byte, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.PostModelBid(&_Marketplace.TransactOpts, providerAddr, modelId, amount) +// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 pricePerSecond) returns(bytes32 bidId) +func (_Marketplace *MarketplaceTransactorSession) PostModelBid(providerAddr common.Address, modelId [32]byte, pricePerSecond *big.Int) (*types.Transaction, error) { + return _Marketplace.Contract.PostModelBid(&_Marketplace.TransactOpts, providerAddr, modelId, pricePerSecond) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// SetBidFee is a paid mutator transaction binding the contract method 0x013869bf. // -// Solidity: function renounceOwnership() returns() -func (_Marketplace *MarketplaceTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "renounceOwnership") +// Solidity: function setBidFee(uint256 _bidFee) returns() +func (_Marketplace *MarketplaceTransactor) SetBidFee(opts *bind.TransactOpts, _bidFee *big.Int) (*types.Transaction, error) { + return _Marketplace.contract.Transact(opts, "setBidFee", _bidFee) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// SetBidFee is a paid mutator transaction binding the contract method 0x013869bf. // -// Solidity: function renounceOwnership() returns() -func (_Marketplace *MarketplaceSession) RenounceOwnership() (*types.Transaction, error) { - return _Marketplace.Contract.RenounceOwnership(&_Marketplace.TransactOpts) +// Solidity: function setBidFee(uint256 _bidFee) returns() +func (_Marketplace *MarketplaceSession) SetBidFee(_bidFee *big.Int) (*types.Transaction, error) { + return _Marketplace.Contract.SetBidFee(&_Marketplace.TransactOpts, _bidFee) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// SetBidFee is a paid mutator transaction binding the contract method 0x013869bf. // -// Solidity: function renounceOwnership() returns() -func (_Marketplace *MarketplaceTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _Marketplace.Contract.RenounceOwnership(&_Marketplace.TransactOpts) -} - -// SetBidFee is a paid mutator transaction binding the contract method 0xcef0b7f4. -// -// Solidity: function setBidFee(uint256 modelFee, uint256 agentFee) returns() -func (_Marketplace *MarketplaceTransactor) SetBidFee(opts *bind.TransactOpts, modelFee *big.Int, agentFee *big.Int) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "setBidFee", modelFee, agentFee) -} - -// SetBidFee is a paid mutator transaction binding the contract method 0xcef0b7f4. -// -// Solidity: function setBidFee(uint256 modelFee, uint256 agentFee) returns() -func (_Marketplace *MarketplaceSession) SetBidFee(modelFee *big.Int, agentFee *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.SetBidFee(&_Marketplace.TransactOpts, modelFee, agentFee) -} - -// SetBidFee is a paid mutator transaction binding the contract method 0xcef0b7f4. -// -// Solidity: function setBidFee(uint256 modelFee, uint256 agentFee) returns() -func (_Marketplace *MarketplaceTransactorSession) SetBidFee(modelFee *big.Int, agentFee *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.SetBidFee(&_Marketplace.TransactOpts, modelFee, agentFee) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_Marketplace *MarketplaceTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_Marketplace *MarketplaceSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _Marketplace.Contract.TransferOwnership(&_Marketplace.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_Marketplace *MarketplaceTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _Marketplace.Contract.TransferOwnership(&_Marketplace.TransactOpts, newOwner) +// Solidity: function setBidFee(uint256 _bidFee) returns() +func (_Marketplace *MarketplaceTransactorSession) SetBidFee(_bidFee *big.Int) (*types.Transaction, error) { + return _Marketplace.Contract.SetBidFee(&_Marketplace.TransactOpts, _bidFee) } // Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. @@ -1120,14 +839,13 @@ func (it *MarketplaceFeeUpdatedIterator) Close() error { // MarketplaceFeeUpdated represents a FeeUpdated event raised by the Marketplace contract. type MarketplaceFeeUpdated struct { - ModelFee *big.Int - AgentFee *big.Int - Raw types.Log // Blockchain specific contextual infos + BidFee *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterFeeUpdated is a free log retrieval operation binding the contract event 0x528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302. +// FilterFeeUpdated is a free log retrieval operation binding the contract event 0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76. // -// Solidity: event FeeUpdated(uint256 modelFee, uint256 agentFee) +// Solidity: event FeeUpdated(uint256 bidFee) func (_Marketplace *MarketplaceFilterer) FilterFeeUpdated(opts *bind.FilterOpts) (*MarketplaceFeeUpdatedIterator, error) { logs, sub, err := _Marketplace.contract.FilterLogs(opts, "FeeUpdated") @@ -1137,9 +855,9 @@ func (_Marketplace *MarketplaceFilterer) FilterFeeUpdated(opts *bind.FilterOpts) return &MarketplaceFeeUpdatedIterator{contract: _Marketplace.contract, event: "FeeUpdated", logs: logs, sub: sub}, nil } -// WatchFeeUpdated is a free log subscription operation binding the contract event 0x528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302. +// WatchFeeUpdated is a free log subscription operation binding the contract event 0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76. // -// Solidity: event FeeUpdated(uint256 modelFee, uint256 agentFee) +// Solidity: event FeeUpdated(uint256 bidFee) func (_Marketplace *MarketplaceFilterer) WatchFeeUpdated(opts *bind.WatchOpts, sink chan<- *MarketplaceFeeUpdated) (event.Subscription, error) { logs, sub, err := _Marketplace.contract.WatchLogs(opts, "FeeUpdated") @@ -1174,9 +892,9 @@ func (_Marketplace *MarketplaceFilterer) WatchFeeUpdated(opts *bind.WatchOpts, s }), nil } -// ParseFeeUpdated is a log parse operation binding the contract event 0x528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302. +// ParseFeeUpdated is a log parse operation binding the contract event 0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76. // -// Solidity: event FeeUpdated(uint256 modelFee, uint256 agentFee) +// Solidity: event FeeUpdated(uint256 bidFee) func (_Marketplace *MarketplaceFilterer) ParseFeeUpdated(log types.Log) (*MarketplaceFeeUpdated, error) { event := new(MarketplaceFeeUpdated) if err := _Marketplace.contract.UnpackLog(event, "FeeUpdated", log); err != nil { @@ -1185,290 +903,3 @@ func (_Marketplace *MarketplaceFilterer) ParseFeeUpdated(log types.Log) (*Market event.Raw = log return event, nil } - -// MarketplaceInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the Marketplace contract. -type MarketplaceInitializedIterator struct { - Event *MarketplaceInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *MarketplaceInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(MarketplaceInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(MarketplaceInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *MarketplaceInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *MarketplaceInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// MarketplaceInitialized represents a Initialized event raised by the Marketplace contract. -type MarketplaceInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_Marketplace *MarketplaceFilterer) FilterInitialized(opts *bind.FilterOpts) (*MarketplaceInitializedIterator, error) { - - logs, sub, err := _Marketplace.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &MarketplaceInitializedIterator{contract: _Marketplace.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_Marketplace *MarketplaceFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *MarketplaceInitialized) (event.Subscription, error) { - - logs, sub, err := _Marketplace.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(MarketplaceInitialized) - if err := _Marketplace.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_Marketplace *MarketplaceFilterer) ParseInitialized(log types.Log) (*MarketplaceInitialized, error) { - event := new(MarketplaceInitialized) - if err := _Marketplace.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// MarketplaceOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Marketplace contract. -type MarketplaceOwnershipTransferredIterator struct { - Event *MarketplaceOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *MarketplaceOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(MarketplaceOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(MarketplaceOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *MarketplaceOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *MarketplaceOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// MarketplaceOwnershipTransferred represents a OwnershipTransferred event raised by the Marketplace contract. -type MarketplaceOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_Marketplace *MarketplaceFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*MarketplaceOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _Marketplace.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &MarketplaceOwnershipTransferredIterator{contract: _Marketplace.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_Marketplace *MarketplaceFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *MarketplaceOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _Marketplace.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(MarketplaceOwnershipTransferred) - if err := _Marketplace.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_Marketplace *MarketplaceFilterer) ParseOwnershipTransferred(log types.Log) (*MarketplaceOwnershipTransferred, error) { - event := new(MarketplaceOwnershipTransferred) - if err := _Marketplace.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/proxy-router/contracts/modelregistry/ModelRegistry.go b/proxy-router/contracts/modelregistry/ModelRegistry.go index 50b23bed..a8968ba7 100644 --- a/proxy-router/contracts/modelregistry/ModelRegistry.go +++ b/proxy-router/contracts/modelregistry/ModelRegistry.go @@ -29,21 +29,21 @@ var ( _ = abi.ConvertType ) -// ModelRegistryModel is an auto generated low-level Go binding around an user-defined struct. -type ModelRegistryModel struct { +// Model is an auto generated low-level Go binding around an user-defined struct. +type Model struct { IpfsCID [32]byte Fee *big.Int Stake *big.Int Owner common.Address Name string Tags []string - Timestamp *big.Int + CreatedAt *big.Int IsDeleted bool } // ModelRegistryMetaData contains all meta data concerning the ModelRegistry contract. var ModelRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"}],\"name\":\"Deregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"MinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"}],\"name\":\"RegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"deregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAll\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structModelRegistry.Model[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getByIndex\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structModelRegistry.Model\",\"name\":\"model\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getIds\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"models\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"setMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_contractOwner\",\"type\":\"address\"}],\"name\":\"NotContractOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"}],\"name\":\"ModelDeregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"ModelMinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"}],\"name\":\"ModelRegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"modelDeregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"modelExists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"modelGetAll\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structModel[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"modelGetByIndex\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structModel\",\"name\":\"model\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"modelGetCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"modelGetIds\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"modelMap\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structModel\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"modelMinStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"name\":\"modelRegister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"modelSetMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"models\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ModelRegistryABI is the input ABI used to generate the binding from. @@ -192,12 +192,12 @@ func (_ModelRegistry *ModelRegistryTransactorRaw) Transact(opts *bind.TransactOp return _ModelRegistry.Contract.contract.Transact(opts, method, params...) } -// Exists is a free data retrieval call binding the contract method 0x38a699a4. +// ModelExists is a free data retrieval call binding the contract method 0x022964d2. // -// Solidity: function exists(bytes32 id) view returns(bool) -func (_ModelRegistry *ModelRegistryCaller) Exists(opts *bind.CallOpts, id [32]byte) (bool, error) { +// Solidity: function modelExists(bytes32 id) view returns(bool) +func (_ModelRegistry *ModelRegistryCaller) ModelExists(opts *bind.CallOpts, id [32]byte) (bool, error) { var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "exists", id) + err := _ModelRegistry.contract.Call(opts, &out, "modelExists", id) if err != nil { return *new(bool), err @@ -209,102 +209,103 @@ func (_ModelRegistry *ModelRegistryCaller) Exists(opts *bind.CallOpts, id [32]by } -// Exists is a free data retrieval call binding the contract method 0x38a699a4. +// ModelExists is a free data retrieval call binding the contract method 0x022964d2. // -// Solidity: function exists(bytes32 id) view returns(bool) -func (_ModelRegistry *ModelRegistrySession) Exists(id [32]byte) (bool, error) { - return _ModelRegistry.Contract.Exists(&_ModelRegistry.CallOpts, id) +// Solidity: function modelExists(bytes32 id) view returns(bool) +func (_ModelRegistry *ModelRegistrySession) ModelExists(id [32]byte) (bool, error) { + return _ModelRegistry.Contract.ModelExists(&_ModelRegistry.CallOpts, id) } -// Exists is a free data retrieval call binding the contract method 0x38a699a4. +// ModelExists is a free data retrieval call binding the contract method 0x022964d2. // -// Solidity: function exists(bytes32 id) view returns(bool) -func (_ModelRegistry *ModelRegistryCallerSession) Exists(id [32]byte) (bool, error) { - return _ModelRegistry.Contract.Exists(&_ModelRegistry.CallOpts, id) +// Solidity: function modelExists(bytes32 id) view returns(bool) +func (_ModelRegistry *ModelRegistryCallerSession) ModelExists(id [32]byte) (bool, error) { + return _ModelRegistry.Contract.ModelExists(&_ModelRegistry.CallOpts, id) } -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. +// ModelGetAll is a free data retrieval call binding the contract method 0xb889c67b. // -// Solidity: function getAll() view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) -func (_ModelRegistry *ModelRegistryCaller) GetAll(opts *bind.CallOpts) ([]ModelRegistryModel, error) { +// Solidity: function modelGetAll() view returns(bytes32[], (bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) +func (_ModelRegistry *ModelRegistryCaller) ModelGetAll(opts *bind.CallOpts) ([][32]byte, []Model, error) { var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "getAll") + err := _ModelRegistry.contract.Call(opts, &out, "modelGetAll") if err != nil { - return *new([]ModelRegistryModel), err + return *new([][32]byte), *new([]Model), err } - out0 := *abi.ConvertType(out[0], new([]ModelRegistryModel)).(*[]ModelRegistryModel) + out0 := *abi.ConvertType(out[0], new([][32]byte)).(*[][32]byte) + out1 := *abi.ConvertType(out[1], new([]Model)).(*[]Model) - return out0, err + return out0, out1, err } -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. +// ModelGetAll is a free data retrieval call binding the contract method 0xb889c67b. // -// Solidity: function getAll() view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) -func (_ModelRegistry *ModelRegistrySession) GetAll() ([]ModelRegistryModel, error) { - return _ModelRegistry.Contract.GetAll(&_ModelRegistry.CallOpts) +// Solidity: function modelGetAll() view returns(bytes32[], (bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) +func (_ModelRegistry *ModelRegistrySession) ModelGetAll() ([][32]byte, []Model, error) { + return _ModelRegistry.Contract.ModelGetAll(&_ModelRegistry.CallOpts) } -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. +// ModelGetAll is a free data retrieval call binding the contract method 0xb889c67b. // -// Solidity: function getAll() view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) -func (_ModelRegistry *ModelRegistryCallerSession) GetAll() ([]ModelRegistryModel, error) { - return _ModelRegistry.Contract.GetAll(&_ModelRegistry.CallOpts) +// Solidity: function modelGetAll() view returns(bytes32[], (bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) +func (_ModelRegistry *ModelRegistryCallerSession) ModelGetAll() ([][32]byte, []Model, error) { + return _ModelRegistry.Contract.ModelGetAll(&_ModelRegistry.CallOpts) } -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. +// ModelGetByIndex is a free data retrieval call binding the contract method 0x43119765. // -// Solidity: function getByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) -func (_ModelRegistry *ModelRegistryCaller) GetByIndex(opts *bind.CallOpts, index *big.Int) (struct { +// Solidity: function modelGetByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) +func (_ModelRegistry *ModelRegistryCaller) ModelGetByIndex(opts *bind.CallOpts, index *big.Int) (struct { ModelId [32]byte - Model ModelRegistryModel + Model Model }, error) { var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "getByIndex", index) + err := _ModelRegistry.contract.Call(opts, &out, "modelGetByIndex", index) outstruct := new(struct { ModelId [32]byte - Model ModelRegistryModel + Model Model }) if err != nil { return *outstruct, err } outstruct.ModelId = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.Model = *abi.ConvertType(out[1], new(ModelRegistryModel)).(*ModelRegistryModel) + outstruct.Model = *abi.ConvertType(out[1], new(Model)).(*Model) return *outstruct, err } -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. +// ModelGetByIndex is a free data retrieval call binding the contract method 0x43119765. // -// Solidity: function getByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) -func (_ModelRegistry *ModelRegistrySession) GetByIndex(index *big.Int) (struct { +// Solidity: function modelGetByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) +func (_ModelRegistry *ModelRegistrySession) ModelGetByIndex(index *big.Int) (struct { ModelId [32]byte - Model ModelRegistryModel + Model Model }, error) { - return _ModelRegistry.Contract.GetByIndex(&_ModelRegistry.CallOpts, index) + return _ModelRegistry.Contract.ModelGetByIndex(&_ModelRegistry.CallOpts, index) } -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. +// ModelGetByIndex is a free data retrieval call binding the contract method 0x43119765. // -// Solidity: function getByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) -func (_ModelRegistry *ModelRegistryCallerSession) GetByIndex(index *big.Int) (struct { +// Solidity: function modelGetByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) +func (_ModelRegistry *ModelRegistryCallerSession) ModelGetByIndex(index *big.Int) (struct { ModelId [32]byte - Model ModelRegistryModel + Model Model }, error) { - return _ModelRegistry.Contract.GetByIndex(&_ModelRegistry.CallOpts, index) + return _ModelRegistry.Contract.ModelGetByIndex(&_ModelRegistry.CallOpts, index) } -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. +// ModelGetCount is a free data retrieval call binding the contract method 0x807b8975. // -// Solidity: function getCount() view returns(uint256 count) -func (_ModelRegistry *ModelRegistryCaller) GetCount(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function modelGetCount() view returns(uint256 count) +func (_ModelRegistry *ModelRegistryCaller) ModelGetCount(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "getCount") + err := _ModelRegistry.contract.Call(opts, &out, "modelGetCount") if err != nil { return *new(*big.Int), err @@ -316,26 +317,26 @@ func (_ModelRegistry *ModelRegistryCaller) GetCount(opts *bind.CallOpts) (*big.I } -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. +// ModelGetCount is a free data retrieval call binding the contract method 0x807b8975. // -// Solidity: function getCount() view returns(uint256 count) -func (_ModelRegistry *ModelRegistrySession) GetCount() (*big.Int, error) { - return _ModelRegistry.Contract.GetCount(&_ModelRegistry.CallOpts) +// Solidity: function modelGetCount() view returns(uint256 count) +func (_ModelRegistry *ModelRegistrySession) ModelGetCount() (*big.Int, error) { + return _ModelRegistry.Contract.ModelGetCount(&_ModelRegistry.CallOpts) } -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. +// ModelGetCount is a free data retrieval call binding the contract method 0x807b8975. // -// Solidity: function getCount() view returns(uint256 count) -func (_ModelRegistry *ModelRegistryCallerSession) GetCount() (*big.Int, error) { - return _ModelRegistry.Contract.GetCount(&_ModelRegistry.CallOpts) +// Solidity: function modelGetCount() view returns(uint256 count) +func (_ModelRegistry *ModelRegistryCallerSession) ModelGetCount() (*big.Int, error) { + return _ModelRegistry.Contract.ModelGetCount(&_ModelRegistry.CallOpts) } -// GetIds is a free data retrieval call binding the contract method 0x2b105663. +// ModelGetIds is a free data retrieval call binding the contract method 0x9f9877fc. // -// Solidity: function getIds() view returns(bytes32[]) -func (_ModelRegistry *ModelRegistryCaller) GetIds(opts *bind.CallOpts) ([][32]byte, error) { +// Solidity: function modelGetIds() view returns(bytes32[]) +func (_ModelRegistry *ModelRegistryCaller) ModelGetIds(opts *bind.CallOpts) ([][32]byte, error) { var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "getIds") + err := _ModelRegistry.contract.Call(opts, &out, "modelGetIds") if err != nil { return *new([][32]byte), err @@ -347,96 +348,57 @@ func (_ModelRegistry *ModelRegistryCaller) GetIds(opts *bind.CallOpts) ([][32]by } -// GetIds is a free data retrieval call binding the contract method 0x2b105663. +// ModelGetIds is a free data retrieval call binding the contract method 0x9f9877fc. // -// Solidity: function getIds() view returns(bytes32[]) -func (_ModelRegistry *ModelRegistrySession) GetIds() ([][32]byte, error) { - return _ModelRegistry.Contract.GetIds(&_ModelRegistry.CallOpts) +// Solidity: function modelGetIds() view returns(bytes32[]) +func (_ModelRegistry *ModelRegistrySession) ModelGetIds() ([][32]byte, error) { + return _ModelRegistry.Contract.ModelGetIds(&_ModelRegistry.CallOpts) } -// GetIds is a free data retrieval call binding the contract method 0x2b105663. +// ModelGetIds is a free data retrieval call binding the contract method 0x9f9877fc. // -// Solidity: function getIds() view returns(bytes32[]) -func (_ModelRegistry *ModelRegistryCallerSession) GetIds() ([][32]byte, error) { - return _ModelRegistry.Contract.GetIds(&_ModelRegistry.CallOpts) +// Solidity: function modelGetIds() view returns(bytes32[]) +func (_ModelRegistry *ModelRegistryCallerSession) ModelGetIds() ([][32]byte, error) { + return _ModelRegistry.Contract.ModelGetIds(&_ModelRegistry.CallOpts) } -// Map is a free data retrieval call binding the contract method 0x0ae186a8. +// ModelMap is a free data retrieval call binding the contract method 0x6e5cbd85. // -// Solidity: function map(bytes32 ) view returns(bytes32 ipfsCID, uint256 fee, uint256 stake, address owner, string name, uint128 timestamp, bool isDeleted) -func (_ModelRegistry *ModelRegistryCaller) Map(opts *bind.CallOpts, arg0 [32]byte) (struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Timestamp *big.Int - IsDeleted bool -}, error) { +// Solidity: function modelMap(bytes32 id) view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)) +func (_ModelRegistry *ModelRegistryCaller) ModelMap(opts *bind.CallOpts, id [32]byte) (Model, error) { var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "map", arg0) + err := _ModelRegistry.contract.Call(opts, &out, "modelMap", id) - outstruct := new(struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Timestamp *big.Int - IsDeleted bool - }) if err != nil { - return *outstruct, err + return *new(Model), err } - outstruct.IpfsCID = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.Fee = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.Stake = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.Owner = *abi.ConvertType(out[3], new(common.Address)).(*common.Address) - outstruct.Name = *abi.ConvertType(out[4], new(string)).(*string) - outstruct.Timestamp = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) - outstruct.IsDeleted = *abi.ConvertType(out[6], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(Model)).(*Model) - return *outstruct, err + return out0, err } -// Map is a free data retrieval call binding the contract method 0x0ae186a8. +// ModelMap is a free data retrieval call binding the contract method 0x6e5cbd85. // -// Solidity: function map(bytes32 ) view returns(bytes32 ipfsCID, uint256 fee, uint256 stake, address owner, string name, uint128 timestamp, bool isDeleted) -func (_ModelRegistry *ModelRegistrySession) Map(arg0 [32]byte) (struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Timestamp *big.Int - IsDeleted bool -}, error) { - return _ModelRegistry.Contract.Map(&_ModelRegistry.CallOpts, arg0) +// Solidity: function modelMap(bytes32 id) view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)) +func (_ModelRegistry *ModelRegistrySession) ModelMap(id [32]byte) (Model, error) { + return _ModelRegistry.Contract.ModelMap(&_ModelRegistry.CallOpts, id) } -// Map is a free data retrieval call binding the contract method 0x0ae186a8. +// ModelMap is a free data retrieval call binding the contract method 0x6e5cbd85. // -// Solidity: function map(bytes32 ) view returns(bytes32 ipfsCID, uint256 fee, uint256 stake, address owner, string name, uint128 timestamp, bool isDeleted) -func (_ModelRegistry *ModelRegistryCallerSession) Map(arg0 [32]byte) (struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Timestamp *big.Int - IsDeleted bool -}, error) { - return _ModelRegistry.Contract.Map(&_ModelRegistry.CallOpts, arg0) +// Solidity: function modelMap(bytes32 id) view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)) +func (_ModelRegistry *ModelRegistryCallerSession) ModelMap(id [32]byte) (Model, error) { + return _ModelRegistry.Contract.ModelMap(&_ModelRegistry.CallOpts, id) } -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. +// ModelMinStake is a free data retrieval call binding the contract method 0xe41a6823. // -// Solidity: function minStake() view returns(uint256) -func (_ModelRegistry *ModelRegistryCaller) MinStake(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function modelMinStake() view returns(uint256) +func (_ModelRegistry *ModelRegistryCaller) ModelMinStake(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "minStake") + err := _ModelRegistry.contract.Call(opts, &out, "modelMinStake") if err != nil { return *new(*big.Int), err @@ -448,26 +410,26 @@ func (_ModelRegistry *ModelRegistryCaller) MinStake(opts *bind.CallOpts) (*big.I } -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. +// ModelMinStake is a free data retrieval call binding the contract method 0xe41a6823. // -// Solidity: function minStake() view returns(uint256) -func (_ModelRegistry *ModelRegistrySession) MinStake() (*big.Int, error) { - return _ModelRegistry.Contract.MinStake(&_ModelRegistry.CallOpts) +// Solidity: function modelMinStake() view returns(uint256) +func (_ModelRegistry *ModelRegistrySession) ModelMinStake() (*big.Int, error) { + return _ModelRegistry.Contract.ModelMinStake(&_ModelRegistry.CallOpts) } -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. +// ModelMinStake is a free data retrieval call binding the contract method 0xe41a6823. // -// Solidity: function minStake() view returns(uint256) -func (_ModelRegistry *ModelRegistryCallerSession) MinStake() (*big.Int, error) { - return _ModelRegistry.Contract.MinStake(&_ModelRegistry.CallOpts) +// Solidity: function modelMinStake() view returns(uint256) +func (_ModelRegistry *ModelRegistryCallerSession) ModelMinStake() (*big.Int, error) { + return _ModelRegistry.Contract.ModelMinStake(&_ModelRegistry.CallOpts) } // Models is a free data retrieval call binding the contract method 0x6a030ca9. // -// Solidity: function models(uint256 ) view returns(bytes32) -func (_ModelRegistry *ModelRegistryCaller) Models(opts *bind.CallOpts, arg0 *big.Int) ([32]byte, error) { +// Solidity: function models(uint256 index) view returns(bytes32) +func (_ModelRegistry *ModelRegistryCaller) Models(opts *bind.CallOpts, index *big.Int) ([32]byte, error) { var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "models", arg0) + err := _ModelRegistry.contract.Call(opts, &out, "models", index) if err != nil { return *new([32]byte), err @@ -481,209 +443,84 @@ func (_ModelRegistry *ModelRegistryCaller) Models(opts *bind.CallOpts, arg0 *big // Models is a free data retrieval call binding the contract method 0x6a030ca9. // -// Solidity: function models(uint256 ) view returns(bytes32) -func (_ModelRegistry *ModelRegistrySession) Models(arg0 *big.Int) ([32]byte, error) { - return _ModelRegistry.Contract.Models(&_ModelRegistry.CallOpts, arg0) +// Solidity: function models(uint256 index) view returns(bytes32) +func (_ModelRegistry *ModelRegistrySession) Models(index *big.Int) ([32]byte, error) { + return _ModelRegistry.Contract.Models(&_ModelRegistry.CallOpts, index) } // Models is a free data retrieval call binding the contract method 0x6a030ca9. // -// Solidity: function models(uint256 ) view returns(bytes32) -func (_ModelRegistry *ModelRegistryCallerSession) Models(arg0 *big.Int) ([32]byte, error) { - return _ModelRegistry.Contract.Models(&_ModelRegistry.CallOpts, arg0) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ModelRegistry *ModelRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ModelRegistry *ModelRegistrySession) Owner() (common.Address, error) { - return _ModelRegistry.Contract.Owner(&_ModelRegistry.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ModelRegistry *ModelRegistryCallerSession) Owner() (common.Address, error) { - return _ModelRegistry.Contract.Owner(&_ModelRegistry.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ModelRegistry *ModelRegistryCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ModelRegistry *ModelRegistrySession) Token() (common.Address, error) { - return _ModelRegistry.Contract.Token(&_ModelRegistry.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ModelRegistry *ModelRegistryCallerSession) Token() (common.Address, error) { - return _ModelRegistry.Contract.Token(&_ModelRegistry.CallOpts) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_ModelRegistry *ModelRegistryTransactor) Deregister(opts *bind.TransactOpts, id [32]byte) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "deregister", id) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_ModelRegistry *ModelRegistrySession) Deregister(id [32]byte) (*types.Transaction, error) { - return _ModelRegistry.Contract.Deregister(&_ModelRegistry.TransactOpts, id) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) Deregister(id [32]byte) (*types.Transaction, error) { - return _ModelRegistry.Contract.Deregister(&_ModelRegistry.TransactOpts, id) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ModelRegistry *ModelRegistryTransactor) Initialize(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "initialize", _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ModelRegistry *ModelRegistrySession) Initialize(_token common.Address) (*types.Transaction, error) { - return _ModelRegistry.Contract.Initialize(&_ModelRegistry.TransactOpts, _token) +// Solidity: function models(uint256 index) view returns(bytes32) +func (_ModelRegistry *ModelRegistryCallerSession) Models(index *big.Int) ([32]byte, error) { + return _ModelRegistry.Contract.Models(&_ModelRegistry.CallOpts, index) } -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// ModelDeregister is a paid mutator transaction binding the contract method 0xd5a245f1. // -// Solidity: function initialize(address _token) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) Initialize(_token common.Address) (*types.Transaction, error) { - return _ModelRegistry.Contract.Initialize(&_ModelRegistry.TransactOpts, _token) +// Solidity: function modelDeregister(bytes32 id) returns() +func (_ModelRegistry *ModelRegistryTransactor) ModelDeregister(opts *bind.TransactOpts, id [32]byte) (*types.Transaction, error) { + return _ModelRegistry.contract.Transact(opts, "modelDeregister", id) } -// Register is a paid mutator transaction binding the contract method 0x9e4aaa05. +// ModelDeregister is a paid mutator transaction binding the contract method 0xd5a245f1. // -// Solidity: function register(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() -func (_ModelRegistry *ModelRegistryTransactor) Register(opts *bind.TransactOpts, modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "register", modelId, ipfsCID, fee, addStake, owner, name, tags) +// Solidity: function modelDeregister(bytes32 id) returns() +func (_ModelRegistry *ModelRegistrySession) ModelDeregister(id [32]byte) (*types.Transaction, error) { + return _ModelRegistry.Contract.ModelDeregister(&_ModelRegistry.TransactOpts, id) } -// Register is a paid mutator transaction binding the contract method 0x9e4aaa05. +// ModelDeregister is a paid mutator transaction binding the contract method 0xd5a245f1. // -// Solidity: function register(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() -func (_ModelRegistry *ModelRegistrySession) Register(modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { - return _ModelRegistry.Contract.Register(&_ModelRegistry.TransactOpts, modelId, ipfsCID, fee, addStake, owner, name, tags) +// Solidity: function modelDeregister(bytes32 id) returns() +func (_ModelRegistry *ModelRegistryTransactorSession) ModelDeregister(id [32]byte) (*types.Transaction, error) { + return _ModelRegistry.Contract.ModelDeregister(&_ModelRegistry.TransactOpts, id) } -// Register is a paid mutator transaction binding the contract method 0x9e4aaa05. +// ModelRegister is a paid mutator transaction binding the contract method 0x82806227. // -// Solidity: function register(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) Register(modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { - return _ModelRegistry.Contract.Register(&_ModelRegistry.TransactOpts, modelId, ipfsCID, fee, addStake, owner, name, tags) +// Solidity: function modelRegister(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() +func (_ModelRegistry *ModelRegistryTransactor) ModelRegister(opts *bind.TransactOpts, modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { + return _ModelRegistry.contract.Transact(opts, "modelRegister", modelId, ipfsCID, fee, addStake, owner, name, tags) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// ModelRegister is a paid mutator transaction binding the contract method 0x82806227. // -// Solidity: function renounceOwnership() returns() -func (_ModelRegistry *ModelRegistryTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "renounceOwnership") +// Solidity: function modelRegister(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() +func (_ModelRegistry *ModelRegistrySession) ModelRegister(modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { + return _ModelRegistry.Contract.ModelRegister(&_ModelRegistry.TransactOpts, modelId, ipfsCID, fee, addStake, owner, name, tags) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// ModelRegister is a paid mutator transaction binding the contract method 0x82806227. // -// Solidity: function renounceOwnership() returns() -func (_ModelRegistry *ModelRegistrySession) RenounceOwnership() (*types.Transaction, error) { - return _ModelRegistry.Contract.RenounceOwnership(&_ModelRegistry.TransactOpts) +// Solidity: function modelRegister(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() +func (_ModelRegistry *ModelRegistryTransactorSession) ModelRegister(modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { + return _ModelRegistry.Contract.ModelRegister(&_ModelRegistry.TransactOpts, modelId, ipfsCID, fee, addStake, owner, name, tags) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// ModelSetMinStake is a paid mutator transaction binding the contract method 0x78998329. // -// Solidity: function renounceOwnership() returns() -func (_ModelRegistry *ModelRegistryTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _ModelRegistry.Contract.RenounceOwnership(&_ModelRegistry.TransactOpts) +// Solidity: function modelSetMinStake(uint256 _minStake) returns() +func (_ModelRegistry *ModelRegistryTransactor) ModelSetMinStake(opts *bind.TransactOpts, _minStake *big.Int) (*types.Transaction, error) { + return _ModelRegistry.contract.Transact(opts, "modelSetMinStake", _minStake) } -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. +// ModelSetMinStake is a paid mutator transaction binding the contract method 0x78998329. // -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ModelRegistry *ModelRegistryTransactor) SetMinStake(opts *bind.TransactOpts, _minStake *big.Int) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "setMinStake", _minStake) +// Solidity: function modelSetMinStake(uint256 _minStake) returns() +func (_ModelRegistry *ModelRegistrySession) ModelSetMinStake(_minStake *big.Int) (*types.Transaction, error) { + return _ModelRegistry.Contract.ModelSetMinStake(&_ModelRegistry.TransactOpts, _minStake) } -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. +// ModelSetMinStake is a paid mutator transaction binding the contract method 0x78998329. // -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ModelRegistry *ModelRegistrySession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _ModelRegistry.Contract.SetMinStake(&_ModelRegistry.TransactOpts, _minStake) +// Solidity: function modelSetMinStake(uint256 _minStake) returns() +func (_ModelRegistry *ModelRegistryTransactorSession) ModelSetMinStake(_minStake *big.Int) (*types.Transaction, error) { + return _ModelRegistry.Contract.ModelSetMinStake(&_ModelRegistry.TransactOpts, _minStake) } -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _ModelRegistry.Contract.SetMinStake(&_ModelRegistry.TransactOpts, _minStake) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ModelRegistry *ModelRegistryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ModelRegistry *ModelRegistrySession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ModelRegistry.Contract.TransferOwnership(&_ModelRegistry.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ModelRegistry.Contract.TransferOwnership(&_ModelRegistry.TransactOpts, newOwner) -} - -// ModelRegistryDeregisteredIterator is returned from FilterDeregistered and is used to iterate over the raw logs and unpacked data for Deregistered events raised by the ModelRegistry contract. -type ModelRegistryDeregisteredIterator struct { - Event *ModelRegistryDeregistered // Event containing the contract specifics and raw log +// ModelRegistryModelDeregisteredIterator is returned from FilterModelDeregistered and is used to iterate over the raw logs and unpacked data for ModelDeregistered events raised by the ModelRegistry contract. +type ModelRegistryModelDeregisteredIterator struct { + Event *ModelRegistryModelDeregistered // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -697,7 +534,7 @@ type ModelRegistryDeregisteredIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *ModelRegistryDeregisteredIterator) Next() bool { +func (it *ModelRegistryModelDeregisteredIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -706,7 +543,7 @@ func (it *ModelRegistryDeregisteredIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ModelRegistryDeregistered) + it.Event = new(ModelRegistryModelDeregistered) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -721,7 +558,7 @@ func (it *ModelRegistryDeregisteredIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ModelRegistryDeregistered) + it.Event = new(ModelRegistryModelDeregistered) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -737,28 +574,28 @@ func (it *ModelRegistryDeregisteredIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryDeregisteredIterator) Error() error { +func (it *ModelRegistryModelDeregisteredIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ModelRegistryDeregisteredIterator) Close() error { +func (it *ModelRegistryModelDeregisteredIterator) Close() error { it.sub.Unsubscribe() return nil } -// ModelRegistryDeregistered represents a Deregistered event raised by the ModelRegistry contract. -type ModelRegistryDeregistered struct { +// ModelRegistryModelDeregistered represents a ModelDeregistered event raised by the ModelRegistry contract. +type ModelRegistryModelDeregistered struct { Owner common.Address ModelId [32]byte Raw types.Log // Blockchain specific contextual infos } -// FilterDeregistered is a free log retrieval operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. +// FilterModelDeregistered is a free log retrieval operation binding the contract event 0x79a9f3017f26694a70f688c1e37f4add042a050660c62fc8351f760b153b888b. // -// Solidity: event Deregistered(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) FilterDeregistered(opts *bind.FilterOpts, owner []common.Address, modelId [][32]byte) (*ModelRegistryDeregisteredIterator, error) { +// Solidity: event ModelDeregistered(address indexed owner, bytes32 indexed modelId) +func (_ModelRegistry *ModelRegistryFilterer) FilterModelDeregistered(opts *bind.FilterOpts, owner []common.Address, modelId [][32]byte) (*ModelRegistryModelDeregisteredIterator, error) { var ownerRule []interface{} for _, ownerItem := range owner { @@ -769,17 +606,17 @@ func (_ModelRegistry *ModelRegistryFilterer) FilterDeregistered(opts *bind.Filte modelIdRule = append(modelIdRule, modelIdItem) } - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "Deregistered", ownerRule, modelIdRule) + logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "ModelDeregistered", ownerRule, modelIdRule) if err != nil { return nil, err } - return &ModelRegistryDeregisteredIterator{contract: _ModelRegistry.contract, event: "Deregistered", logs: logs, sub: sub}, nil + return &ModelRegistryModelDeregisteredIterator{contract: _ModelRegistry.contract, event: "ModelDeregistered", logs: logs, sub: sub}, nil } -// WatchDeregistered is a free log subscription operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. +// WatchModelDeregistered is a free log subscription operation binding the contract event 0x79a9f3017f26694a70f688c1e37f4add042a050660c62fc8351f760b153b888b. // -// Solidity: event Deregistered(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) WatchDeregistered(opts *bind.WatchOpts, sink chan<- *ModelRegistryDeregistered, owner []common.Address, modelId [][32]byte) (event.Subscription, error) { +// Solidity: event ModelDeregistered(address indexed owner, bytes32 indexed modelId) +func (_ModelRegistry *ModelRegistryFilterer) WatchModelDeregistered(opts *bind.WatchOpts, sink chan<- *ModelRegistryModelDeregistered, owner []common.Address, modelId [][32]byte) (event.Subscription, error) { var ownerRule []interface{} for _, ownerItem := range owner { @@ -790,141 +627,7 @@ func (_ModelRegistry *ModelRegistryFilterer) WatchDeregistered(opts *bind.WatchO modelIdRule = append(modelIdRule, modelIdItem) } - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "Deregistered", ownerRule, modelIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ModelRegistryDeregistered) - if err := _ModelRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseDeregistered is a log parse operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. -// -// Solidity: event Deregistered(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) ParseDeregistered(log types.Log) (*ModelRegistryDeregistered, error) { - event := new(ModelRegistryDeregistered) - if err := _ModelRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ModelRegistryInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the ModelRegistry contract. -type ModelRegistryInitializedIterator struct { - Event *ModelRegistryInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ModelRegistryInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ModelRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ModelRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ModelRegistryInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ModelRegistryInitialized represents a Initialized event raised by the ModelRegistry contract. -type ModelRegistryInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ModelRegistry *ModelRegistryFilterer) FilterInitialized(opts *bind.FilterOpts) (*ModelRegistryInitializedIterator, error) { - - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &ModelRegistryInitializedIterator{contract: _ModelRegistry.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ModelRegistry *ModelRegistryFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *ModelRegistryInitialized) (event.Subscription, error) { - - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "Initialized") + logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "ModelDeregistered", ownerRule, modelIdRule) if err != nil { return nil, err } @@ -934,8 +637,8 @@ func (_ModelRegistry *ModelRegistryFilterer) WatchInitialized(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ModelRegistryInitialized) - if err := _ModelRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { + event := new(ModelRegistryModelDeregistered) + if err := _ModelRegistry.contract.UnpackLog(event, "ModelDeregistered", log); err != nil { return err } event.Raw = log @@ -956,21 +659,21 @@ func (_ModelRegistry *ModelRegistryFilterer) WatchInitialized(opts *bind.WatchOp }), nil } -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// ParseModelDeregistered is a log parse operation binding the contract event 0x79a9f3017f26694a70f688c1e37f4add042a050660c62fc8351f760b153b888b. // -// Solidity: event Initialized(uint8 version) -func (_ModelRegistry *ModelRegistryFilterer) ParseInitialized(log types.Log) (*ModelRegistryInitialized, error) { - event := new(ModelRegistryInitialized) - if err := _ModelRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { +// Solidity: event ModelDeregistered(address indexed owner, bytes32 indexed modelId) +func (_ModelRegistry *ModelRegistryFilterer) ParseModelDeregistered(log types.Log) (*ModelRegistryModelDeregistered, error) { + event := new(ModelRegistryModelDeregistered) + if err := _ModelRegistry.contract.UnpackLog(event, "ModelDeregistered", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ModelRegistryMinStakeUpdatedIterator is returned from FilterMinStakeUpdated and is used to iterate over the raw logs and unpacked data for MinStakeUpdated events raised by the ModelRegistry contract. -type ModelRegistryMinStakeUpdatedIterator struct { - Event *ModelRegistryMinStakeUpdated // Event containing the contract specifics and raw log +// ModelRegistryModelMinStakeUpdatedIterator is returned from FilterModelMinStakeUpdated and is used to iterate over the raw logs and unpacked data for ModelMinStakeUpdated events raised by the ModelRegistry contract. +type ModelRegistryModelMinStakeUpdatedIterator struct { + Event *ModelRegistryModelMinStakeUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -984,7 +687,7 @@ type ModelRegistryMinStakeUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *ModelRegistryMinStakeUpdatedIterator) Next() bool { +func (it *ModelRegistryModelMinStakeUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -993,7 +696,7 @@ func (it *ModelRegistryMinStakeUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ModelRegistryMinStakeUpdated) + it.Event = new(ModelRegistryModelMinStakeUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1008,7 +711,7 @@ func (it *ModelRegistryMinStakeUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ModelRegistryMinStakeUpdated) + it.Event = new(ModelRegistryModelMinStakeUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1024,194 +727,41 @@ func (it *ModelRegistryMinStakeUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryMinStakeUpdatedIterator) Error() error { +func (it *ModelRegistryModelMinStakeUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ModelRegistryMinStakeUpdatedIterator) Close() error { +func (it *ModelRegistryModelMinStakeUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ModelRegistryMinStakeUpdated represents a MinStakeUpdated event raised by the ModelRegistry contract. -type ModelRegistryMinStakeUpdated struct { +// ModelRegistryModelMinStakeUpdated represents a ModelMinStakeUpdated event raised by the ModelRegistry contract. +type ModelRegistryModelMinStakeUpdated struct { NewStake *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterMinStakeUpdated is a free log retrieval operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ModelRegistry *ModelRegistryFilterer) FilterMinStakeUpdated(opts *bind.FilterOpts) (*ModelRegistryMinStakeUpdatedIterator, error) { - - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return &ModelRegistryMinStakeUpdatedIterator{contract: _ModelRegistry.contract, event: "MinStakeUpdated", logs: logs, sub: sub}, nil -} - -// WatchMinStakeUpdated is a free log subscription operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ModelRegistry *ModelRegistryFilterer) WatchMinStakeUpdated(opts *bind.WatchOpts, sink chan<- *ModelRegistryMinStakeUpdated) (event.Subscription, error) { - - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ModelRegistryMinStakeUpdated) - if err := _ModelRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMinStakeUpdated is a log parse operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. +// FilterModelMinStakeUpdated is a free log retrieval operation binding the contract event 0xa7facdcb561b9b7c3091d6bea4b06c48f97f719dade07ba7510a687109161f6e. // -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ModelRegistry *ModelRegistryFilterer) ParseMinStakeUpdated(log types.Log) (*ModelRegistryMinStakeUpdated, error) { - event := new(ModelRegistryMinStakeUpdated) - if err := _ModelRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ModelRegistryOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ModelRegistry contract. -type ModelRegistryOwnershipTransferredIterator struct { - Event *ModelRegistryOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} +// Solidity: event ModelMinStakeUpdated(uint256 newStake) +func (_ModelRegistry *ModelRegistryFilterer) FilterModelMinStakeUpdated(opts *bind.FilterOpts) (*ModelRegistryModelMinStakeUpdatedIterator, error) { -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ModelRegistryOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ModelRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ModelRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ModelRegistryOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ModelRegistryOwnershipTransferred represents a OwnershipTransferred event raised by the ModelRegistry contract. -type ModelRegistryOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ModelRegistry *ModelRegistryFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ModelRegistryOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "ModelMinStakeUpdated") if err != nil { return nil, err } - return &ModelRegistryOwnershipTransferredIterator{contract: _ModelRegistry.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil + return &ModelRegistryModelMinStakeUpdatedIterator{contract: _ModelRegistry.contract, event: "ModelMinStakeUpdated", logs: logs, sub: sub}, nil } -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// WatchModelMinStakeUpdated is a free log subscription operation binding the contract event 0xa7facdcb561b9b7c3091d6bea4b06c48f97f719dade07ba7510a687109161f6e. // -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ModelRegistry *ModelRegistryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ModelRegistryOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } +// Solidity: event ModelMinStakeUpdated(uint256 newStake) +func (_ModelRegistry *ModelRegistryFilterer) WatchModelMinStakeUpdated(opts *bind.WatchOpts, sink chan<- *ModelRegistryModelMinStakeUpdated) (event.Subscription, error) { - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "ModelMinStakeUpdated") if err != nil { return nil, err } @@ -1221,8 +771,8 @@ func (_ModelRegistry *ModelRegistryFilterer) WatchOwnershipTransferred(opts *bin select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ModelRegistryOwnershipTransferred) - if err := _ModelRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + event := new(ModelRegistryModelMinStakeUpdated) + if err := _ModelRegistry.contract.UnpackLog(event, "ModelMinStakeUpdated", log); err != nil { return err } event.Raw = log @@ -1243,21 +793,21 @@ func (_ModelRegistry *ModelRegistryFilterer) WatchOwnershipTransferred(opts *bin }), nil } -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// ParseModelMinStakeUpdated is a log parse operation binding the contract event 0xa7facdcb561b9b7c3091d6bea4b06c48f97f719dade07ba7510a687109161f6e. // -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ModelRegistry *ModelRegistryFilterer) ParseOwnershipTransferred(log types.Log) (*ModelRegistryOwnershipTransferred, error) { - event := new(ModelRegistryOwnershipTransferred) - if err := _ModelRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { +// Solidity: event ModelMinStakeUpdated(uint256 newStake) +func (_ModelRegistry *ModelRegistryFilterer) ParseModelMinStakeUpdated(log types.Log) (*ModelRegistryModelMinStakeUpdated, error) { + event := new(ModelRegistryModelMinStakeUpdated) + if err := _ModelRegistry.contract.UnpackLog(event, "ModelMinStakeUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ModelRegistryRegisteredUpdatedIterator is returned from FilterRegisteredUpdated and is used to iterate over the raw logs and unpacked data for RegisteredUpdated events raised by the ModelRegistry contract. -type ModelRegistryRegisteredUpdatedIterator struct { - Event *ModelRegistryRegisteredUpdated // Event containing the contract specifics and raw log +// ModelRegistryModelRegisteredUpdatedIterator is returned from FilterModelRegisteredUpdated and is used to iterate over the raw logs and unpacked data for ModelRegisteredUpdated events raised by the ModelRegistry contract. +type ModelRegistryModelRegisteredUpdatedIterator struct { + Event *ModelRegistryModelRegisteredUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1271,7 +821,7 @@ type ModelRegistryRegisteredUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *ModelRegistryRegisteredUpdatedIterator) Next() bool { +func (it *ModelRegistryModelRegisteredUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1280,7 +830,7 @@ func (it *ModelRegistryRegisteredUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ModelRegistryRegisteredUpdated) + it.Event = new(ModelRegistryModelRegisteredUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1295,7 +845,7 @@ func (it *ModelRegistryRegisteredUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ModelRegistryRegisteredUpdated) + it.Event = new(ModelRegistryModelRegisteredUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1311,28 +861,28 @@ func (it *ModelRegistryRegisteredUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryRegisteredUpdatedIterator) Error() error { +func (it *ModelRegistryModelRegisteredUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ModelRegistryRegisteredUpdatedIterator) Close() error { +func (it *ModelRegistryModelRegisteredUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ModelRegistryRegisteredUpdated represents a RegisteredUpdated event raised by the ModelRegistry contract. -type ModelRegistryRegisteredUpdated struct { +// ModelRegistryModelRegisteredUpdated represents a ModelRegisteredUpdated event raised by the ModelRegistry contract. +type ModelRegistryModelRegisteredUpdated struct { Owner common.Address ModelId [32]byte Raw types.Log // Blockchain specific contextual infos } -// FilterRegisteredUpdated is a free log retrieval operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. +// FilterModelRegisteredUpdated is a free log retrieval operation binding the contract event 0xda9282a68d90c36d31d780a69a65da6c35191a5d8cdd37bd1a1a5aa9fb168e77. // -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) FilterRegisteredUpdated(opts *bind.FilterOpts, owner []common.Address, modelId [][32]byte) (*ModelRegistryRegisteredUpdatedIterator, error) { +// Solidity: event ModelRegisteredUpdated(address indexed owner, bytes32 indexed modelId) +func (_ModelRegistry *ModelRegistryFilterer) FilterModelRegisteredUpdated(opts *bind.FilterOpts, owner []common.Address, modelId [][32]byte) (*ModelRegistryModelRegisteredUpdatedIterator, error) { var ownerRule []interface{} for _, ownerItem := range owner { @@ -1343,17 +893,17 @@ func (_ModelRegistry *ModelRegistryFilterer) FilterRegisteredUpdated(opts *bind. modelIdRule = append(modelIdRule, modelIdItem) } - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "RegisteredUpdated", ownerRule, modelIdRule) + logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "ModelRegisteredUpdated", ownerRule, modelIdRule) if err != nil { return nil, err } - return &ModelRegistryRegisteredUpdatedIterator{contract: _ModelRegistry.contract, event: "RegisteredUpdated", logs: logs, sub: sub}, nil + return &ModelRegistryModelRegisteredUpdatedIterator{contract: _ModelRegistry.contract, event: "ModelRegisteredUpdated", logs: logs, sub: sub}, nil } -// WatchRegisteredUpdated is a free log subscription operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. +// WatchModelRegisteredUpdated is a free log subscription operation binding the contract event 0xda9282a68d90c36d31d780a69a65da6c35191a5d8cdd37bd1a1a5aa9fb168e77. // -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) WatchRegisteredUpdated(opts *bind.WatchOpts, sink chan<- *ModelRegistryRegisteredUpdated, owner []common.Address, modelId [][32]byte) (event.Subscription, error) { +// Solidity: event ModelRegisteredUpdated(address indexed owner, bytes32 indexed modelId) +func (_ModelRegistry *ModelRegistryFilterer) WatchModelRegisteredUpdated(opts *bind.WatchOpts, sink chan<- *ModelRegistryModelRegisteredUpdated, owner []common.Address, modelId [][32]byte) (event.Subscription, error) { var ownerRule []interface{} for _, ownerItem := range owner { @@ -1364,7 +914,7 @@ func (_ModelRegistry *ModelRegistryFilterer) WatchRegisteredUpdated(opts *bind.W modelIdRule = append(modelIdRule, modelIdItem) } - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "RegisteredUpdated", ownerRule, modelIdRule) + logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "ModelRegisteredUpdated", ownerRule, modelIdRule) if err != nil { return nil, err } @@ -1374,8 +924,8 @@ func (_ModelRegistry *ModelRegistryFilterer) WatchRegisteredUpdated(opts *bind.W select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ModelRegistryRegisteredUpdated) - if err := _ModelRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { + event := new(ModelRegistryModelRegisteredUpdated) + if err := _ModelRegistry.contract.UnpackLog(event, "ModelRegisteredUpdated", log); err != nil { return err } event.Raw = log @@ -1396,12 +946,12 @@ func (_ModelRegistry *ModelRegistryFilterer) WatchRegisteredUpdated(opts *bind.W }), nil } -// ParseRegisteredUpdated is a log parse operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. +// ParseModelRegisteredUpdated is a log parse operation binding the contract event 0xda9282a68d90c36d31d780a69a65da6c35191a5d8cdd37bd1a1a5aa9fb168e77. // -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) ParseRegisteredUpdated(log types.Log) (*ModelRegistryRegisteredUpdated, error) { - event := new(ModelRegistryRegisteredUpdated) - if err := _ModelRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { +// Solidity: event ModelRegisteredUpdated(address indexed owner, bytes32 indexed modelId) +func (_ModelRegistry *ModelRegistryFilterer) ParseModelRegisteredUpdated(log types.Log) (*ModelRegistryModelRegisteredUpdated, error) { + event := new(ModelRegistryModelRegisteredUpdated) + if err := _ModelRegistry.contract.UnpackLog(event, "ModelRegisteredUpdated", log); err != nil { return nil, err } event.Raw = log diff --git a/proxy-router/contracts/providerregistry/ProviderRegistry.go b/proxy-router/contracts/providerregistry/ProviderRegistry.go index 8afa5ffa..813518f8 100644 --- a/proxy-router/contracts/providerregistry/ProviderRegistry.go +++ b/proxy-router/contracts/providerregistry/ProviderRegistry.go @@ -29,17 +29,17 @@ var ( _ = abi.ConvertType ) -// ProviderRegistryProvider is an auto generated low-level Go binding around an user-defined struct. -type ProviderRegistryProvider struct { +// Provider is an auto generated low-level Go binding around an user-defined struct. +type Provider struct { Endpoint string Stake *big.Int - Timestamp *big.Int + CreatedAt *big.Int IsDeleted bool } // ProviderRegistryMetaData contains all meta data concerning the ProviderRegistry contract. var ProviderRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"Deregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"MinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"RegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"deregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAll\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structProviderRegistry.Provider[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getByIndex\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structProviderRegistry.Provider\",\"name\":\"provider\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getIds\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"providers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"setMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_contractOwner\",\"type\":\"address\"}],\"name\":\"NotContractOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"ProviderDeregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"ProviderMinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"ProviderRegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"providerDeregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"providerGetAll\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structProvider[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"providerGetByIndex\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structProvider\",\"name\":\"provider\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"providerGetCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"providerGetIds\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"providerMap\",\"outputs\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"createdAt\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structProvider\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"providerMinStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"}],\"name\":\"providerRegister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"providerSetMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"providers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"providrerExists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ProviderRegistryABI is the input ABI used to generate the binding from. @@ -188,120 +188,89 @@ func (_ProviderRegistry *ProviderRegistryTransactorRaw) Transact(opts *bind.Tran return _ProviderRegistry.Contract.contract.Transact(opts, method, params...) } -// Exists is a free data retrieval call binding the contract method 0xf6a3d24e. +// ProviderGetAll is a free data retrieval call binding the contract method 0x86af8fdc. // -// Solidity: function exists(address addr) view returns(bool) -func (_ProviderRegistry *ProviderRegistryCaller) Exists(opts *bind.CallOpts, addr common.Address) (bool, error) { +// Solidity: function providerGetAll() view returns(address[], (string,uint256,uint128,bool)[]) +func (_ProviderRegistry *ProviderRegistryCaller) ProviderGetAll(opts *bind.CallOpts) ([]common.Address, []Provider, error) { var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "exists", addr) + err := _ProviderRegistry.contract.Call(opts, &out, "providerGetAll") if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// Exists is a free data retrieval call binding the contract method 0xf6a3d24e. -// -// Solidity: function exists(address addr) view returns(bool) -func (_ProviderRegistry *ProviderRegistrySession) Exists(addr common.Address) (bool, error) { - return _ProviderRegistry.Contract.Exists(&_ProviderRegistry.CallOpts, addr) -} - -// Exists is a free data retrieval call binding the contract method 0xf6a3d24e. -// -// Solidity: function exists(address addr) view returns(bool) -func (_ProviderRegistry *ProviderRegistryCallerSession) Exists(addr common.Address) (bool, error) { - return _ProviderRegistry.Contract.Exists(&_ProviderRegistry.CallOpts, addr) -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns(address[], (string,uint256,uint128,bool)[]) -func (_ProviderRegistry *ProviderRegistryCaller) GetAll(opts *bind.CallOpts) ([]common.Address, []ProviderRegistryProvider, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "getAll") - - if err != nil { - return *new([]common.Address), *new([]ProviderRegistryProvider), err + return *new([]common.Address), *new([]Provider), err } out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) - out1 := *abi.ConvertType(out[1], new([]ProviderRegistryProvider)).(*[]ProviderRegistryProvider) + out1 := *abi.ConvertType(out[1], new([]Provider)).(*[]Provider) return out0, out1, err } -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. +// ProviderGetAll is a free data retrieval call binding the contract method 0x86af8fdc. // -// Solidity: function getAll() view returns(address[], (string,uint256,uint128,bool)[]) -func (_ProviderRegistry *ProviderRegistrySession) GetAll() ([]common.Address, []ProviderRegistryProvider, error) { - return _ProviderRegistry.Contract.GetAll(&_ProviderRegistry.CallOpts) +// Solidity: function providerGetAll() view returns(address[], (string,uint256,uint128,bool)[]) +func (_ProviderRegistry *ProviderRegistrySession) ProviderGetAll() ([]common.Address, []Provider, error) { + return _ProviderRegistry.Contract.ProviderGetAll(&_ProviderRegistry.CallOpts) } -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. +// ProviderGetAll is a free data retrieval call binding the contract method 0x86af8fdc. // -// Solidity: function getAll() view returns(address[], (string,uint256,uint128,bool)[]) -func (_ProviderRegistry *ProviderRegistryCallerSession) GetAll() ([]common.Address, []ProviderRegistryProvider, error) { - return _ProviderRegistry.Contract.GetAll(&_ProviderRegistry.CallOpts) +// Solidity: function providerGetAll() view returns(address[], (string,uint256,uint128,bool)[]) +func (_ProviderRegistry *ProviderRegistryCallerSession) ProviderGetAll() ([]common.Address, []Provider, error) { + return _ProviderRegistry.Contract.ProviderGetAll(&_ProviderRegistry.CallOpts) } -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. +// ProviderGetByIndex is a free data retrieval call binding the contract method 0xb8eed333. // -// Solidity: function getByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) -func (_ProviderRegistry *ProviderRegistryCaller) GetByIndex(opts *bind.CallOpts, index *big.Int) (struct { +// Solidity: function providerGetByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) +func (_ProviderRegistry *ProviderRegistryCaller) ProviderGetByIndex(opts *bind.CallOpts, index *big.Int) (struct { Addr common.Address - Provider ProviderRegistryProvider + Provider Provider }, error) { var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "getByIndex", index) + err := _ProviderRegistry.contract.Call(opts, &out, "providerGetByIndex", index) outstruct := new(struct { Addr common.Address - Provider ProviderRegistryProvider + Provider Provider }) if err != nil { return *outstruct, err } outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - outstruct.Provider = *abi.ConvertType(out[1], new(ProviderRegistryProvider)).(*ProviderRegistryProvider) + outstruct.Provider = *abi.ConvertType(out[1], new(Provider)).(*Provider) return *outstruct, err } -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. +// ProviderGetByIndex is a free data retrieval call binding the contract method 0xb8eed333. // -// Solidity: function getByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) -func (_ProviderRegistry *ProviderRegistrySession) GetByIndex(index *big.Int) (struct { +// Solidity: function providerGetByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) +func (_ProviderRegistry *ProviderRegistrySession) ProviderGetByIndex(index *big.Int) (struct { Addr common.Address - Provider ProviderRegistryProvider + Provider Provider }, error) { - return _ProviderRegistry.Contract.GetByIndex(&_ProviderRegistry.CallOpts, index) + return _ProviderRegistry.Contract.ProviderGetByIndex(&_ProviderRegistry.CallOpts, index) } -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. +// ProviderGetByIndex is a free data retrieval call binding the contract method 0xb8eed333. // -// Solidity: function getByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) -func (_ProviderRegistry *ProviderRegistryCallerSession) GetByIndex(index *big.Int) (struct { +// Solidity: function providerGetByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) +func (_ProviderRegistry *ProviderRegistryCallerSession) ProviderGetByIndex(index *big.Int) (struct { Addr common.Address - Provider ProviderRegistryProvider + Provider Provider }, error) { - return _ProviderRegistry.Contract.GetByIndex(&_ProviderRegistry.CallOpts, index) + return _ProviderRegistry.Contract.ProviderGetByIndex(&_ProviderRegistry.CallOpts, index) } -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. +// ProviderGetCount is a free data retrieval call binding the contract method 0x91d2b7eb. // -// Solidity: function getCount() view returns(uint256 count) -func (_ProviderRegistry *ProviderRegistryCaller) GetCount(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function providerGetCount() view returns(uint256 count) +func (_ProviderRegistry *ProviderRegistryCaller) ProviderGetCount(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "getCount") + err := _ProviderRegistry.contract.Call(opts, &out, "providerGetCount") if err != nil { return *new(*big.Int), err @@ -313,26 +282,26 @@ func (_ProviderRegistry *ProviderRegistryCaller) GetCount(opts *bind.CallOpts) ( } -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. +// ProviderGetCount is a free data retrieval call binding the contract method 0x91d2b7eb. // -// Solidity: function getCount() view returns(uint256 count) -func (_ProviderRegistry *ProviderRegistrySession) GetCount() (*big.Int, error) { - return _ProviderRegistry.Contract.GetCount(&_ProviderRegistry.CallOpts) +// Solidity: function providerGetCount() view returns(uint256 count) +func (_ProviderRegistry *ProviderRegistrySession) ProviderGetCount() (*big.Int, error) { + return _ProviderRegistry.Contract.ProviderGetCount(&_ProviderRegistry.CallOpts) } -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. +// ProviderGetCount is a free data retrieval call binding the contract method 0x91d2b7eb. // -// Solidity: function getCount() view returns(uint256 count) -func (_ProviderRegistry *ProviderRegistryCallerSession) GetCount() (*big.Int, error) { - return _ProviderRegistry.Contract.GetCount(&_ProviderRegistry.CallOpts) +// Solidity: function providerGetCount() view returns(uint256 count) +func (_ProviderRegistry *ProviderRegistryCallerSession) ProviderGetCount() (*big.Int, error) { + return _ProviderRegistry.Contract.ProviderGetCount(&_ProviderRegistry.CallOpts) } -// GetIds is a free data retrieval call binding the contract method 0x2b105663. +// ProviderGetIds is a free data retrieval call binding the contract method 0x2e888fe1. // -// Solidity: function getIds() view returns(address[]) -func (_ProviderRegistry *ProviderRegistryCaller) GetIds(opts *bind.CallOpts) ([]common.Address, error) { +// Solidity: function providerGetIds() view returns(address[]) +func (_ProviderRegistry *ProviderRegistryCaller) ProviderGetIds(opts *bind.CallOpts) ([]common.Address, error) { var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "getIds") + err := _ProviderRegistry.contract.Call(opts, &out, "providerGetIds") if err != nil { return *new([]common.Address), err @@ -344,81 +313,57 @@ func (_ProviderRegistry *ProviderRegistryCaller) GetIds(opts *bind.CallOpts) ([] } -// GetIds is a free data retrieval call binding the contract method 0x2b105663. +// ProviderGetIds is a free data retrieval call binding the contract method 0x2e888fe1. // -// Solidity: function getIds() view returns(address[]) -func (_ProviderRegistry *ProviderRegistrySession) GetIds() ([]common.Address, error) { - return _ProviderRegistry.Contract.GetIds(&_ProviderRegistry.CallOpts) +// Solidity: function providerGetIds() view returns(address[]) +func (_ProviderRegistry *ProviderRegistrySession) ProviderGetIds() ([]common.Address, error) { + return _ProviderRegistry.Contract.ProviderGetIds(&_ProviderRegistry.CallOpts) } -// GetIds is a free data retrieval call binding the contract method 0x2b105663. +// ProviderGetIds is a free data retrieval call binding the contract method 0x2e888fe1. // -// Solidity: function getIds() view returns(address[]) -func (_ProviderRegistry *ProviderRegistryCallerSession) GetIds() ([]common.Address, error) { - return _ProviderRegistry.Contract.GetIds(&_ProviderRegistry.CallOpts) +// Solidity: function providerGetIds() view returns(address[]) +func (_ProviderRegistry *ProviderRegistryCallerSession) ProviderGetIds() ([]common.Address, error) { + return _ProviderRegistry.Contract.ProviderGetIds(&_ProviderRegistry.CallOpts) } -// Map is a free data retrieval call binding the contract method 0xb721ef6e. +// ProviderMap is a free data retrieval call binding the contract method 0xa6c87915. // -// Solidity: function map(address ) view returns(string endpoint, uint256 stake, uint128 timestamp, bool isDeleted) -func (_ProviderRegistry *ProviderRegistryCaller) Map(opts *bind.CallOpts, arg0 common.Address) (struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool -}, error) { +// Solidity: function providerMap(address addr) view returns((string,uint256,uint128,bool)) +func (_ProviderRegistry *ProviderRegistryCaller) ProviderMap(opts *bind.CallOpts, addr common.Address) (Provider, error) { var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "map", arg0) + err := _ProviderRegistry.contract.Call(opts, &out, "providerMap", addr) - outstruct := new(struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool - }) if err != nil { - return *outstruct, err + return *new(Provider), err } - outstruct.Endpoint = *abi.ConvertType(out[0], new(string)).(*string) - outstruct.Stake = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.Timestamp = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.IsDeleted = *abi.ConvertType(out[3], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(Provider)).(*Provider) - return *outstruct, err + return out0, err } -// Map is a free data retrieval call binding the contract method 0xb721ef6e. +// ProviderMap is a free data retrieval call binding the contract method 0xa6c87915. // -// Solidity: function map(address ) view returns(string endpoint, uint256 stake, uint128 timestamp, bool isDeleted) -func (_ProviderRegistry *ProviderRegistrySession) Map(arg0 common.Address) (struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool -}, error) { - return _ProviderRegistry.Contract.Map(&_ProviderRegistry.CallOpts, arg0) +// Solidity: function providerMap(address addr) view returns((string,uint256,uint128,bool)) +func (_ProviderRegistry *ProviderRegistrySession) ProviderMap(addr common.Address) (Provider, error) { + return _ProviderRegistry.Contract.ProviderMap(&_ProviderRegistry.CallOpts, addr) } -// Map is a free data retrieval call binding the contract method 0xb721ef6e. +// ProviderMap is a free data retrieval call binding the contract method 0xa6c87915. // -// Solidity: function map(address ) view returns(string endpoint, uint256 stake, uint128 timestamp, bool isDeleted) -func (_ProviderRegistry *ProviderRegistryCallerSession) Map(arg0 common.Address) (struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool -}, error) { - return _ProviderRegistry.Contract.Map(&_ProviderRegistry.CallOpts, arg0) +// Solidity: function providerMap(address addr) view returns((string,uint256,uint128,bool)) +func (_ProviderRegistry *ProviderRegistryCallerSession) ProviderMap(addr common.Address) (Provider, error) { + return _ProviderRegistry.Contract.ProviderMap(&_ProviderRegistry.CallOpts, addr) } -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. +// ProviderMinStake is a free data retrieval call binding the contract method 0xbcd5641e. // -// Solidity: function minStake() view returns(uint256) -func (_ProviderRegistry *ProviderRegistryCaller) MinStake(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function providerMinStake() view returns(uint256) +func (_ProviderRegistry *ProviderRegistryCaller) ProviderMinStake(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "minStake") + err := _ProviderRegistry.contract.Call(opts, &out, "providerMinStake") if err != nil { return *new(*big.Int), err @@ -430,57 +375,26 @@ func (_ProviderRegistry *ProviderRegistryCaller) MinStake(opts *bind.CallOpts) ( } -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_ProviderRegistry *ProviderRegistrySession) MinStake() (*big.Int, error) { - return _ProviderRegistry.Contract.MinStake(&_ProviderRegistry.CallOpts) -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_ProviderRegistry *ProviderRegistryCallerSession) MinStake() (*big.Int, error) { - return _ProviderRegistry.Contract.MinStake(&_ProviderRegistry.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ProviderRegistry *ProviderRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// ProviderMinStake is a free data retrieval call binding the contract method 0xbcd5641e. // -// Solidity: function owner() view returns(address) -func (_ProviderRegistry *ProviderRegistrySession) Owner() (common.Address, error) { - return _ProviderRegistry.Contract.Owner(&_ProviderRegistry.CallOpts) +// Solidity: function providerMinStake() view returns(uint256) +func (_ProviderRegistry *ProviderRegistrySession) ProviderMinStake() (*big.Int, error) { + return _ProviderRegistry.Contract.ProviderMinStake(&_ProviderRegistry.CallOpts) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// ProviderMinStake is a free data retrieval call binding the contract method 0xbcd5641e. // -// Solidity: function owner() view returns(address) -func (_ProviderRegistry *ProviderRegistryCallerSession) Owner() (common.Address, error) { - return _ProviderRegistry.Contract.Owner(&_ProviderRegistry.CallOpts) +// Solidity: function providerMinStake() view returns(uint256) +func (_ProviderRegistry *ProviderRegistryCallerSession) ProviderMinStake() (*big.Int, error) { + return _ProviderRegistry.Contract.ProviderMinStake(&_ProviderRegistry.CallOpts) } // Providers is a free data retrieval call binding the contract method 0x50f3fc81. // -// Solidity: function providers(uint256 ) view returns(address) -func (_ProviderRegistry *ProviderRegistryCaller) Providers(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { +// Solidity: function providers(uint256 index) view returns(address) +func (_ProviderRegistry *ProviderRegistryCaller) Providers(opts *bind.CallOpts, index *big.Int) (common.Address, error) { var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "providers", arg0) + err := _ProviderRegistry.contract.Call(opts, &out, "providers", index) if err != nil { return *new(common.Address), err @@ -494,178 +408,115 @@ func (_ProviderRegistry *ProviderRegistryCaller) Providers(opts *bind.CallOpts, // Providers is a free data retrieval call binding the contract method 0x50f3fc81. // -// Solidity: function providers(uint256 ) view returns(address) -func (_ProviderRegistry *ProviderRegistrySession) Providers(arg0 *big.Int) (common.Address, error) { - return _ProviderRegistry.Contract.Providers(&_ProviderRegistry.CallOpts, arg0) +// Solidity: function providers(uint256 index) view returns(address) +func (_ProviderRegistry *ProviderRegistrySession) Providers(index *big.Int) (common.Address, error) { + return _ProviderRegistry.Contract.Providers(&_ProviderRegistry.CallOpts, index) } // Providers is a free data retrieval call binding the contract method 0x50f3fc81. // -// Solidity: function providers(uint256 ) view returns(address) -func (_ProviderRegistry *ProviderRegistryCallerSession) Providers(arg0 *big.Int) (common.Address, error) { - return _ProviderRegistry.Contract.Providers(&_ProviderRegistry.CallOpts, arg0) +// Solidity: function providers(uint256 index) view returns(address) +func (_ProviderRegistry *ProviderRegistryCallerSession) Providers(index *big.Int) (common.Address, error) { + return _ProviderRegistry.Contract.Providers(&_ProviderRegistry.CallOpts, index) } -// Token is a free data retrieval call binding the contract method 0xfc0c546a. +// ProvidrerExists is a free data retrieval call binding the contract method 0xf60e9726. // -// Solidity: function token() view returns(address) -func (_ProviderRegistry *ProviderRegistryCaller) Token(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function providrerExists(address addr) view returns(bool) +func (_ProviderRegistry *ProviderRegistryCaller) ProvidrerExists(opts *bind.CallOpts, addr common.Address) (bool, error) { var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "token") + err := _ProviderRegistry.contract.Call(opts, &out, "providrerExists", addr) if err != nil { - return *new(common.Address), err + return *new(bool), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) return out0, err } -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ProviderRegistry *ProviderRegistrySession) Token() (common.Address, error) { - return _ProviderRegistry.Contract.Token(&_ProviderRegistry.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ProviderRegistry *ProviderRegistryCallerSession) Token() (common.Address, error) { - return _ProviderRegistry.Contract.Token(&_ProviderRegistry.CallOpts) -} - -// Deregister is a paid mutator transaction binding the contract method 0x84ac33ec. -// -// Solidity: function deregister(address addr) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) Deregister(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "deregister", addr) -} - -// Deregister is a paid mutator transaction binding the contract method 0x84ac33ec. -// -// Solidity: function deregister(address addr) returns() -func (_ProviderRegistry *ProviderRegistrySession) Deregister(addr common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Deregister(&_ProviderRegistry.TransactOpts, addr) -} - -// Deregister is a paid mutator transaction binding the contract method 0x84ac33ec. -// -// Solidity: function deregister(address addr) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) Deregister(addr common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Deregister(&_ProviderRegistry.TransactOpts, addr) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) Initialize(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "initialize", _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ProviderRegistry *ProviderRegistrySession) Initialize(_token common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Initialize(&_ProviderRegistry.TransactOpts, _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) Initialize(_token common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Initialize(&_ProviderRegistry.TransactOpts, _token) -} - -// Register is a paid mutator transaction binding the contract method 0xf11b1b88. -// -// Solidity: function register(address addr, uint256 addStake, string endpoint) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) Register(opts *bind.TransactOpts, addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "register", addr, addStake, endpoint) -} - -// Register is a paid mutator transaction binding the contract method 0xf11b1b88. +// ProvidrerExists is a free data retrieval call binding the contract method 0xf60e9726. // -// Solidity: function register(address addr, uint256 addStake, string endpoint) returns() -func (_ProviderRegistry *ProviderRegistrySession) Register(addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Register(&_ProviderRegistry.TransactOpts, addr, addStake, endpoint) +// Solidity: function providrerExists(address addr) view returns(bool) +func (_ProviderRegistry *ProviderRegistrySession) ProvidrerExists(addr common.Address) (bool, error) { + return _ProviderRegistry.Contract.ProvidrerExists(&_ProviderRegistry.CallOpts, addr) } -// Register is a paid mutator transaction binding the contract method 0xf11b1b88. +// ProvidrerExists is a free data retrieval call binding the contract method 0xf60e9726. // -// Solidity: function register(address addr, uint256 addStake, string endpoint) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) Register(addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Register(&_ProviderRegistry.TransactOpts, addr, addStake, endpoint) +// Solidity: function providrerExists(address addr) view returns(bool) +func (_ProviderRegistry *ProviderRegistryCallerSession) ProvidrerExists(addr common.Address) (bool, error) { + return _ProviderRegistry.Contract.ProvidrerExists(&_ProviderRegistry.CallOpts, addr) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// ProviderDeregister is a paid mutator transaction binding the contract method 0x2ca36c49. // -// Solidity: function renounceOwnership() returns() -func (_ProviderRegistry *ProviderRegistryTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "renounceOwnership") +// Solidity: function providerDeregister(address addr) returns() +func (_ProviderRegistry *ProviderRegistryTransactor) ProviderDeregister(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _ProviderRegistry.contract.Transact(opts, "providerDeregister", addr) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// ProviderDeregister is a paid mutator transaction binding the contract method 0x2ca36c49. // -// Solidity: function renounceOwnership() returns() -func (_ProviderRegistry *ProviderRegistrySession) RenounceOwnership() (*types.Transaction, error) { - return _ProviderRegistry.Contract.RenounceOwnership(&_ProviderRegistry.TransactOpts) +// Solidity: function providerDeregister(address addr) returns() +func (_ProviderRegistry *ProviderRegistrySession) ProviderDeregister(addr common.Address) (*types.Transaction, error) { + return _ProviderRegistry.Contract.ProviderDeregister(&_ProviderRegistry.TransactOpts, addr) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// ProviderDeregister is a paid mutator transaction binding the contract method 0x2ca36c49. // -// Solidity: function renounceOwnership() returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _ProviderRegistry.Contract.RenounceOwnership(&_ProviderRegistry.TransactOpts) +// Solidity: function providerDeregister(address addr) returns() +func (_ProviderRegistry *ProviderRegistryTransactorSession) ProviderDeregister(addr common.Address) (*types.Transaction, error) { + return _ProviderRegistry.Contract.ProviderDeregister(&_ProviderRegistry.TransactOpts, addr) } -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. +// ProviderRegister is a paid mutator transaction binding the contract method 0x365700cb. // -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) SetMinStake(opts *bind.TransactOpts, _minStake *big.Int) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "setMinStake", _minStake) +// Solidity: function providerRegister(address addr, uint256 addStake, string endpoint) returns() +func (_ProviderRegistry *ProviderRegistryTransactor) ProviderRegister(opts *bind.TransactOpts, addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { + return _ProviderRegistry.contract.Transact(opts, "providerRegister", addr, addStake, endpoint) } -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. +// ProviderRegister is a paid mutator transaction binding the contract method 0x365700cb. // -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ProviderRegistry *ProviderRegistrySession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _ProviderRegistry.Contract.SetMinStake(&_ProviderRegistry.TransactOpts, _minStake) +// Solidity: function providerRegister(address addr, uint256 addStake, string endpoint) returns() +func (_ProviderRegistry *ProviderRegistrySession) ProviderRegister(addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { + return _ProviderRegistry.Contract.ProviderRegister(&_ProviderRegistry.TransactOpts, addr, addStake, endpoint) } -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. +// ProviderRegister is a paid mutator transaction binding the contract method 0x365700cb. // -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _ProviderRegistry.Contract.SetMinStake(&_ProviderRegistry.TransactOpts, _minStake) +// Solidity: function providerRegister(address addr, uint256 addStake, string endpoint) returns() +func (_ProviderRegistry *ProviderRegistryTransactorSession) ProviderRegister(addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { + return _ProviderRegistry.Contract.ProviderRegister(&_ProviderRegistry.TransactOpts, addr, addStake, endpoint) } -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// ProviderSetMinStake is a paid mutator transaction binding the contract method 0x0b7f94d6. // -// Solidity: function transferOwnership(address newOwner) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "transferOwnership", newOwner) +// Solidity: function providerSetMinStake(uint256 _minStake) returns() +func (_ProviderRegistry *ProviderRegistryTransactor) ProviderSetMinStake(opts *bind.TransactOpts, _minStake *big.Int) (*types.Transaction, error) { + return _ProviderRegistry.contract.Transact(opts, "providerSetMinStake", _minStake) } -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// ProviderSetMinStake is a paid mutator transaction binding the contract method 0x0b7f94d6. // -// Solidity: function transferOwnership(address newOwner) returns() -func (_ProviderRegistry *ProviderRegistrySession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.TransferOwnership(&_ProviderRegistry.TransactOpts, newOwner) +// Solidity: function providerSetMinStake(uint256 _minStake) returns() +func (_ProviderRegistry *ProviderRegistrySession) ProviderSetMinStake(_minStake *big.Int) (*types.Transaction, error) { + return _ProviderRegistry.Contract.ProviderSetMinStake(&_ProviderRegistry.TransactOpts, _minStake) } -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// ProviderSetMinStake is a paid mutator transaction binding the contract method 0x0b7f94d6. // -// Solidity: function transferOwnership(address newOwner) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.TransferOwnership(&_ProviderRegistry.TransactOpts, newOwner) +// Solidity: function providerSetMinStake(uint256 _minStake) returns() +func (_ProviderRegistry *ProviderRegistryTransactorSession) ProviderSetMinStake(_minStake *big.Int) (*types.Transaction, error) { + return _ProviderRegistry.Contract.ProviderSetMinStake(&_ProviderRegistry.TransactOpts, _minStake) } -// ProviderRegistryDeregisteredIterator is returned from FilterDeregistered and is used to iterate over the raw logs and unpacked data for Deregistered events raised by the ProviderRegistry contract. -type ProviderRegistryDeregisteredIterator struct { - Event *ProviderRegistryDeregistered // Event containing the contract specifics and raw log +// ProviderRegistryProviderDeregisteredIterator is returned from FilterProviderDeregistered and is used to iterate over the raw logs and unpacked data for ProviderDeregistered events raised by the ProviderRegistry contract. +type ProviderRegistryProviderDeregisteredIterator struct { + Event *ProviderRegistryProviderDeregistered // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -679,7 +530,7 @@ type ProviderRegistryDeregisteredIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryDeregisteredIterator) Next() bool { +func (it *ProviderRegistryProviderDeregisteredIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -688,7 +539,7 @@ func (it *ProviderRegistryDeregisteredIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ProviderRegistryDeregistered) + it.Event = new(ProviderRegistryProviderDeregistered) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -703,7 +554,7 @@ func (it *ProviderRegistryDeregisteredIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ProviderRegistryDeregistered) + it.Event = new(ProviderRegistryProviderDeregistered) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -719,185 +570,51 @@ func (it *ProviderRegistryDeregisteredIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryDeregisteredIterator) Error() error { +func (it *ProviderRegistryProviderDeregisteredIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ProviderRegistryDeregisteredIterator) Close() error { +func (it *ProviderRegistryProviderDeregisteredIterator) Close() error { it.sub.Unsubscribe() return nil } -// ProviderRegistryDeregistered represents a Deregistered event raised by the ProviderRegistry contract. -type ProviderRegistryDeregistered struct { +// ProviderRegistryProviderDeregistered represents a ProviderDeregistered event raised by the ProviderRegistry contract. +type ProviderRegistryProviderDeregistered struct { Provider common.Address Raw types.Log // Blockchain specific contextual infos } -// FilterDeregistered is a free log retrieval operation binding the contract event 0xafebd0f81ba8c430fcc0c6a6e7a26fd7f868af9c4e4f19db37a0f16502374fd5. +// FilterProviderDeregistered is a free log retrieval operation binding the contract event 0xf04091b4a187e321a42001e46961e45b6a75b203fc6fb766b7e05505f6080abb. // -// Solidity: event Deregistered(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterDeregistered(opts *bind.FilterOpts, provider []common.Address) (*ProviderRegistryDeregisteredIterator, error) { +// Solidity: event ProviderDeregistered(address indexed provider) +func (_ProviderRegistry *ProviderRegistryFilterer) FilterProviderDeregistered(opts *bind.FilterOpts, provider []common.Address) (*ProviderRegistryProviderDeregisteredIterator, error) { var providerRule []interface{} for _, providerItem := range provider { providerRule = append(providerRule, providerItem) } - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "Deregistered", providerRule) + logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "ProviderDeregistered", providerRule) if err != nil { return nil, err } - return &ProviderRegistryDeregisteredIterator{contract: _ProviderRegistry.contract, event: "Deregistered", logs: logs, sub: sub}, nil + return &ProviderRegistryProviderDeregisteredIterator{contract: _ProviderRegistry.contract, event: "ProviderDeregistered", logs: logs, sub: sub}, nil } -// WatchDeregistered is a free log subscription operation binding the contract event 0xafebd0f81ba8c430fcc0c6a6e7a26fd7f868af9c4e4f19db37a0f16502374fd5. +// WatchProviderDeregistered is a free log subscription operation binding the contract event 0xf04091b4a187e321a42001e46961e45b6a75b203fc6fb766b7e05505f6080abb. // -// Solidity: event Deregistered(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchDeregistered(opts *bind.WatchOpts, sink chan<- *ProviderRegistryDeregistered, provider []common.Address) (event.Subscription, error) { +// Solidity: event ProviderDeregistered(address indexed provider) +func (_ProviderRegistry *ProviderRegistryFilterer) WatchProviderDeregistered(opts *bind.WatchOpts, sink chan<- *ProviderRegistryProviderDeregistered, provider []common.Address) (event.Subscription, error) { var providerRule []interface{} for _, providerItem := range provider { providerRule = append(providerRule, providerItem) } - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "Deregistered", providerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryDeregistered) - if err := _ProviderRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseDeregistered is a log parse operation binding the contract event 0xafebd0f81ba8c430fcc0c6a6e7a26fd7f868af9c4e4f19db37a0f16502374fd5. -// -// Solidity: event Deregistered(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseDeregistered(log types.Log) (*ProviderRegistryDeregistered, error) { - event := new(ProviderRegistryDeregistered) - if err := _ProviderRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ProviderRegistryInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the ProviderRegistry contract. -type ProviderRegistryInitializedIterator struct { - Event *ProviderRegistryInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ProviderRegistryInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ProviderRegistryInitialized represents a Initialized event raised by the ProviderRegistry contract. -type ProviderRegistryInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterInitialized(opts *bind.FilterOpts) (*ProviderRegistryInitializedIterator, error) { - - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &ProviderRegistryInitializedIterator{contract: _ProviderRegistry.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *ProviderRegistryInitialized) (event.Subscription, error) { - - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "Initialized") + logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "ProviderDeregistered", providerRule) if err != nil { return nil, err } @@ -907,8 +624,8 @@ func (_ProviderRegistry *ProviderRegistryFilterer) WatchInitialized(opts *bind.W select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryInitialized) - if err := _ProviderRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { + event := new(ProviderRegistryProviderDeregistered) + if err := _ProviderRegistry.contract.UnpackLog(event, "ProviderDeregistered", log); err != nil { return err } event.Raw = log @@ -929,21 +646,21 @@ func (_ProviderRegistry *ProviderRegistryFilterer) WatchInitialized(opts *bind.W }), nil } -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// ParseProviderDeregistered is a log parse operation binding the contract event 0xf04091b4a187e321a42001e46961e45b6a75b203fc6fb766b7e05505f6080abb. // -// Solidity: event Initialized(uint8 version) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseInitialized(log types.Log) (*ProviderRegistryInitialized, error) { - event := new(ProviderRegistryInitialized) - if err := _ProviderRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { +// Solidity: event ProviderDeregistered(address indexed provider) +func (_ProviderRegistry *ProviderRegistryFilterer) ParseProviderDeregistered(log types.Log) (*ProviderRegistryProviderDeregistered, error) { + event := new(ProviderRegistryProviderDeregistered) + if err := _ProviderRegistry.contract.UnpackLog(event, "ProviderDeregistered", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ProviderRegistryMinStakeUpdatedIterator is returned from FilterMinStakeUpdated and is used to iterate over the raw logs and unpacked data for MinStakeUpdated events raised by the ProviderRegistry contract. -type ProviderRegistryMinStakeUpdatedIterator struct { - Event *ProviderRegistryMinStakeUpdated // Event containing the contract specifics and raw log +// ProviderRegistryProviderMinStakeUpdatedIterator is returned from FilterProviderMinStakeUpdated and is used to iterate over the raw logs and unpacked data for ProviderMinStakeUpdated events raised by the ProviderRegistry contract. +type ProviderRegistryProviderMinStakeUpdatedIterator struct { + Event *ProviderRegistryProviderMinStakeUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -957,7 +674,7 @@ type ProviderRegistryMinStakeUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryMinStakeUpdatedIterator) Next() bool { +func (it *ProviderRegistryProviderMinStakeUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -966,7 +683,7 @@ func (it *ProviderRegistryMinStakeUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ProviderRegistryMinStakeUpdated) + it.Event = new(ProviderRegistryProviderMinStakeUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -981,7 +698,7 @@ func (it *ProviderRegistryMinStakeUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ProviderRegistryMinStakeUpdated) + it.Event = new(ProviderRegistryProviderMinStakeUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -997,194 +714,41 @@ func (it *ProviderRegistryMinStakeUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryMinStakeUpdatedIterator) Error() error { +func (it *ProviderRegistryProviderMinStakeUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ProviderRegistryMinStakeUpdatedIterator) Close() error { +func (it *ProviderRegistryProviderMinStakeUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ProviderRegistryMinStakeUpdated represents a MinStakeUpdated event raised by the ProviderRegistry contract. -type ProviderRegistryMinStakeUpdated struct { +// ProviderRegistryProviderMinStakeUpdated represents a ProviderMinStakeUpdated event raised by the ProviderRegistry contract. +type ProviderRegistryProviderMinStakeUpdated struct { NewStake *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterMinStakeUpdated is a free log retrieval operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterMinStakeUpdated(opts *bind.FilterOpts) (*ProviderRegistryMinStakeUpdatedIterator, error) { - - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return &ProviderRegistryMinStakeUpdatedIterator{contract: _ProviderRegistry.contract, event: "MinStakeUpdated", logs: logs, sub: sub}, nil -} - -// WatchMinStakeUpdated is a free log subscription operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchMinStakeUpdated(opts *bind.WatchOpts, sink chan<- *ProviderRegistryMinStakeUpdated) (event.Subscription, error) { - - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryMinStakeUpdated) - if err := _ProviderRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMinStakeUpdated is a log parse operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseMinStakeUpdated(log types.Log) (*ProviderRegistryMinStakeUpdated, error) { - event := new(ProviderRegistryMinStakeUpdated) - if err := _ProviderRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ProviderRegistryOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ProviderRegistry contract. -type ProviderRegistryOwnershipTransferredIterator struct { - Event *ProviderRegistryOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ProviderRegistryOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ProviderRegistryOwnershipTransferred represents a OwnershipTransferred event raised by the ProviderRegistry contract. -type ProviderRegistryOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// FilterProviderMinStakeUpdated is a free log retrieval operation binding the contract event 0x1ee852018221ad3e0f9b96b4d6f870d0e1393c4060f626c01ad1e09a1917d818. // -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ProviderRegistryOwnershipTransferredIterator, error) { +// Solidity: event ProviderMinStakeUpdated(uint256 newStake) +func (_ProviderRegistry *ProviderRegistryFilterer) FilterProviderMinStakeUpdated(opts *bind.FilterOpts) (*ProviderRegistryProviderMinStakeUpdatedIterator, error) { - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "ProviderMinStakeUpdated") if err != nil { return nil, err } - return &ProviderRegistryOwnershipTransferredIterator{contract: _ProviderRegistry.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil + return &ProviderRegistryProviderMinStakeUpdatedIterator{contract: _ProviderRegistry.contract, event: "ProviderMinStakeUpdated", logs: logs, sub: sub}, nil } -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// WatchProviderMinStakeUpdated is a free log subscription operation binding the contract event 0x1ee852018221ad3e0f9b96b4d6f870d0e1393c4060f626c01ad1e09a1917d818. // -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ProviderRegistryOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } +// Solidity: event ProviderMinStakeUpdated(uint256 newStake) +func (_ProviderRegistry *ProviderRegistryFilterer) WatchProviderMinStakeUpdated(opts *bind.WatchOpts, sink chan<- *ProviderRegistryProviderMinStakeUpdated) (event.Subscription, error) { - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "ProviderMinStakeUpdated") if err != nil { return nil, err } @@ -1194,8 +758,8 @@ func (_ProviderRegistry *ProviderRegistryFilterer) WatchOwnershipTransferred(opt select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryOwnershipTransferred) - if err := _ProviderRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + event := new(ProviderRegistryProviderMinStakeUpdated) + if err := _ProviderRegistry.contract.UnpackLog(event, "ProviderMinStakeUpdated", log); err != nil { return err } event.Raw = log @@ -1216,21 +780,21 @@ func (_ProviderRegistry *ProviderRegistryFilterer) WatchOwnershipTransferred(opt }), nil } -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// ParseProviderMinStakeUpdated is a log parse operation binding the contract event 0x1ee852018221ad3e0f9b96b4d6f870d0e1393c4060f626c01ad1e09a1917d818. // -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseOwnershipTransferred(log types.Log) (*ProviderRegistryOwnershipTransferred, error) { - event := new(ProviderRegistryOwnershipTransferred) - if err := _ProviderRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { +// Solidity: event ProviderMinStakeUpdated(uint256 newStake) +func (_ProviderRegistry *ProviderRegistryFilterer) ParseProviderMinStakeUpdated(log types.Log) (*ProviderRegistryProviderMinStakeUpdated, error) { + event := new(ProviderRegistryProviderMinStakeUpdated) + if err := _ProviderRegistry.contract.UnpackLog(event, "ProviderMinStakeUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ProviderRegistryRegisteredUpdatedIterator is returned from FilterRegisteredUpdated and is used to iterate over the raw logs and unpacked data for RegisteredUpdated events raised by the ProviderRegistry contract. -type ProviderRegistryRegisteredUpdatedIterator struct { - Event *ProviderRegistryRegisteredUpdated // Event containing the contract specifics and raw log +// ProviderRegistryProviderRegisteredUpdatedIterator is returned from FilterProviderRegisteredUpdated and is used to iterate over the raw logs and unpacked data for ProviderRegisteredUpdated events raised by the ProviderRegistry contract. +type ProviderRegistryProviderRegisteredUpdatedIterator struct { + Event *ProviderRegistryProviderRegisteredUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1244,7 +808,7 @@ type ProviderRegistryRegisteredUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryRegisteredUpdatedIterator) Next() bool { +func (it *ProviderRegistryProviderRegisteredUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1253,7 +817,7 @@ func (it *ProviderRegistryRegisteredUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ProviderRegistryRegisteredUpdated) + it.Event = new(ProviderRegistryProviderRegisteredUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1268,7 +832,7 @@ func (it *ProviderRegistryRegisteredUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ProviderRegistryRegisteredUpdated) + it.Event = new(ProviderRegistryProviderRegisteredUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1284,51 +848,51 @@ func (it *ProviderRegistryRegisteredUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryRegisteredUpdatedIterator) Error() error { +func (it *ProviderRegistryProviderRegisteredUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ProviderRegistryRegisteredUpdatedIterator) Close() error { +func (it *ProviderRegistryProviderRegisteredUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ProviderRegistryRegisteredUpdated represents a RegisteredUpdated event raised by the ProviderRegistry contract. -type ProviderRegistryRegisteredUpdated struct { +// ProviderRegistryProviderRegisteredUpdated represents a ProviderRegisteredUpdated event raised by the ProviderRegistry contract. +type ProviderRegistryProviderRegisteredUpdated struct { Provider common.Address Raw types.Log // Blockchain specific contextual infos } -// FilterRegisteredUpdated is a free log retrieval operation binding the contract event 0x0407973ec6e86eb9f260606351583a2737e1db4d6f44c2414e699bd665ae10dc. +// FilterProviderRegisteredUpdated is a free log retrieval operation binding the contract event 0xe041bebe929cc665c6c558e3ad7913156fef3abc77ac6a2a4f0182e6dcb11193. // -// Solidity: event RegisteredUpdated(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterRegisteredUpdated(opts *bind.FilterOpts, provider []common.Address) (*ProviderRegistryRegisteredUpdatedIterator, error) { +// Solidity: event ProviderRegisteredUpdated(address indexed provider) +func (_ProviderRegistry *ProviderRegistryFilterer) FilterProviderRegisteredUpdated(opts *bind.FilterOpts, provider []common.Address) (*ProviderRegistryProviderRegisteredUpdatedIterator, error) { var providerRule []interface{} for _, providerItem := range provider { providerRule = append(providerRule, providerItem) } - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "RegisteredUpdated", providerRule) + logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "ProviderRegisteredUpdated", providerRule) if err != nil { return nil, err } - return &ProviderRegistryRegisteredUpdatedIterator{contract: _ProviderRegistry.contract, event: "RegisteredUpdated", logs: logs, sub: sub}, nil + return &ProviderRegistryProviderRegisteredUpdatedIterator{contract: _ProviderRegistry.contract, event: "ProviderRegisteredUpdated", logs: logs, sub: sub}, nil } -// WatchRegisteredUpdated is a free log subscription operation binding the contract event 0x0407973ec6e86eb9f260606351583a2737e1db4d6f44c2414e699bd665ae10dc. +// WatchProviderRegisteredUpdated is a free log subscription operation binding the contract event 0xe041bebe929cc665c6c558e3ad7913156fef3abc77ac6a2a4f0182e6dcb11193. // -// Solidity: event RegisteredUpdated(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchRegisteredUpdated(opts *bind.WatchOpts, sink chan<- *ProviderRegistryRegisteredUpdated, provider []common.Address) (event.Subscription, error) { +// Solidity: event ProviderRegisteredUpdated(address indexed provider) +func (_ProviderRegistry *ProviderRegistryFilterer) WatchProviderRegisteredUpdated(opts *bind.WatchOpts, sink chan<- *ProviderRegistryProviderRegisteredUpdated, provider []common.Address) (event.Subscription, error) { var providerRule []interface{} for _, providerItem := range provider { providerRule = append(providerRule, providerItem) } - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "RegisteredUpdated", providerRule) + logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "ProviderRegisteredUpdated", providerRule) if err != nil { return nil, err } @@ -1338,8 +902,8 @@ func (_ProviderRegistry *ProviderRegistryFilterer) WatchRegisteredUpdated(opts * select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryRegisteredUpdated) - if err := _ProviderRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { + event := new(ProviderRegistryProviderRegisteredUpdated) + if err := _ProviderRegistry.contract.UnpackLog(event, "ProviderRegisteredUpdated", log); err != nil { return err } event.Raw = log @@ -1360,12 +924,12 @@ func (_ProviderRegistry *ProviderRegistryFilterer) WatchRegisteredUpdated(opts * }), nil } -// ParseRegisteredUpdated is a log parse operation binding the contract event 0x0407973ec6e86eb9f260606351583a2737e1db4d6f44c2414e699bd665ae10dc. +// ParseProviderRegisteredUpdated is a log parse operation binding the contract event 0xe041bebe929cc665c6c558e3ad7913156fef3abc77ac6a2a4f0182e6dcb11193. // -// Solidity: event RegisteredUpdated(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseRegisteredUpdated(log types.Log) (*ProviderRegistryRegisteredUpdated, error) { - event := new(ProviderRegistryRegisteredUpdated) - if err := _ProviderRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { +// Solidity: event ProviderRegisteredUpdated(address indexed provider) +func (_ProviderRegistry *ProviderRegistryFilterer) ParseProviderRegisteredUpdated(log types.Log) (*ProviderRegistryProviderRegisteredUpdated, error) { + event := new(ProviderRegistryProviderRegisteredUpdated) + if err := _ProviderRegistry.contract.UnpackLog(event, "ProviderRegisteredUpdated", log); err != nil { return nil, err } event.Raw = log diff --git a/proxy-router/contracts/sessionrouter/SessionRouter.go b/proxy-router/contracts/sessionrouter/SessionRouter.go index 516bbb93..0ebca9e8 100644 --- a/proxy-router/contracts/sessionrouter/SessionRouter.go +++ b/proxy-router/contracts/sessionrouter/SessionRouter.go @@ -29,23 +29,34 @@ var ( _ = abi.ConvertType ) -// SessionRouterSession is an auto generated low-level Go binding around an user-defined struct. -type SessionRouterSession struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int +// Pool is an auto generated low-level Go binding around an user-defined struct. +type Pool struct { + InitialReward *big.Int + RewardDecrease *big.Int + PayoutStart *big.Int + DecreaseInterval *big.Int +} + +// Session is an auto generated low-level Go binding around an user-defined struct. +type Session struct { + Id [32]byte + User common.Address + Provider common.Address + ModelAgentId [32]byte + BidID [32]byte + Stake *big.Int + PricePerSecond *big.Int + CloseoutReceipt []byte + CloseoutType *big.Int + ProviderWithdrawnAmount *big.Int + OpenedAt *big.Int + EndsAt *big.Int + ClosedAt *big.Int } // SessionRouterMetaData contains all meta data concerning the SessionRouter contract. var SessionRouterMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"BidNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughStipend\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotUser\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotUserOrProvider\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SessionNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SessionTooShort\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"providerAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ProviderClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"providerId\",\"type\":\"address\"}],\"name\":\"SessionClosed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"providerId\",\"type\":\"address\"}],\"name\":\"SessionOpened\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToWithdraw\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claimProviderBalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"receiptEncoded\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"closeSession\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"name\":\"deleteHistory\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_encodedMessage\",\"type\":\"bytes\"}],\"name\":\"getEthSignedMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"providerAddr\",\"type\":\"address\"}],\"name\":\"getProviderBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hold\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"providerAddr\",\"type\":\"address\"}],\"name\":\"getProviderClaimBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"name\":\"getSession\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"budget\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"internalType\":\"structSessionRouter.Session\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stakingDailyStipend\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_marketplace\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"marketplace\",\"outputs\":[{\"internalType\":\"contractMarketplace\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"budget\",\"type\":\"uint256\"}],\"name\":\"openSession\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"providerOnHold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"releaseAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"message\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"recoverSigner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sessions\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"budget\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"delay\",\"type\":\"int256\"}],\"name\":\"setStakeDelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"splitSignature\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakeDelay\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingDailyStipend\",\"outputs\":[{\"internalType\":\"contractStakingDailyStipend\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"BidNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotDecodeAbi\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicateApproval\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_contractOwner\",\"type\":\"address\"}],\"name\":\"NotContractOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughWithdrawableBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotUserOrProvider\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ProviderSignatureMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SessionAlreadyClosed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SessionNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SessionTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SignatureExpired\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"providerId\",\"type\":\"address\"}],\"name\":\"SessionClosed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"providerId\",\"type\":\"address\"}],\"name\":\"SessionOpened\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MAX_SESSION_DURATION\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_SESSION_DURATION\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SIGNATURE_TTL\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"activeSessionsCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amountToWithdraw\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claimProviderBalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"receiptEncoded\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"closeSession\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"name\":\"deleteHistory\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"getActiveSessionsByProvider\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"bidID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"providerWithdrawnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endsAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"internalType\":\"structSession[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getActiveSessionsByUser\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"bidID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"providerWithdrawnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endsAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"internalType\":\"structSession[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getComputeBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"name\":\"getProviderClaimableBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"name\":\"getSession\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"bidID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"providerWithdrawnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endsAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"internalType\":\"structSession\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getSessionsByModel\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"bidID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"providerWithdrawnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endsAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"internalType\":\"structSession[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getSessionsByProvider\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"bidID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"providerWithdrawnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endsAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"internalType\":\"structSession[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getSessionsByUser\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"bidID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"providerWithdrawnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endsAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"internalType\":\"structSession[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getTodaysBudget\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"receipt\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"isValidReceipt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_stake\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"providerApproval\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"openSession\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sessionsCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"initialReward\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardDecrease\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"payoutStart\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"decreaseInterval\",\"type\":\"uint128\"}],\"internalType\":\"structPool\",\"name\":\"pool\",\"type\":\"tuple\"}],\"name\":\"setPoolConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sessionStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"stakeToStipend\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"startOfTheDay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"stipend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"stipendToStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"targetReward\",\"type\":\"uint256\"}],\"name\":\"whenComputeBalanceIsLessThan\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"sessionStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pricePerSecond\",\"type\":\"uint256\"}],\"name\":\"whenStipendLessThanDailyPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToWithdraw\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"withdrawUserStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddr\",\"type\":\"address\"}],\"name\":\"withdrawableUserStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"avail\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hold\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // SessionRouterABI is the input ABI used to generate the binding from. @@ -194,88 +205,229 @@ func (_SessionRouter *SessionRouterTransactorRaw) Transact(opts *bind.TransactOp return _SessionRouter.Contract.contract.Transact(opts, method, params...) } -// GetEthSignedMessageHash is a free data retrieval call binding the contract method 0xf9aea466. +// MAXSESSIONDURATION is a free data retrieval call binding the contract method 0xcd8cd4ad. // -// Solidity: function getEthSignedMessageHash(bytes _encodedMessage) pure returns(bytes32) -func (_SessionRouter *SessionRouterCaller) GetEthSignedMessageHash(opts *bind.CallOpts, _encodedMessage []byte) ([32]byte, error) { +// Solidity: function MAX_SESSION_DURATION() view returns(uint32) +func (_SessionRouter *SessionRouterCaller) MAXSESSIONDURATION(opts *bind.CallOpts) (uint32, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "getEthSignedMessageHash", _encodedMessage) + err := _SessionRouter.contract.Call(opts, &out, "MAX_SESSION_DURATION") if err != nil { - return *new([32]byte), err + return *new(uint32), err } - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) return out0, err } -// GetEthSignedMessageHash is a free data retrieval call binding the contract method 0xf9aea466. +// MAXSESSIONDURATION is a free data retrieval call binding the contract method 0xcd8cd4ad. // -// Solidity: function getEthSignedMessageHash(bytes _encodedMessage) pure returns(bytes32) -func (_SessionRouter *SessionRouterSession) GetEthSignedMessageHash(_encodedMessage []byte) ([32]byte, error) { - return _SessionRouter.Contract.GetEthSignedMessageHash(&_SessionRouter.CallOpts, _encodedMessage) +// Solidity: function MAX_SESSION_DURATION() view returns(uint32) +func (_SessionRouter *SessionRouterSession) MAXSESSIONDURATION() (uint32, error) { + return _SessionRouter.Contract.MAXSESSIONDURATION(&_SessionRouter.CallOpts) } -// GetEthSignedMessageHash is a free data retrieval call binding the contract method 0xf9aea466. +// MAXSESSIONDURATION is a free data retrieval call binding the contract method 0xcd8cd4ad. // -// Solidity: function getEthSignedMessageHash(bytes _encodedMessage) pure returns(bytes32) -func (_SessionRouter *SessionRouterCallerSession) GetEthSignedMessageHash(_encodedMessage []byte) ([32]byte, error) { - return _SessionRouter.Contract.GetEthSignedMessageHash(&_SessionRouter.CallOpts, _encodedMessage) +// Solidity: function MAX_SESSION_DURATION() view returns(uint32) +func (_SessionRouter *SessionRouterCallerSession) MAXSESSIONDURATION() (uint32, error) { + return _SessionRouter.Contract.MAXSESSIONDURATION(&_SessionRouter.CallOpts) } -// GetProviderBalance is a free data retrieval call binding the contract method 0x832eea0c. +// MINSESSIONDURATION is a free data retrieval call binding the contract method 0x7d980286. // -// Solidity: function getProviderBalance(address providerAddr) view returns(uint256 total, uint256 hold) -func (_SessionRouter *SessionRouterCaller) GetProviderBalance(opts *bind.CallOpts, providerAddr common.Address) (struct { - Total *big.Int - Hold *big.Int -}, error) { +// Solidity: function MIN_SESSION_DURATION() view returns(uint32) +func (_SessionRouter *SessionRouterCaller) MINSESSIONDURATION(opts *bind.CallOpts) (uint32, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "getProviderBalance", providerAddr) + err := _SessionRouter.contract.Call(opts, &out, "MIN_SESSION_DURATION") - outstruct := new(struct { - Total *big.Int - Hold *big.Int - }) if err != nil { - return *outstruct, err + return *new(uint32), err } - outstruct.Total = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.Hold = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) - return *outstruct, err + return out0, err } -// GetProviderBalance is a free data retrieval call binding the contract method 0x832eea0c. +// MINSESSIONDURATION is a free data retrieval call binding the contract method 0x7d980286. // -// Solidity: function getProviderBalance(address providerAddr) view returns(uint256 total, uint256 hold) -func (_SessionRouter *SessionRouterSession) GetProviderBalance(providerAddr common.Address) (struct { - Total *big.Int - Hold *big.Int -}, error) { - return _SessionRouter.Contract.GetProviderBalance(&_SessionRouter.CallOpts, providerAddr) +// Solidity: function MIN_SESSION_DURATION() view returns(uint32) +func (_SessionRouter *SessionRouterSession) MINSESSIONDURATION() (uint32, error) { + return _SessionRouter.Contract.MINSESSIONDURATION(&_SessionRouter.CallOpts) } -// GetProviderBalance is a free data retrieval call binding the contract method 0x832eea0c. +// MINSESSIONDURATION is a free data retrieval call binding the contract method 0x7d980286. // -// Solidity: function getProviderBalance(address providerAddr) view returns(uint256 total, uint256 hold) -func (_SessionRouter *SessionRouterCallerSession) GetProviderBalance(providerAddr common.Address) (struct { - Total *big.Int - Hold *big.Int -}, error) { - return _SessionRouter.Contract.GetProviderBalance(&_SessionRouter.CallOpts, providerAddr) +// Solidity: function MIN_SESSION_DURATION() view returns(uint32) +func (_SessionRouter *SessionRouterCallerSession) MINSESSIONDURATION() (uint32, error) { + return _SessionRouter.Contract.MINSESSIONDURATION(&_SessionRouter.CallOpts) +} + +// SIGNATURETTL is a free data retrieval call binding the contract method 0xe7d791d0. +// +// Solidity: function SIGNATURE_TTL() view returns(uint32) +func (_SessionRouter *SessionRouterCaller) SIGNATURETTL(opts *bind.CallOpts) (uint32, error) { + var out []interface{} + err := _SessionRouter.contract.Call(opts, &out, "SIGNATURE_TTL") + + if err != nil { + return *new(uint32), err + } + + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) + + return out0, err + +} + +// SIGNATURETTL is a free data retrieval call binding the contract method 0xe7d791d0. +// +// Solidity: function SIGNATURE_TTL() view returns(uint32) +func (_SessionRouter *SessionRouterSession) SIGNATURETTL() (uint32, error) { + return _SessionRouter.Contract.SIGNATURETTL(&_SessionRouter.CallOpts) +} + +// SIGNATURETTL is a free data retrieval call binding the contract method 0xe7d791d0. +// +// Solidity: function SIGNATURE_TTL() view returns(uint32) +func (_SessionRouter *SessionRouterCallerSession) SIGNATURETTL() (uint32, error) { + return _SessionRouter.Contract.SIGNATURETTL(&_SessionRouter.CallOpts) +} + +// ActiveSessionsCount is a free data retrieval call binding the contract method 0x782ea85c. +// +// Solidity: function activeSessionsCount() view returns(uint256) +func (_SessionRouter *SessionRouterCaller) ActiveSessionsCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SessionRouter.contract.Call(opts, &out, "activeSessionsCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ActiveSessionsCount is a free data retrieval call binding the contract method 0x782ea85c. +// +// Solidity: function activeSessionsCount() view returns(uint256) +func (_SessionRouter *SessionRouterSession) ActiveSessionsCount() (*big.Int, error) { + return _SessionRouter.Contract.ActiveSessionsCount(&_SessionRouter.CallOpts) +} + +// ActiveSessionsCount is a free data retrieval call binding the contract method 0x782ea85c. +// +// Solidity: function activeSessionsCount() view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) ActiveSessionsCount() (*big.Int, error) { + return _SessionRouter.Contract.ActiveSessionsCount(&_SessionRouter.CallOpts) +} + +// GetActiveSessionsByProvider is a free data retrieval call binding the contract method 0xcba645ab. +// +// Solidity: function getActiveSessionsByProvider(address provider) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCaller) GetActiveSessionsByProvider(opts *bind.CallOpts, provider common.Address) ([]Session, error) { + var out []interface{} + err := _SessionRouter.contract.Call(opts, &out, "getActiveSessionsByProvider", provider) + + if err != nil { + return *new([]Session), err + } + + out0 := *abi.ConvertType(out[0], new([]Session)).(*[]Session) + + return out0, err + +} + +// GetActiveSessionsByProvider is a free data retrieval call binding the contract method 0xcba645ab. +// +// Solidity: function getActiveSessionsByProvider(address provider) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterSession) GetActiveSessionsByProvider(provider common.Address) ([]Session, error) { + return _SessionRouter.Contract.GetActiveSessionsByProvider(&_SessionRouter.CallOpts, provider) } -// GetProviderClaimBalance is a free data retrieval call binding the contract method 0x6c98599b. +// GetActiveSessionsByProvider is a free data retrieval call binding the contract method 0xcba645ab. // -// Solidity: function getProviderClaimBalance(address providerAddr) view returns(uint256) -func (_SessionRouter *SessionRouterCaller) GetProviderClaimBalance(opts *bind.CallOpts, providerAddr common.Address) (*big.Int, error) { +// Solidity: function getActiveSessionsByProvider(address provider) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCallerSession) GetActiveSessionsByProvider(provider common.Address) ([]Session, error) { + return _SessionRouter.Contract.GetActiveSessionsByProvider(&_SessionRouter.CallOpts, provider) +} + +// GetActiveSessionsByUser is a free data retrieval call binding the contract method 0xb3da8c38. +// +// Solidity: function getActiveSessionsByUser(address user) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCaller) GetActiveSessionsByUser(opts *bind.CallOpts, user common.Address) ([]Session, error) { + var out []interface{} + err := _SessionRouter.contract.Call(opts, &out, "getActiveSessionsByUser", user) + + if err != nil { + return *new([]Session), err + } + + out0 := *abi.ConvertType(out[0], new([]Session)).(*[]Session) + + return out0, err + +} + +// GetActiveSessionsByUser is a free data retrieval call binding the contract method 0xb3da8c38. +// +// Solidity: function getActiveSessionsByUser(address user) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterSession) GetActiveSessionsByUser(user common.Address) ([]Session, error) { + return _SessionRouter.Contract.GetActiveSessionsByUser(&_SessionRouter.CallOpts, user) +} + +// GetActiveSessionsByUser is a free data retrieval call binding the contract method 0xb3da8c38. +// +// Solidity: function getActiveSessionsByUser(address user) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCallerSession) GetActiveSessionsByUser(user common.Address) ([]Session, error) { + return _SessionRouter.Contract.GetActiveSessionsByUser(&_SessionRouter.CallOpts, user) +} + +// GetComputeBalance is a free data retrieval call binding the contract method 0x76738e9e. +// +// Solidity: function getComputeBalance(uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterCaller) GetComputeBalance(opts *bind.CallOpts, timestamp *big.Int) (*big.Int, error) { + var out []interface{} + err := _SessionRouter.contract.Call(opts, &out, "getComputeBalance", timestamp) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetComputeBalance is a free data retrieval call binding the contract method 0x76738e9e. +// +// Solidity: function getComputeBalance(uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterSession) GetComputeBalance(timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.GetComputeBalance(&_SessionRouter.CallOpts, timestamp) +} + +// GetComputeBalance is a free data retrieval call binding the contract method 0x76738e9e. +// +// Solidity: function getComputeBalance(uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) GetComputeBalance(timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.GetComputeBalance(&_SessionRouter.CallOpts, timestamp) +} + +// GetProviderClaimableBalance is a free data retrieval call binding the contract method 0xa8ca6323. +// +// Solidity: function getProviderClaimableBalance(bytes32 sessionId) view returns(uint256) +func (_SessionRouter *SessionRouterCaller) GetProviderClaimableBalance(opts *bind.CallOpts, sessionId [32]byte) (*big.Int, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "getProviderClaimBalance", providerAddr) + err := _SessionRouter.contract.Call(opts, &out, "getProviderClaimableBalance", sessionId) if err != nil { return *new(*big.Int), err @@ -287,32 +439,32 @@ func (_SessionRouter *SessionRouterCaller) GetProviderClaimBalance(opts *bind.Ca } -// GetProviderClaimBalance is a free data retrieval call binding the contract method 0x6c98599b. +// GetProviderClaimableBalance is a free data retrieval call binding the contract method 0xa8ca6323. // -// Solidity: function getProviderClaimBalance(address providerAddr) view returns(uint256) -func (_SessionRouter *SessionRouterSession) GetProviderClaimBalance(providerAddr common.Address) (*big.Int, error) { - return _SessionRouter.Contract.GetProviderClaimBalance(&_SessionRouter.CallOpts, providerAddr) +// Solidity: function getProviderClaimableBalance(bytes32 sessionId) view returns(uint256) +func (_SessionRouter *SessionRouterSession) GetProviderClaimableBalance(sessionId [32]byte) (*big.Int, error) { + return _SessionRouter.Contract.GetProviderClaimableBalance(&_SessionRouter.CallOpts, sessionId) } -// GetProviderClaimBalance is a free data retrieval call binding the contract method 0x6c98599b. +// GetProviderClaimableBalance is a free data retrieval call binding the contract method 0xa8ca6323. // -// Solidity: function getProviderClaimBalance(address providerAddr) view returns(uint256) -func (_SessionRouter *SessionRouterCallerSession) GetProviderClaimBalance(providerAddr common.Address) (*big.Int, error) { - return _SessionRouter.Contract.GetProviderClaimBalance(&_SessionRouter.CallOpts, providerAddr) +// Solidity: function getProviderClaimableBalance(bytes32 sessionId) view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) GetProviderClaimableBalance(sessionId [32]byte) (*big.Int, error) { + return _SessionRouter.Contract.GetProviderClaimableBalance(&_SessionRouter.CallOpts, sessionId) } // GetSession is a free data retrieval call binding the contract method 0x39b240bd. // -// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,uint256,uint256,bytes,uint256,uint256,uint256)) -func (_SessionRouter *SessionRouterCaller) GetSession(opts *bind.CallOpts, sessionId [32]byte) (SessionRouterSession, error) { +// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)) +func (_SessionRouter *SessionRouterCaller) GetSession(opts *bind.CallOpts, sessionId [32]byte) (Session, error) { var out []interface{} err := _SessionRouter.contract.Call(opts, &out, "getSession", sessionId) if err != nil { - return *new(SessionRouterSession), err + return *new(Session), err } - out0 := *abi.ConvertType(out[0], new(SessionRouterSession)).(*SessionRouterSession) + out0 := *abi.ConvertType(out[0], new(Session)).(*Session) return out0, err @@ -320,328 +472,241 @@ func (_SessionRouter *SessionRouterCaller) GetSession(opts *bind.CallOpts, sessi // GetSession is a free data retrieval call binding the contract method 0x39b240bd. // -// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,uint256,uint256,bytes,uint256,uint256,uint256)) -func (_SessionRouter *SessionRouterSession) GetSession(sessionId [32]byte) (SessionRouterSession, error) { +// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)) +func (_SessionRouter *SessionRouterSession) GetSession(sessionId [32]byte) (Session, error) { return _SessionRouter.Contract.GetSession(&_SessionRouter.CallOpts, sessionId) } // GetSession is a free data retrieval call binding the contract method 0x39b240bd. // -// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,uint256,uint256,bytes,uint256,uint256,uint256)) -func (_SessionRouter *SessionRouterCallerSession) GetSession(sessionId [32]byte) (SessionRouterSession, error) { +// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)) +func (_SessionRouter *SessionRouterCallerSession) GetSession(sessionId [32]byte) (Session, error) { return _SessionRouter.Contract.GetSession(&_SessionRouter.CallOpts, sessionId) } -// Map is a free data retrieval call binding the contract method 0x0ae186a8. +// GetSessionsByModel is a free data retrieval call binding the contract method 0x67a057f6. // -// Solidity: function map(bytes32 ) view returns(uint256) -func (_SessionRouter *SessionRouterCaller) Map(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) { +// Solidity: function getSessionsByModel(bytes32 modelId, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCaller) GetSessionsByModel(opts *bind.CallOpts, modelId [32]byte, offset *big.Int, limit uint8) ([]Session, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "map", arg0) + err := _SessionRouter.contract.Call(opts, &out, "getSessionsByModel", modelId, offset, limit) if err != nil { - return *new(*big.Int), err + return *new([]Session), err } - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new([]Session)).(*[]Session) return out0, err } -// Map is a free data retrieval call binding the contract method 0x0ae186a8. +// GetSessionsByModel is a free data retrieval call binding the contract method 0x67a057f6. // -// Solidity: function map(bytes32 ) view returns(uint256) -func (_SessionRouter *SessionRouterSession) Map(arg0 [32]byte) (*big.Int, error) { - return _SessionRouter.Contract.Map(&_SessionRouter.CallOpts, arg0) +// Solidity: function getSessionsByModel(bytes32 modelId, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterSession) GetSessionsByModel(modelId [32]byte, offset *big.Int, limit uint8) ([]Session, error) { + return _SessionRouter.Contract.GetSessionsByModel(&_SessionRouter.CallOpts, modelId, offset, limit) } -// Map is a free data retrieval call binding the contract method 0x0ae186a8. +// GetSessionsByModel is a free data retrieval call binding the contract method 0x67a057f6. // -// Solidity: function map(bytes32 ) view returns(uint256) -func (_SessionRouter *SessionRouterCallerSession) Map(arg0 [32]byte) (*big.Int, error) { - return _SessionRouter.Contract.Map(&_SessionRouter.CallOpts, arg0) +// Solidity: function getSessionsByModel(bytes32 modelId, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCallerSession) GetSessionsByModel(modelId [32]byte, offset *big.Int, limit uint8) ([]Session, error) { + return _SessionRouter.Contract.GetSessionsByModel(&_SessionRouter.CallOpts, modelId, offset, limit) } -// Marketplace is a free data retrieval call binding the contract method 0xabc8c7af. +// GetSessionsByProvider is a free data retrieval call binding the contract method 0x8ea1ac0e. // -// Solidity: function marketplace() view returns(address) -func (_SessionRouter *SessionRouterCaller) Marketplace(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function getSessionsByProvider(address provider, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCaller) GetSessionsByProvider(opts *bind.CallOpts, provider common.Address, offset *big.Int, limit uint8) ([]Session, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "marketplace") + err := _SessionRouter.contract.Call(opts, &out, "getSessionsByProvider", provider, offset, limit) if err != nil { - return *new(common.Address), err + return *new([]Session), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new([]Session)).(*[]Session) return out0, err } -// Marketplace is a free data retrieval call binding the contract method 0xabc8c7af. +// GetSessionsByProvider is a free data retrieval call binding the contract method 0x8ea1ac0e. // -// Solidity: function marketplace() view returns(address) -func (_SessionRouter *SessionRouterSession) Marketplace() (common.Address, error) { - return _SessionRouter.Contract.Marketplace(&_SessionRouter.CallOpts) +// Solidity: function getSessionsByProvider(address provider, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterSession) GetSessionsByProvider(provider common.Address, offset *big.Int, limit uint8) ([]Session, error) { + return _SessionRouter.Contract.GetSessionsByProvider(&_SessionRouter.CallOpts, provider, offset, limit) } -// Marketplace is a free data retrieval call binding the contract method 0xabc8c7af. +// GetSessionsByProvider is a free data retrieval call binding the contract method 0x8ea1ac0e. // -// Solidity: function marketplace() view returns(address) -func (_SessionRouter *SessionRouterCallerSession) Marketplace() (common.Address, error) { - return _SessionRouter.Contract.Marketplace(&_SessionRouter.CallOpts) +// Solidity: function getSessionsByProvider(address provider, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCallerSession) GetSessionsByProvider(provider common.Address, offset *big.Int, limit uint8) ([]Session, error) { + return _SessionRouter.Contract.GetSessionsByProvider(&_SessionRouter.CallOpts, provider, offset, limit) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// GetSessionsByUser is a free data retrieval call binding the contract method 0xb954275b. // -// Solidity: function owner() view returns(address) -func (_SessionRouter *SessionRouterCaller) Owner(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function getSessionsByUser(address user, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCaller) GetSessionsByUser(opts *bind.CallOpts, user common.Address, offset *big.Int, limit uint8) ([]Session, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "owner") + err := _SessionRouter.contract.Call(opts, &out, "getSessionsByUser", user, offset, limit) if err != nil { - return *new(common.Address), err + return *new([]Session), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new([]Session)).(*[]Session) return out0, err } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// GetSessionsByUser is a free data retrieval call binding the contract method 0xb954275b. // -// Solidity: function owner() view returns(address) -func (_SessionRouter *SessionRouterSession) Owner() (common.Address, error) { - return _SessionRouter.Contract.Owner(&_SessionRouter.CallOpts) +// Solidity: function getSessionsByUser(address user, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterSession) GetSessionsByUser(user common.Address, offset *big.Int, limit uint8) ([]Session, error) { + return _SessionRouter.Contract.GetSessionsByUser(&_SessionRouter.CallOpts, user, offset, limit) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// GetSessionsByUser is a free data retrieval call binding the contract method 0xb954275b. // -// Solidity: function owner() view returns(address) -func (_SessionRouter *SessionRouterCallerSession) Owner() (common.Address, error) { - return _SessionRouter.Contract.Owner(&_SessionRouter.CallOpts) +// Solidity: function getSessionsByUser(address user, uint256 offset, uint8 limit) view returns((bytes32,address,address,bytes32,bytes32,uint256,uint256,bytes,uint256,uint256,uint256,uint256,uint256)[]) +func (_SessionRouter *SessionRouterCallerSession) GetSessionsByUser(user common.Address, offset *big.Int, limit uint8) ([]Session, error) { + return _SessionRouter.Contract.GetSessionsByUser(&_SessionRouter.CallOpts, user, offset, limit) } -// ProviderOnHold is a free data retrieval call binding the contract method 0xdbf7d54f. +// GetTodaysBudget is a free data retrieval call binding the contract method 0x351ffeb0. // -// Solidity: function providerOnHold(address , uint256 ) view returns(uint256 amount, uint256 releaseAt) -func (_SessionRouter *SessionRouterCaller) ProviderOnHold(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { +// Solidity: function getTodaysBudget(uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterCaller) GetTodaysBudget(opts *bind.CallOpts, timestamp *big.Int) (*big.Int, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "providerOnHold", arg0, arg1) + err := _SessionRouter.contract.Call(opts, &out, "getTodaysBudget", timestamp) - outstruct := new(struct { - Amount *big.Int - ReleaseAt *big.Int - }) if err != nil { - return *outstruct, err + return *new(*big.Int), err } - outstruct.Amount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.ReleaseAt = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - return *outstruct, err + return out0, err } -// ProviderOnHold is a free data retrieval call binding the contract method 0xdbf7d54f. +// GetTodaysBudget is a free data retrieval call binding the contract method 0x351ffeb0. // -// Solidity: function providerOnHold(address , uint256 ) view returns(uint256 amount, uint256 releaseAt) -func (_SessionRouter *SessionRouterSession) ProviderOnHold(arg0 common.Address, arg1 *big.Int) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - return _SessionRouter.Contract.ProviderOnHold(&_SessionRouter.CallOpts, arg0, arg1) +// Solidity: function getTodaysBudget(uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterSession) GetTodaysBudget(timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.GetTodaysBudget(&_SessionRouter.CallOpts, timestamp) } -// ProviderOnHold is a free data retrieval call binding the contract method 0xdbf7d54f. +// GetTodaysBudget is a free data retrieval call binding the contract method 0x351ffeb0. // -// Solidity: function providerOnHold(address , uint256 ) view returns(uint256 amount, uint256 releaseAt) -func (_SessionRouter *SessionRouterCallerSession) ProviderOnHold(arg0 common.Address, arg1 *big.Int) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - return _SessionRouter.Contract.ProviderOnHold(&_SessionRouter.CallOpts, arg0, arg1) +// Solidity: function getTodaysBudget(uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) GetTodaysBudget(timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.GetTodaysBudget(&_SessionRouter.CallOpts, timestamp) } -// RecoverSigner is a free data retrieval call binding the contract method 0x97aba7f9. +// IsValidReceipt is a free data retrieval call binding the contract method 0x626dd729. // -// Solidity: function recoverSigner(bytes32 message, bytes sig) pure returns(address) -func (_SessionRouter *SessionRouterCaller) RecoverSigner(opts *bind.CallOpts, message [32]byte, sig []byte) (common.Address, error) { +// Solidity: function isValidReceipt(address signer, bytes receipt, bytes signature) pure returns(bool) +func (_SessionRouter *SessionRouterCaller) IsValidReceipt(opts *bind.CallOpts, signer common.Address, receipt []byte, signature []byte) (bool, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "recoverSigner", message, sig) + err := _SessionRouter.contract.Call(opts, &out, "isValidReceipt", signer, receipt, signature) if err != nil { - return *new(common.Address), err + return *new(bool), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) return out0, err } -// RecoverSigner is a free data retrieval call binding the contract method 0x97aba7f9. +// IsValidReceipt is a free data retrieval call binding the contract method 0x626dd729. // -// Solidity: function recoverSigner(bytes32 message, bytes sig) pure returns(address) -func (_SessionRouter *SessionRouterSession) RecoverSigner(message [32]byte, sig []byte) (common.Address, error) { - return _SessionRouter.Contract.RecoverSigner(&_SessionRouter.CallOpts, message, sig) +// Solidity: function isValidReceipt(address signer, bytes receipt, bytes signature) pure returns(bool) +func (_SessionRouter *SessionRouterSession) IsValidReceipt(signer common.Address, receipt []byte, signature []byte) (bool, error) { + return _SessionRouter.Contract.IsValidReceipt(&_SessionRouter.CallOpts, signer, receipt, signature) } -// RecoverSigner is a free data retrieval call binding the contract method 0x97aba7f9. +// IsValidReceipt is a free data retrieval call binding the contract method 0x626dd729. // -// Solidity: function recoverSigner(bytes32 message, bytes sig) pure returns(address) -func (_SessionRouter *SessionRouterCallerSession) RecoverSigner(message [32]byte, sig []byte) (common.Address, error) { - return _SessionRouter.Contract.RecoverSigner(&_SessionRouter.CallOpts, message, sig) +// Solidity: function isValidReceipt(address signer, bytes receipt, bytes signature) pure returns(bool) +func (_SessionRouter *SessionRouterCallerSession) IsValidReceipt(signer common.Address, receipt []byte, signature []byte) (bool, error) { + return _SessionRouter.Contract.IsValidReceipt(&_SessionRouter.CallOpts, signer, receipt, signature) } -// Sessions is a free data retrieval call binding the contract method 0x83c4b7a3. +// SessionsCount is a free data retrieval call binding the contract method 0x312f6307. // -// Solidity: function sessions(uint256 ) view returns(bytes32 id, address user, address provider, bytes32 modelAgentId, uint256 budget, uint256 price, bytes closeoutReceipt, uint256 closeoutType, uint256 openedAt, uint256 closedAt) -func (_SessionRouter *SessionRouterCaller) Sessions(opts *bind.CallOpts, arg0 *big.Int) (struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int -}, error) { +// Solidity: function sessionsCount() view returns(uint256) +func (_SessionRouter *SessionRouterCaller) SessionsCount(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "sessions", arg0) + err := _SessionRouter.contract.Call(opts, &out, "sessionsCount") - outstruct := new(struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int - }) if err != nil { - return *outstruct, err + return *new(*big.Int), err } - outstruct.Id = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.User = *abi.ConvertType(out[1], new(common.Address)).(*common.Address) - outstruct.Provider = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) - outstruct.ModelAgentId = *abi.ConvertType(out[3], new([32]byte)).(*[32]byte) - outstruct.Budget = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) - outstruct.Price = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) - outstruct.CloseoutReceipt = *abi.ConvertType(out[6], new([]byte)).(*[]byte) - outstruct.CloseoutType = *abi.ConvertType(out[7], new(*big.Int)).(**big.Int) - outstruct.OpenedAt = *abi.ConvertType(out[8], new(*big.Int)).(**big.Int) - outstruct.ClosedAt = *abi.ConvertType(out[9], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - return *outstruct, err + return out0, err } -// Sessions is a free data retrieval call binding the contract method 0x83c4b7a3. +// SessionsCount is a free data retrieval call binding the contract method 0x312f6307. // -// Solidity: function sessions(uint256 ) view returns(bytes32 id, address user, address provider, bytes32 modelAgentId, uint256 budget, uint256 price, bytes closeoutReceipt, uint256 closeoutType, uint256 openedAt, uint256 closedAt) -func (_SessionRouter *SessionRouterSession) Sessions(arg0 *big.Int) (struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int -}, error) { - return _SessionRouter.Contract.Sessions(&_SessionRouter.CallOpts, arg0) -} - -// Sessions is a free data retrieval call binding the contract method 0x83c4b7a3. -// -// Solidity: function sessions(uint256 ) view returns(bytes32 id, address user, address provider, bytes32 modelAgentId, uint256 budget, uint256 price, bytes closeoutReceipt, uint256 closeoutType, uint256 openedAt, uint256 closedAt) -func (_SessionRouter *SessionRouterCallerSession) Sessions(arg0 *big.Int) (struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int -}, error) { - return _SessionRouter.Contract.Sessions(&_SessionRouter.CallOpts, arg0) +// Solidity: function sessionsCount() view returns(uint256) +func (_SessionRouter *SessionRouterSession) SessionsCount() (*big.Int, error) { + return _SessionRouter.Contract.SessionsCount(&_SessionRouter.CallOpts) } -// SplitSignature is a free data retrieval call binding the contract method 0xa7bb5803. +// SessionsCount is a free data retrieval call binding the contract method 0x312f6307. // -// Solidity: function splitSignature(bytes sig) pure returns(bytes32 r, bytes32 s, uint8 v) -func (_SessionRouter *SessionRouterCaller) SplitSignature(opts *bind.CallOpts, sig []byte) (struct { - R [32]byte - S [32]byte - V uint8 -}, error) { +// Solidity: function sessionsCount() view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) SessionsCount() (*big.Int, error) { + return _SessionRouter.Contract.SessionsCount(&_SessionRouter.CallOpts) +} + +// StakeToStipend is a free data retrieval call binding the contract method 0x0a23b21f. +// +// Solidity: function stakeToStipend(uint256 sessionStake, uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterCaller) StakeToStipend(opts *bind.CallOpts, sessionStake *big.Int, timestamp *big.Int) (*big.Int, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "splitSignature", sig) + err := _SessionRouter.contract.Call(opts, &out, "stakeToStipend", sessionStake, timestamp) - outstruct := new(struct { - R [32]byte - S [32]byte - V uint8 - }) if err != nil { - return *outstruct, err + return *new(*big.Int), err } - outstruct.R = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.S = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) - outstruct.V = *abi.ConvertType(out[2], new(uint8)).(*uint8) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - return *outstruct, err + return out0, err } -// SplitSignature is a free data retrieval call binding the contract method 0xa7bb5803. +// StakeToStipend is a free data retrieval call binding the contract method 0x0a23b21f. // -// Solidity: function splitSignature(bytes sig) pure returns(bytes32 r, bytes32 s, uint8 v) -func (_SessionRouter *SessionRouterSession) SplitSignature(sig []byte) (struct { - R [32]byte - S [32]byte - V uint8 -}, error) { - return _SessionRouter.Contract.SplitSignature(&_SessionRouter.CallOpts, sig) +// Solidity: function stakeToStipend(uint256 sessionStake, uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterSession) StakeToStipend(sessionStake *big.Int, timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.StakeToStipend(&_SessionRouter.CallOpts, sessionStake, timestamp) } -// SplitSignature is a free data retrieval call binding the contract method 0xa7bb5803. +// StakeToStipend is a free data retrieval call binding the contract method 0x0a23b21f. // -// Solidity: function splitSignature(bytes sig) pure returns(bytes32 r, bytes32 s, uint8 v) -func (_SessionRouter *SessionRouterCallerSession) SplitSignature(sig []byte) (struct { - R [32]byte - S [32]byte - V uint8 -}, error) { - return _SessionRouter.Contract.SplitSignature(&_SessionRouter.CallOpts, sig) +// Solidity: function stakeToStipend(uint256 sessionStake, uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) StakeToStipend(sessionStake *big.Int, timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.StakeToStipend(&_SessionRouter.CallOpts, sessionStake, timestamp) } -// StakeDelay is a free data retrieval call binding the contract method 0x946ada60. +// StartOfTheDay is a free data retrieval call binding the contract method 0xeedd0a72. // -// Solidity: function stakeDelay() view returns(int256) -func (_SessionRouter *SessionRouterCaller) StakeDelay(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function startOfTheDay(uint256 timestamp) pure returns(uint256) +func (_SessionRouter *SessionRouterCaller) StartOfTheDay(opts *bind.CallOpts, timestamp *big.Int) (*big.Int, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "stakeDelay") + err := _SessionRouter.contract.Call(opts, &out, "startOfTheDay", timestamp) if err != nil { return *new(*big.Int), err @@ -653,253 +718,287 @@ func (_SessionRouter *SessionRouterCaller) StakeDelay(opts *bind.CallOpts) (*big } -// StakeDelay is a free data retrieval call binding the contract method 0x946ada60. +// StartOfTheDay is a free data retrieval call binding the contract method 0xeedd0a72. // -// Solidity: function stakeDelay() view returns(int256) -func (_SessionRouter *SessionRouterSession) StakeDelay() (*big.Int, error) { - return _SessionRouter.Contract.StakeDelay(&_SessionRouter.CallOpts) +// Solidity: function startOfTheDay(uint256 timestamp) pure returns(uint256) +func (_SessionRouter *SessionRouterSession) StartOfTheDay(timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.StartOfTheDay(&_SessionRouter.CallOpts, timestamp) } -// StakeDelay is a free data retrieval call binding the contract method 0x946ada60. +// StartOfTheDay is a free data retrieval call binding the contract method 0xeedd0a72. // -// Solidity: function stakeDelay() view returns(int256) -func (_SessionRouter *SessionRouterCallerSession) StakeDelay() (*big.Int, error) { - return _SessionRouter.Contract.StakeDelay(&_SessionRouter.CallOpts) +// Solidity: function startOfTheDay(uint256 timestamp) pure returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) StartOfTheDay(timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.StartOfTheDay(&_SessionRouter.CallOpts, timestamp) } -// StakingDailyStipend is a free data retrieval call binding the contract method 0xfcfc2201. +// StipendToStake is a free data retrieval call binding the contract method 0xac3c19ce. // -// Solidity: function stakingDailyStipend() view returns(address) -func (_SessionRouter *SessionRouterCaller) StakingDailyStipend(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function stipendToStake(uint256 stipend, uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterCaller) StipendToStake(opts *bind.CallOpts, stipend *big.Int, timestamp *big.Int) (*big.Int, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "stakingDailyStipend") + err := _SessionRouter.contract.Call(opts, &out, "stipendToStake", stipend, timestamp) if err != nil { - return *new(common.Address), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// StakingDailyStipend is a free data retrieval call binding the contract method 0xfcfc2201. +// StipendToStake is a free data retrieval call binding the contract method 0xac3c19ce. // -// Solidity: function stakingDailyStipend() view returns(address) -func (_SessionRouter *SessionRouterSession) StakingDailyStipend() (common.Address, error) { - return _SessionRouter.Contract.StakingDailyStipend(&_SessionRouter.CallOpts) +// Solidity: function stipendToStake(uint256 stipend, uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterSession) StipendToStake(stipend *big.Int, timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.StipendToStake(&_SessionRouter.CallOpts, stipend, timestamp) } -// StakingDailyStipend is a free data retrieval call binding the contract method 0xfcfc2201. +// StipendToStake is a free data retrieval call binding the contract method 0xac3c19ce. // -// Solidity: function stakingDailyStipend() view returns(address) -func (_SessionRouter *SessionRouterCallerSession) StakingDailyStipend() (common.Address, error) { - return _SessionRouter.Contract.StakingDailyStipend(&_SessionRouter.CallOpts) +// Solidity: function stipendToStake(uint256 stipend, uint256 timestamp) view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) StipendToStake(stipend *big.Int, timestamp *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.StipendToStake(&_SessionRouter.CallOpts, stipend, timestamp) } -// Token is a free data retrieval call binding the contract method 0xfc0c546a. +// WhenComputeBalanceIsLessThan is a free data retrieval call binding the contract method 0xfa64e1db. // -// Solidity: function token() view returns(address) -func (_SessionRouter *SessionRouterCaller) Token(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function whenComputeBalanceIsLessThan(uint256 targetReward) view returns(uint256) +func (_SessionRouter *SessionRouterCaller) WhenComputeBalanceIsLessThan(opts *bind.CallOpts, targetReward *big.Int) (*big.Int, error) { var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "token") + err := _SessionRouter.contract.Call(opts, &out, "whenComputeBalanceIsLessThan", targetReward) if err != nil { - return *new(common.Address), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// Token is a free data retrieval call binding the contract method 0xfc0c546a. +// WhenComputeBalanceIsLessThan is a free data retrieval call binding the contract method 0xfa64e1db. // -// Solidity: function token() view returns(address) -func (_SessionRouter *SessionRouterSession) Token() (common.Address, error) { - return _SessionRouter.Contract.Token(&_SessionRouter.CallOpts) +// Solidity: function whenComputeBalanceIsLessThan(uint256 targetReward) view returns(uint256) +func (_SessionRouter *SessionRouterSession) WhenComputeBalanceIsLessThan(targetReward *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.WhenComputeBalanceIsLessThan(&_SessionRouter.CallOpts, targetReward) } -// Token is a free data retrieval call binding the contract method 0xfc0c546a. +// WhenComputeBalanceIsLessThan is a free data retrieval call binding the contract method 0xfa64e1db. // -// Solidity: function token() view returns(address) -func (_SessionRouter *SessionRouterCallerSession) Token() (common.Address, error) { - return _SessionRouter.Contract.Token(&_SessionRouter.CallOpts) +// Solidity: function whenComputeBalanceIsLessThan(uint256 targetReward) view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) WhenComputeBalanceIsLessThan(targetReward *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.WhenComputeBalanceIsLessThan(&_SessionRouter.CallOpts, targetReward) } -// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xc9a93c1a. +// WhenStipendLessThanDailyPrice is a free data retrieval call binding the contract method 0xf13619da. // -// Solidity: function claimProviderBalance(uint256 amountToWithdraw, address to) returns() -func (_SessionRouter *SessionRouterTransactor) ClaimProviderBalance(opts *bind.TransactOpts, amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "claimProviderBalance", amountToWithdraw, to) +// Solidity: function whenStipendLessThanDailyPrice(uint256 sessionStake, uint256 pricePerSecond) view returns(uint256) +func (_SessionRouter *SessionRouterCaller) WhenStipendLessThanDailyPrice(opts *bind.CallOpts, sessionStake *big.Int, pricePerSecond *big.Int) (*big.Int, error) { + var out []interface{} + err := _SessionRouter.contract.Call(opts, &out, "whenStipendLessThanDailyPrice", sessionStake, pricePerSecond) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + } -// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xc9a93c1a. +// WhenStipendLessThanDailyPrice is a free data retrieval call binding the contract method 0xf13619da. // -// Solidity: function claimProviderBalance(uint256 amountToWithdraw, address to) returns() -func (_SessionRouter *SessionRouterSession) ClaimProviderBalance(amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.ClaimProviderBalance(&_SessionRouter.TransactOpts, amountToWithdraw, to) +// Solidity: function whenStipendLessThanDailyPrice(uint256 sessionStake, uint256 pricePerSecond) view returns(uint256) +func (_SessionRouter *SessionRouterSession) WhenStipendLessThanDailyPrice(sessionStake *big.Int, pricePerSecond *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.WhenStipendLessThanDailyPrice(&_SessionRouter.CallOpts, sessionStake, pricePerSecond) } -// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xc9a93c1a. +// WhenStipendLessThanDailyPrice is a free data retrieval call binding the contract method 0xf13619da. // -// Solidity: function claimProviderBalance(uint256 amountToWithdraw, address to) returns() -func (_SessionRouter *SessionRouterTransactorSession) ClaimProviderBalance(amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.ClaimProviderBalance(&_SessionRouter.TransactOpts, amountToWithdraw, to) +// Solidity: function whenStipendLessThanDailyPrice(uint256 sessionStake, uint256 pricePerSecond) view returns(uint256) +func (_SessionRouter *SessionRouterCallerSession) WhenStipendLessThanDailyPrice(sessionStake *big.Int, pricePerSecond *big.Int) (*big.Int, error) { + return _SessionRouter.Contract.WhenStipendLessThanDailyPrice(&_SessionRouter.CallOpts, sessionStake, pricePerSecond) } -// CloseSession is a paid mutator transaction binding the contract method 0x9775d1ff. +// WithdrawableUserStake is a free data retrieval call binding the contract method 0x536f1f82. // -// Solidity: function closeSession(bytes32 sessionId, bytes receiptEncoded, bytes signature) returns() -func (_SessionRouter *SessionRouterTransactor) CloseSession(opts *bind.TransactOpts, sessionId [32]byte, receiptEncoded []byte, signature []byte) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "closeSession", sessionId, receiptEncoded, signature) +// Solidity: function withdrawableUserStake(address userAddr) view returns(uint256 avail, uint256 hold) +func (_SessionRouter *SessionRouterCaller) WithdrawableUserStake(opts *bind.CallOpts, userAddr common.Address) (struct { + Avail *big.Int + Hold *big.Int +}, error) { + var out []interface{} + err := _SessionRouter.contract.Call(opts, &out, "withdrawableUserStake", userAddr) + + outstruct := new(struct { + Avail *big.Int + Hold *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Avail = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.Hold = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + + return *outstruct, err + } -// CloseSession is a paid mutator transaction binding the contract method 0x9775d1ff. +// WithdrawableUserStake is a free data retrieval call binding the contract method 0x536f1f82. // -// Solidity: function closeSession(bytes32 sessionId, bytes receiptEncoded, bytes signature) returns() -func (_SessionRouter *SessionRouterSession) CloseSession(sessionId [32]byte, receiptEncoded []byte, signature []byte) (*types.Transaction, error) { - return _SessionRouter.Contract.CloseSession(&_SessionRouter.TransactOpts, sessionId, receiptEncoded, signature) +// Solidity: function withdrawableUserStake(address userAddr) view returns(uint256 avail, uint256 hold) +func (_SessionRouter *SessionRouterSession) WithdrawableUserStake(userAddr common.Address) (struct { + Avail *big.Int + Hold *big.Int +}, error) { + return _SessionRouter.Contract.WithdrawableUserStake(&_SessionRouter.CallOpts, userAddr) } -// CloseSession is a paid mutator transaction binding the contract method 0x9775d1ff. +// WithdrawableUserStake is a free data retrieval call binding the contract method 0x536f1f82. // -// Solidity: function closeSession(bytes32 sessionId, bytes receiptEncoded, bytes signature) returns() -func (_SessionRouter *SessionRouterTransactorSession) CloseSession(sessionId [32]byte, receiptEncoded []byte, signature []byte) (*types.Transaction, error) { - return _SessionRouter.Contract.CloseSession(&_SessionRouter.TransactOpts, sessionId, receiptEncoded, signature) +// Solidity: function withdrawableUserStake(address userAddr) view returns(uint256 avail, uint256 hold) +func (_SessionRouter *SessionRouterCallerSession) WithdrawableUserStake(userAddr common.Address) (struct { + Avail *big.Int + Hold *big.Int +}, error) { + return _SessionRouter.Contract.WithdrawableUserStake(&_SessionRouter.CallOpts, userAddr) } -// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. +// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xbab3de02. // -// Solidity: function deleteHistory(bytes32 sessionId) returns() -func (_SessionRouter *SessionRouterTransactor) DeleteHistory(opts *bind.TransactOpts, sessionId [32]byte) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "deleteHistory", sessionId) +// Solidity: function claimProviderBalance(bytes32 sessionId, uint256 amountToWithdraw, address to) returns() +func (_SessionRouter *SessionRouterTransactor) ClaimProviderBalance(opts *bind.TransactOpts, sessionId [32]byte, amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { + return _SessionRouter.contract.Transact(opts, "claimProviderBalance", sessionId, amountToWithdraw, to) } -// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. +// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xbab3de02. // -// Solidity: function deleteHistory(bytes32 sessionId) returns() -func (_SessionRouter *SessionRouterSession) DeleteHistory(sessionId [32]byte) (*types.Transaction, error) { - return _SessionRouter.Contract.DeleteHistory(&_SessionRouter.TransactOpts, sessionId) +// Solidity: function claimProviderBalance(bytes32 sessionId, uint256 amountToWithdraw, address to) returns() +func (_SessionRouter *SessionRouterSession) ClaimProviderBalance(sessionId [32]byte, amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { + return _SessionRouter.Contract.ClaimProviderBalance(&_SessionRouter.TransactOpts, sessionId, amountToWithdraw, to) } -// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. +// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xbab3de02. // -// Solidity: function deleteHistory(bytes32 sessionId) returns() -func (_SessionRouter *SessionRouterTransactorSession) DeleteHistory(sessionId [32]byte) (*types.Transaction, error) { - return _SessionRouter.Contract.DeleteHistory(&_SessionRouter.TransactOpts, sessionId) +// Solidity: function claimProviderBalance(bytes32 sessionId, uint256 amountToWithdraw, address to) returns() +func (_SessionRouter *SessionRouterTransactorSession) ClaimProviderBalance(sessionId [32]byte, amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { + return _SessionRouter.Contract.ClaimProviderBalance(&_SessionRouter.TransactOpts, sessionId, amountToWithdraw, to) } -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. +// CloseSession is a paid mutator transaction binding the contract method 0x42f77a31. // -// Solidity: function initialize(address _token, address _stakingDailyStipend, address _marketplace) returns() -func (_SessionRouter *SessionRouterTransactor) Initialize(opts *bind.TransactOpts, _token common.Address, _stakingDailyStipend common.Address, _marketplace common.Address) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "initialize", _token, _stakingDailyStipend, _marketplace) +// Solidity: function closeSession(bytes receiptEncoded, bytes signature) returns() +func (_SessionRouter *SessionRouterTransactor) CloseSession(opts *bind.TransactOpts, receiptEncoded []byte, signature []byte) (*types.Transaction, error) { + return _SessionRouter.contract.Transact(opts, "closeSession", receiptEncoded, signature) } -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. +// CloseSession is a paid mutator transaction binding the contract method 0x42f77a31. // -// Solidity: function initialize(address _token, address _stakingDailyStipend, address _marketplace) returns() -func (_SessionRouter *SessionRouterSession) Initialize(_token common.Address, _stakingDailyStipend common.Address, _marketplace common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.Initialize(&_SessionRouter.TransactOpts, _token, _stakingDailyStipend, _marketplace) +// Solidity: function closeSession(bytes receiptEncoded, bytes signature) returns() +func (_SessionRouter *SessionRouterSession) CloseSession(receiptEncoded []byte, signature []byte) (*types.Transaction, error) { + return _SessionRouter.Contract.CloseSession(&_SessionRouter.TransactOpts, receiptEncoded, signature) } -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. +// CloseSession is a paid mutator transaction binding the contract method 0x42f77a31. // -// Solidity: function initialize(address _token, address _stakingDailyStipend, address _marketplace) returns() -func (_SessionRouter *SessionRouterTransactorSession) Initialize(_token common.Address, _stakingDailyStipend common.Address, _marketplace common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.Initialize(&_SessionRouter.TransactOpts, _token, _stakingDailyStipend, _marketplace) +// Solidity: function closeSession(bytes receiptEncoded, bytes signature) returns() +func (_SessionRouter *SessionRouterTransactorSession) CloseSession(receiptEncoded []byte, signature []byte) (*types.Transaction, error) { + return _SessionRouter.Contract.CloseSession(&_SessionRouter.TransactOpts, receiptEncoded, signature) } -// OpenSession is a paid mutator transaction binding the contract method 0x48c00c90. +// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. // -// Solidity: function openSession(bytes32 bidId, uint256 budget) returns(bytes32 sessionId) -func (_SessionRouter *SessionRouterTransactor) OpenSession(opts *bind.TransactOpts, bidId [32]byte, budget *big.Int) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "openSession", bidId, budget) +// Solidity: function deleteHistory(bytes32 sessionId) returns() +func (_SessionRouter *SessionRouterTransactor) DeleteHistory(opts *bind.TransactOpts, sessionId [32]byte) (*types.Transaction, error) { + return _SessionRouter.contract.Transact(opts, "deleteHistory", sessionId) } -// OpenSession is a paid mutator transaction binding the contract method 0x48c00c90. +// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. // -// Solidity: function openSession(bytes32 bidId, uint256 budget) returns(bytes32 sessionId) -func (_SessionRouter *SessionRouterSession) OpenSession(bidId [32]byte, budget *big.Int) (*types.Transaction, error) { - return _SessionRouter.Contract.OpenSession(&_SessionRouter.TransactOpts, bidId, budget) +// Solidity: function deleteHistory(bytes32 sessionId) returns() +func (_SessionRouter *SessionRouterSession) DeleteHistory(sessionId [32]byte) (*types.Transaction, error) { + return _SessionRouter.Contract.DeleteHistory(&_SessionRouter.TransactOpts, sessionId) } -// OpenSession is a paid mutator transaction binding the contract method 0x48c00c90. +// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. // -// Solidity: function openSession(bytes32 bidId, uint256 budget) returns(bytes32 sessionId) -func (_SessionRouter *SessionRouterTransactorSession) OpenSession(bidId [32]byte, budget *big.Int) (*types.Transaction, error) { - return _SessionRouter.Contract.OpenSession(&_SessionRouter.TransactOpts, bidId, budget) +// Solidity: function deleteHistory(bytes32 sessionId) returns() +func (_SessionRouter *SessionRouterTransactorSession) DeleteHistory(sessionId [32]byte) (*types.Transaction, error) { + return _SessionRouter.Contract.DeleteHistory(&_SessionRouter.TransactOpts, sessionId) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// OpenSession is a paid mutator transaction binding the contract method 0x1f71815e. // -// Solidity: function renounceOwnership() returns() -func (_SessionRouter *SessionRouterTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "renounceOwnership") +// Solidity: function openSession(uint256 _stake, bytes providerApproval, bytes signature) returns(bytes32 sessionId) +func (_SessionRouter *SessionRouterTransactor) OpenSession(opts *bind.TransactOpts, _stake *big.Int, providerApproval []byte, signature []byte) (*types.Transaction, error) { + return _SessionRouter.contract.Transact(opts, "openSession", _stake, providerApproval, signature) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// OpenSession is a paid mutator transaction binding the contract method 0x1f71815e. // -// Solidity: function renounceOwnership() returns() -func (_SessionRouter *SessionRouterSession) RenounceOwnership() (*types.Transaction, error) { - return _SessionRouter.Contract.RenounceOwnership(&_SessionRouter.TransactOpts) +// Solidity: function openSession(uint256 _stake, bytes providerApproval, bytes signature) returns(bytes32 sessionId) +func (_SessionRouter *SessionRouterSession) OpenSession(_stake *big.Int, providerApproval []byte, signature []byte) (*types.Transaction, error) { + return _SessionRouter.Contract.OpenSession(&_SessionRouter.TransactOpts, _stake, providerApproval, signature) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// OpenSession is a paid mutator transaction binding the contract method 0x1f71815e. // -// Solidity: function renounceOwnership() returns() -func (_SessionRouter *SessionRouterTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _SessionRouter.Contract.RenounceOwnership(&_SessionRouter.TransactOpts) +// Solidity: function openSession(uint256 _stake, bytes providerApproval, bytes signature) returns(bytes32 sessionId) +func (_SessionRouter *SessionRouterTransactorSession) OpenSession(_stake *big.Int, providerApproval []byte, signature []byte) (*types.Transaction, error) { + return _SessionRouter.Contract.OpenSession(&_SessionRouter.TransactOpts, _stake, providerApproval, signature) } -// SetStakeDelay is a paid mutator transaction binding the contract method 0x3cadd8bb. +// SetPoolConfig is a paid mutator transaction binding the contract method 0x8b1af52a. // -// Solidity: function setStakeDelay(int256 delay) returns() -func (_SessionRouter *SessionRouterTransactor) SetStakeDelay(opts *bind.TransactOpts, delay *big.Int) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "setStakeDelay", delay) +// Solidity: function setPoolConfig((uint256,uint256,uint128,uint128) pool) returns() +func (_SessionRouter *SessionRouterTransactor) SetPoolConfig(opts *bind.TransactOpts, pool Pool) (*types.Transaction, error) { + return _SessionRouter.contract.Transact(opts, "setPoolConfig", pool) } -// SetStakeDelay is a paid mutator transaction binding the contract method 0x3cadd8bb. +// SetPoolConfig is a paid mutator transaction binding the contract method 0x8b1af52a. // -// Solidity: function setStakeDelay(int256 delay) returns() -func (_SessionRouter *SessionRouterSession) SetStakeDelay(delay *big.Int) (*types.Transaction, error) { - return _SessionRouter.Contract.SetStakeDelay(&_SessionRouter.TransactOpts, delay) +// Solidity: function setPoolConfig((uint256,uint256,uint128,uint128) pool) returns() +func (_SessionRouter *SessionRouterSession) SetPoolConfig(pool Pool) (*types.Transaction, error) { + return _SessionRouter.Contract.SetPoolConfig(&_SessionRouter.TransactOpts, pool) } -// SetStakeDelay is a paid mutator transaction binding the contract method 0x3cadd8bb. +// SetPoolConfig is a paid mutator transaction binding the contract method 0x8b1af52a. // -// Solidity: function setStakeDelay(int256 delay) returns() -func (_SessionRouter *SessionRouterTransactorSession) SetStakeDelay(delay *big.Int) (*types.Transaction, error) { - return _SessionRouter.Contract.SetStakeDelay(&_SessionRouter.TransactOpts, delay) +// Solidity: function setPoolConfig((uint256,uint256,uint128,uint128) pool) returns() +func (_SessionRouter *SessionRouterTransactorSession) SetPoolConfig(pool Pool) (*types.Transaction, error) { + return _SessionRouter.Contract.SetPoolConfig(&_SessionRouter.TransactOpts, pool) } -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// WithdrawUserStake is a paid mutator transaction binding the contract method 0xcd308cb1. // -// Solidity: function transferOwnership(address newOwner) returns() -func (_SessionRouter *SessionRouterTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "transferOwnership", newOwner) +// Solidity: function withdrawUserStake(uint256 amountToWithdraw, address to) returns() +func (_SessionRouter *SessionRouterTransactor) WithdrawUserStake(opts *bind.TransactOpts, amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { + return _SessionRouter.contract.Transact(opts, "withdrawUserStake", amountToWithdraw, to) } -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// WithdrawUserStake is a paid mutator transaction binding the contract method 0xcd308cb1. // -// Solidity: function transferOwnership(address newOwner) returns() -func (_SessionRouter *SessionRouterSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.TransferOwnership(&_SessionRouter.TransactOpts, newOwner) +// Solidity: function withdrawUserStake(uint256 amountToWithdraw, address to) returns() +func (_SessionRouter *SessionRouterSession) WithdrawUserStake(amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { + return _SessionRouter.Contract.WithdrawUserStake(&_SessionRouter.TransactOpts, amountToWithdraw, to) } -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// WithdrawUserStake is a paid mutator transaction binding the contract method 0xcd308cb1. // -// Solidity: function transferOwnership(address newOwner) returns() -func (_SessionRouter *SessionRouterTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.TransferOwnership(&_SessionRouter.TransactOpts, newOwner) +// Solidity: function withdrawUserStake(uint256 amountToWithdraw, address to) returns() +func (_SessionRouter *SessionRouterTransactorSession) WithdrawUserStake(amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { + return _SessionRouter.Contract.WithdrawUserStake(&_SessionRouter.TransactOpts, amountToWithdraw, to) } -// SessionRouterInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the SessionRouter contract. -type SessionRouterInitializedIterator struct { - Event *SessionRouterInitialized // Event containing the contract specifics and raw log +// SessionRouterSessionClosedIterator is returned from FilterSessionClosed and is used to iterate over the raw logs and unpacked data for SessionClosed events raised by the SessionRouter contract. +type SessionRouterSessionClosedIterator struct { + Event *SessionRouterSessionClosed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -913,7 +1012,7 @@ type SessionRouterInitializedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SessionRouterInitializedIterator) Next() bool { +func (it *SessionRouterSessionClosedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -922,7 +1021,7 @@ func (it *SessionRouterInitializedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SessionRouterInitialized) + it.Event = new(SessionRouterSessionClosed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -937,7 +1036,7 @@ func (it *SessionRouterInitializedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(SessionRouterInitialized) + it.Event = new(SessionRouterSessionClosed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -953,41 +1052,69 @@ func (it *SessionRouterInitializedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterInitializedIterator) Error() error { +func (it *SessionRouterSessionClosedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *SessionRouterInitializedIterator) Close() error { +func (it *SessionRouterSessionClosedIterator) Close() error { it.sub.Unsubscribe() return nil } -// SessionRouterInitialized represents a Initialized event raised by the SessionRouter contract. -type SessionRouterInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos +// SessionRouterSessionClosed represents a SessionClosed event raised by the SessionRouter contract. +type SessionRouterSessionClosed struct { + UserAddress common.Address + SessionId [32]byte + ProviderId common.Address + Raw types.Log // Blockchain specific contextual infos } -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// FilterSessionClosed is a free log retrieval operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. // -// Solidity: event Initialized(uint8 version) -func (_SessionRouter *SessionRouterFilterer) FilterInitialized(opts *bind.FilterOpts) (*SessionRouterInitializedIterator, error) { +// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) +func (_SessionRouter *SessionRouterFilterer) FilterSessionClosed(opts *bind.FilterOpts, userAddress []common.Address, sessionId [][32]byte, providerId []common.Address) (*SessionRouterSessionClosedIterator, error) { + + var userAddressRule []interface{} + for _, userAddressItem := range userAddress { + userAddressRule = append(userAddressRule, userAddressItem) + } + var sessionIdRule []interface{} + for _, sessionIdItem := range sessionId { + sessionIdRule = append(sessionIdRule, sessionIdItem) + } + var providerIdRule []interface{} + for _, providerIdItem := range providerId { + providerIdRule = append(providerIdRule, providerIdItem) + } - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "Initialized") + logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "SessionClosed", userAddressRule, sessionIdRule, providerIdRule) if err != nil { return nil, err } - return &SessionRouterInitializedIterator{contract: _SessionRouter.contract, event: "Initialized", logs: logs, sub: sub}, nil + return &SessionRouterSessionClosedIterator{contract: _SessionRouter.contract, event: "SessionClosed", logs: logs, sub: sub}, nil } -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// WatchSessionClosed is a free log subscription operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. // -// Solidity: event Initialized(uint8 version) -func (_SessionRouter *SessionRouterFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *SessionRouterInitialized) (event.Subscription, error) { +// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) +func (_SessionRouter *SessionRouterFilterer) WatchSessionClosed(opts *bind.WatchOpts, sink chan<- *SessionRouterSessionClosed, userAddress []common.Address, sessionId [][32]byte, providerId []common.Address) (event.Subscription, error) { + + var userAddressRule []interface{} + for _, userAddressItem := range userAddress { + userAddressRule = append(userAddressRule, userAddressItem) + } + var sessionIdRule []interface{} + for _, sessionIdItem := range sessionId { + sessionIdRule = append(sessionIdRule, sessionIdItem) + } + var providerIdRule []interface{} + for _, providerIdItem := range providerId { + providerIdRule = append(providerIdRule, providerIdItem) + } - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "Initialized") + logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "SessionClosed", userAddressRule, sessionIdRule, providerIdRule) if err != nil { return nil, err } @@ -997,8 +1124,8 @@ func (_SessionRouter *SessionRouterFilterer) WatchInitialized(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(SessionRouterInitialized) - if err := _SessionRouter.contract.UnpackLog(event, "Initialized", log); err != nil { + event := new(SessionRouterSessionClosed) + if err := _SessionRouter.contract.UnpackLog(event, "SessionClosed", log); err != nil { return err } event.Raw = log @@ -1019,21 +1146,21 @@ func (_SessionRouter *SessionRouterFilterer) WatchInitialized(opts *bind.WatchOp }), nil } -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// ParseSessionClosed is a log parse operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. // -// Solidity: event Initialized(uint8 version) -func (_SessionRouter *SessionRouterFilterer) ParseInitialized(log types.Log) (*SessionRouterInitialized, error) { - event := new(SessionRouterInitialized) - if err := _SessionRouter.contract.UnpackLog(event, "Initialized", log); err != nil { +// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) +func (_SessionRouter *SessionRouterFilterer) ParseSessionClosed(log types.Log) (*SessionRouterSessionClosed, error) { + event := new(SessionRouterSessionClosed) + if err := _SessionRouter.contract.UnpackLog(event, "SessionClosed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// SessionRouterOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the SessionRouter contract. -type SessionRouterOwnershipTransferredIterator struct { - Event *SessionRouterOwnershipTransferred // Event containing the contract specifics and raw log +// SessionRouterSessionOpenedIterator is returned from FilterSessionOpened and is used to iterate over the raw logs and unpacked data for SessionOpened events raised by the SessionRouter contract. +type SessionRouterSessionOpenedIterator struct { + Event *SessionRouterSessionOpened // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1047,7 +1174,7 @@ type SessionRouterOwnershipTransferredIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *SessionRouterOwnershipTransferredIterator) Next() bool { +func (it *SessionRouterSessionOpenedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1056,467 +1183,7 @@ func (it *SessionRouterOwnershipTransferredIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(SessionRouterOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterOwnershipTransferred represents a OwnershipTransferred event raised by the SessionRouter contract. -type SessionRouterOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_SessionRouter *SessionRouterFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*SessionRouterOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &SessionRouterOwnershipTransferredIterator{contract: _SessionRouter.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_SessionRouter *SessionRouterFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *SessionRouterOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterOwnershipTransferred) - if err := _SessionRouter.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_SessionRouter *SessionRouterFilterer) ParseOwnershipTransferred(log types.Log) (*SessionRouterOwnershipTransferred, error) { - event := new(SessionRouterOwnershipTransferred) - if err := _SessionRouter.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterProviderClaimedIterator is returned from FilterProviderClaimed and is used to iterate over the raw logs and unpacked data for ProviderClaimed events raised by the SessionRouter contract. -type SessionRouterProviderClaimedIterator struct { - Event *SessionRouterProviderClaimed // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterProviderClaimedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterProviderClaimed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterProviderClaimed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterProviderClaimedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterProviderClaimedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterProviderClaimed represents a ProviderClaimed event raised by the SessionRouter contract. -type SessionRouterProviderClaimed struct { - ProviderAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterProviderClaimed is a free log retrieval operation binding the contract event 0x1cd322e3d02eade120b8dceb43a6c1dee437af36e7acd81726c4b54adf5584c2. -// -// Solidity: event ProviderClaimed(address indexed providerAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) FilterProviderClaimed(opts *bind.FilterOpts, providerAddress []common.Address) (*SessionRouterProviderClaimedIterator, error) { - - var providerAddressRule []interface{} - for _, providerAddressItem := range providerAddress { - providerAddressRule = append(providerAddressRule, providerAddressItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "ProviderClaimed", providerAddressRule) - if err != nil { - return nil, err - } - return &SessionRouterProviderClaimedIterator{contract: _SessionRouter.contract, event: "ProviderClaimed", logs: logs, sub: sub}, nil -} - -// WatchProviderClaimed is a free log subscription operation binding the contract event 0x1cd322e3d02eade120b8dceb43a6c1dee437af36e7acd81726c4b54adf5584c2. -// -// Solidity: event ProviderClaimed(address indexed providerAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) WatchProviderClaimed(opts *bind.WatchOpts, sink chan<- *SessionRouterProviderClaimed, providerAddress []common.Address) (event.Subscription, error) { - - var providerAddressRule []interface{} - for _, providerAddressItem := range providerAddress { - providerAddressRule = append(providerAddressRule, providerAddressItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "ProviderClaimed", providerAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterProviderClaimed) - if err := _SessionRouter.contract.UnpackLog(event, "ProviderClaimed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseProviderClaimed is a log parse operation binding the contract event 0x1cd322e3d02eade120b8dceb43a6c1dee437af36e7acd81726c4b54adf5584c2. -// -// Solidity: event ProviderClaimed(address indexed providerAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) ParseProviderClaimed(log types.Log) (*SessionRouterProviderClaimed, error) { - event := new(SessionRouterProviderClaimed) - if err := _SessionRouter.contract.UnpackLog(event, "ProviderClaimed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterSessionClosedIterator is returned from FilterSessionClosed and is used to iterate over the raw logs and unpacked data for SessionClosed events raised by the SessionRouter contract. -type SessionRouterSessionClosedIterator struct { - Event *SessionRouterSessionClosed // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterSessionClosedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterSessionClosed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterSessionClosed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterSessionClosedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterSessionClosedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterSessionClosed represents a SessionClosed event raised by the SessionRouter contract. -type SessionRouterSessionClosed struct { - UserAddress common.Address - SessionId [32]byte - ProviderId common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSessionClosed is a free log retrieval operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. -// -// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) FilterSessionClosed(opts *bind.FilterOpts, userAddress []common.Address, sessionId [][32]byte, providerId []common.Address) (*SessionRouterSessionClosedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - var sessionIdRule []interface{} - for _, sessionIdItem := range sessionId { - sessionIdRule = append(sessionIdRule, sessionIdItem) - } - var providerIdRule []interface{} - for _, providerIdItem := range providerId { - providerIdRule = append(providerIdRule, providerIdItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "SessionClosed", userAddressRule, sessionIdRule, providerIdRule) - if err != nil { - return nil, err - } - return &SessionRouterSessionClosedIterator{contract: _SessionRouter.contract, event: "SessionClosed", logs: logs, sub: sub}, nil -} - -// WatchSessionClosed is a free log subscription operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. -// -// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) WatchSessionClosed(opts *bind.WatchOpts, sink chan<- *SessionRouterSessionClosed, userAddress []common.Address, sessionId [][32]byte, providerId []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - var sessionIdRule []interface{} - for _, sessionIdItem := range sessionId { - sessionIdRule = append(sessionIdRule, sessionIdItem) - } - var providerIdRule []interface{} - for _, providerIdItem := range providerId { - providerIdRule = append(providerIdRule, providerIdItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "SessionClosed", userAddressRule, sessionIdRule, providerIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterSessionClosed) - if err := _SessionRouter.contract.UnpackLog(event, "SessionClosed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseSessionClosed is a log parse operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. -// -// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) ParseSessionClosed(log types.Log) (*SessionRouterSessionClosed, error) { - event := new(SessionRouterSessionClosed) - if err := _SessionRouter.contract.UnpackLog(event, "SessionClosed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterSessionOpenedIterator is returned from FilterSessionOpened and is used to iterate over the raw logs and unpacked data for SessionOpened events raised by the SessionRouter contract. -type SessionRouterSessionOpenedIterator struct { - Event *SessionRouterSessionOpened // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterSessionOpenedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterSessionOpened) + it.Event = new(SessionRouterSessionOpened) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1652,293 +1319,3 @@ func (_SessionRouter *SessionRouterFilterer) ParseSessionOpened(log types.Log) ( event.Raw = log return event, nil } - -// SessionRouterStakedIterator is returned from FilterStaked and is used to iterate over the raw logs and unpacked data for Staked events raised by the SessionRouter contract. -type SessionRouterStakedIterator struct { - Event *SessionRouterStaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterStakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterStakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterStakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterStaked represents a Staked event raised by the SessionRouter contract. -type SessionRouterStaked struct { - UserAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterStaked is a free log retrieval operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) FilterStaked(opts *bind.FilterOpts, userAddress []common.Address) (*SessionRouterStakedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "Staked", userAddressRule) - if err != nil { - return nil, err - } - return &SessionRouterStakedIterator{contract: _SessionRouter.contract, event: "Staked", logs: logs, sub: sub}, nil -} - -// WatchStaked is a free log subscription operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) WatchStaked(opts *bind.WatchOpts, sink chan<- *SessionRouterStaked, userAddress []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "Staked", userAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterStaked) - if err := _SessionRouter.contract.UnpackLog(event, "Staked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseStaked is a log parse operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) ParseStaked(log types.Log) (*SessionRouterStaked, error) { - event := new(SessionRouterStaked) - if err := _SessionRouter.contract.UnpackLog(event, "Staked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterUnstakedIterator is returned from FilterUnstaked and is used to iterate over the raw logs and unpacked data for Unstaked events raised by the SessionRouter contract. -type SessionRouterUnstakedIterator struct { - Event *SessionRouterUnstaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterUnstakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterUnstakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterUnstakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterUnstaked represents a Unstaked event raised by the SessionRouter contract. -type SessionRouterUnstaked struct { - UserAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUnstaked is a free log retrieval operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) FilterUnstaked(opts *bind.FilterOpts, userAddress []common.Address) (*SessionRouterUnstakedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "Unstaked", userAddressRule) - if err != nil { - return nil, err - } - return &SessionRouterUnstakedIterator{contract: _SessionRouter.contract, event: "Unstaked", logs: logs, sub: sub}, nil -} - -// WatchUnstaked is a free log subscription operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) WatchUnstaked(opts *bind.WatchOpts, sink chan<- *SessionRouterUnstaked, userAddress []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "Unstaked", userAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterUnstaked) - if err := _SessionRouter.contract.UnpackLog(event, "Unstaked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUnstaked is a log parse operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) ParseUnstaked(log types.Log) (*SessionRouterUnstaked, error) { - event := new(SessionRouterUnstaked) - if err := _SessionRouter.contract.UnpackLog(event, "Unstaked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/proxy-router/contracts/stakingdailystipend/StakingDailyStipend.go b/proxy-router/contracts/stakingdailystipend/StakingDailyStipend.go deleted file mode 100644 index 08a3dbdf..00000000 --- a/proxy-router/contracts/stakingdailystipend/StakingDailyStipend.go +++ /dev/null @@ -1,1291 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package stakingdailystipend - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// StakingDailyStipendMetaData contains all meta data concerning the StakingDailyStipend contract. -var StakingDailyStipendMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"NotEnoughDailyStipend\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughStake\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSessionRouterOrOwner\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"}],\"name\":\"balanceOfDailyStipend\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getComputeBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"}],\"name\":\"getStakeOnHold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTodaysBudget\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"}],\"name\":\"getTodaysSpend\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tokenAccount\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"returnStipend\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sessionRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"todaysSpend\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"releaseAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferDailyStipend\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sendToAddr\",\"type\":\"address\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"}],\"name\":\"withdrawableStakeBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// StakingDailyStipendABI is the input ABI used to generate the binding from. -// Deprecated: Use StakingDailyStipendMetaData.ABI instead. -var StakingDailyStipendABI = StakingDailyStipendMetaData.ABI - -// StakingDailyStipend is an auto generated Go binding around an Ethereum contract. -type StakingDailyStipend struct { - StakingDailyStipendCaller // Read-only binding to the contract - StakingDailyStipendTransactor // Write-only binding to the contract - StakingDailyStipendFilterer // Log filterer for contract events -} - -// StakingDailyStipendCaller is an auto generated read-only Go binding around an Ethereum contract. -type StakingDailyStipendCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingDailyStipendTransactor is an auto generated write-only Go binding around an Ethereum contract. -type StakingDailyStipendTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingDailyStipendFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type StakingDailyStipendFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingDailyStipendSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type StakingDailyStipendSession struct { - Contract *StakingDailyStipend // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// StakingDailyStipendCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type StakingDailyStipendCallerSession struct { - Contract *StakingDailyStipendCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// StakingDailyStipendTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type StakingDailyStipendTransactorSession struct { - Contract *StakingDailyStipendTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// StakingDailyStipendRaw is an auto generated low-level Go binding around an Ethereum contract. -type StakingDailyStipendRaw struct { - Contract *StakingDailyStipend // Generic contract binding to access the raw methods on -} - -// StakingDailyStipendCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type StakingDailyStipendCallerRaw struct { - Contract *StakingDailyStipendCaller // Generic read-only contract binding to access the raw methods on -} - -// StakingDailyStipendTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type StakingDailyStipendTransactorRaw struct { - Contract *StakingDailyStipendTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewStakingDailyStipend creates a new instance of StakingDailyStipend, bound to a specific deployed contract. -func NewStakingDailyStipend(address common.Address, backend bind.ContractBackend) (*StakingDailyStipend, error) { - contract, err := bindStakingDailyStipend(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &StakingDailyStipend{StakingDailyStipendCaller: StakingDailyStipendCaller{contract: contract}, StakingDailyStipendTransactor: StakingDailyStipendTransactor{contract: contract}, StakingDailyStipendFilterer: StakingDailyStipendFilterer{contract: contract}}, nil -} - -// NewStakingDailyStipendCaller creates a new read-only instance of StakingDailyStipend, bound to a specific deployed contract. -func NewStakingDailyStipendCaller(address common.Address, caller bind.ContractCaller) (*StakingDailyStipendCaller, error) { - contract, err := bindStakingDailyStipend(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &StakingDailyStipendCaller{contract: contract}, nil -} - -// NewStakingDailyStipendTransactor creates a new write-only instance of StakingDailyStipend, bound to a specific deployed contract. -func NewStakingDailyStipendTransactor(address common.Address, transactor bind.ContractTransactor) (*StakingDailyStipendTransactor, error) { - contract, err := bindStakingDailyStipend(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &StakingDailyStipendTransactor{contract: contract}, nil -} - -// NewStakingDailyStipendFilterer creates a new log filterer instance of StakingDailyStipend, bound to a specific deployed contract. -func NewStakingDailyStipendFilterer(address common.Address, filterer bind.ContractFilterer) (*StakingDailyStipendFilterer, error) { - contract, err := bindStakingDailyStipend(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &StakingDailyStipendFilterer{contract: contract}, nil -} - -// bindStakingDailyStipend binds a generic wrapper to an already deployed contract. -func bindStakingDailyStipend(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := StakingDailyStipendMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_StakingDailyStipend *StakingDailyStipendRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StakingDailyStipend.Contract.StakingDailyStipendCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_StakingDailyStipend *StakingDailyStipendRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.StakingDailyStipendTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_StakingDailyStipend *StakingDailyStipendRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.StakingDailyStipendTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_StakingDailyStipend *StakingDailyStipendCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StakingDailyStipend.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_StakingDailyStipend *StakingDailyStipendTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_StakingDailyStipend *StakingDailyStipendTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.contract.Transact(opts, method, params...) -} - -// BalanceOfDailyStipend is a free data retrieval call binding the contract method 0xf0612b48. -// -// Solidity: function balanceOfDailyStipend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) BalanceOfDailyStipend(opts *bind.CallOpts, userAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "balanceOfDailyStipend", userAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// BalanceOfDailyStipend is a free data retrieval call binding the contract method 0xf0612b48. -// -// Solidity: function balanceOfDailyStipend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) BalanceOfDailyStipend(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.BalanceOfDailyStipend(&_StakingDailyStipend.CallOpts, userAddress) -} - -// BalanceOfDailyStipend is a free data retrieval call binding the contract method 0xf0612b48. -// -// Solidity: function balanceOfDailyStipend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) BalanceOfDailyStipend(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.BalanceOfDailyStipend(&_StakingDailyStipend.CallOpts, userAddress) -} - -// GetComputeBalance is a free data retrieval call binding the contract method 0x653cdf0c. -// -// Solidity: function getComputeBalance() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) GetComputeBalance(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "getComputeBalance") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetComputeBalance is a free data retrieval call binding the contract method 0x653cdf0c. -// -// Solidity: function getComputeBalance() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) GetComputeBalance() (*big.Int, error) { - return _StakingDailyStipend.Contract.GetComputeBalance(&_StakingDailyStipend.CallOpts) -} - -// GetComputeBalance is a free data retrieval call binding the contract method 0x653cdf0c. -// -// Solidity: function getComputeBalance() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) GetComputeBalance() (*big.Int, error) { - return _StakingDailyStipend.Contract.GetComputeBalance(&_StakingDailyStipend.CallOpts) -} - -// GetStakeOnHold is a free data retrieval call binding the contract method 0x9bc65da5. -// -// Solidity: function getStakeOnHold(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) GetStakeOnHold(opts *bind.CallOpts, userAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "getStakeOnHold", userAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetStakeOnHold is a free data retrieval call binding the contract method 0x9bc65da5. -// -// Solidity: function getStakeOnHold(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) GetStakeOnHold(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.GetStakeOnHold(&_StakingDailyStipend.CallOpts, userAddress) -} - -// GetStakeOnHold is a free data retrieval call binding the contract method 0x9bc65da5. -// -// Solidity: function getStakeOnHold(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) GetStakeOnHold(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.GetStakeOnHold(&_StakingDailyStipend.CallOpts, userAddress) -} - -// GetTodaysBudget is a free data retrieval call binding the contract method 0xa7e7f9a9. -// -// Solidity: function getTodaysBudget() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) GetTodaysBudget(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "getTodaysBudget") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetTodaysBudget is a free data retrieval call binding the contract method 0xa7e7f9a9. -// -// Solidity: function getTodaysBudget() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) GetTodaysBudget() (*big.Int, error) { - return _StakingDailyStipend.Contract.GetTodaysBudget(&_StakingDailyStipend.CallOpts) -} - -// GetTodaysBudget is a free data retrieval call binding the contract method 0xa7e7f9a9. -// -// Solidity: function getTodaysBudget() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) GetTodaysBudget() (*big.Int, error) { - return _StakingDailyStipend.Contract.GetTodaysBudget(&_StakingDailyStipend.CallOpts) -} - -// GetTodaysSpend is a free data retrieval call binding the contract method 0x02fc4ec8. -// -// Solidity: function getTodaysSpend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) GetTodaysSpend(opts *bind.CallOpts, userAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "getTodaysSpend", userAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetTodaysSpend is a free data retrieval call binding the contract method 0x02fc4ec8. -// -// Solidity: function getTodaysSpend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) GetTodaysSpend(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.GetTodaysSpend(&_StakingDailyStipend.CallOpts, userAddress) -} - -// GetTodaysSpend is a free data retrieval call binding the contract method 0x02fc4ec8. -// -// Solidity: function getTodaysSpend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) GetTodaysSpend(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.GetTodaysSpend(&_StakingDailyStipend.CallOpts, userAddress) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendSession) Owner() (common.Address, error) { - return _StakingDailyStipend.Contract.Owner(&_StakingDailyStipend.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) Owner() (common.Address, error) { - return _StakingDailyStipend.Contract.Owner(&_StakingDailyStipend.CallOpts) -} - -// SessionRouter is a free data retrieval call binding the contract method 0x707ba08a. -// -// Solidity: function sessionRouter() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCaller) SessionRouter(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "sessionRouter") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// SessionRouter is a free data retrieval call binding the contract method 0x707ba08a. -// -// Solidity: function sessionRouter() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendSession) SessionRouter() (common.Address, error) { - return _StakingDailyStipend.Contract.SessionRouter(&_StakingDailyStipend.CallOpts) -} - -// SessionRouter is a free data retrieval call binding the contract method 0x707ba08a. -// -// Solidity: function sessionRouter() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) SessionRouter() (common.Address, error) { - return _StakingDailyStipend.Contract.SessionRouter(&_StakingDailyStipend.CallOpts) -} - -// TodaysSpend is a free data retrieval call binding the contract method 0x9b6e4a06. -// -// Solidity: function todaysSpend(address ) view returns(uint256 amount, uint256 releaseAt) -func (_StakingDailyStipend *StakingDailyStipendCaller) TodaysSpend(opts *bind.CallOpts, arg0 common.Address) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "todaysSpend", arg0) - - outstruct := new(struct { - Amount *big.Int - ReleaseAt *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Amount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.ReleaseAt = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// TodaysSpend is a free data retrieval call binding the contract method 0x9b6e4a06. -// -// Solidity: function todaysSpend(address ) view returns(uint256 amount, uint256 releaseAt) -func (_StakingDailyStipend *StakingDailyStipendSession) TodaysSpend(arg0 common.Address) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - return _StakingDailyStipend.Contract.TodaysSpend(&_StakingDailyStipend.CallOpts, arg0) -} - -// TodaysSpend is a free data retrieval call binding the contract method 0x9b6e4a06. -// -// Solidity: function todaysSpend(address ) view returns(uint256 amount, uint256 releaseAt) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) TodaysSpend(arg0 common.Address) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - return _StakingDailyStipend.Contract.TodaysSpend(&_StakingDailyStipend.CallOpts, arg0) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendSession) Token() (common.Address, error) { - return _StakingDailyStipend.Contract.Token(&_StakingDailyStipend.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) Token() (common.Address, error) { - return _StakingDailyStipend.Contract.Token(&_StakingDailyStipend.CallOpts) -} - -// TokenAccount is a free data retrieval call binding the contract method 0x30ddebcb. -// -// Solidity: function tokenAccount() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCaller) TokenAccount(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "tokenAccount") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// TokenAccount is a free data retrieval call binding the contract method 0x30ddebcb. -// -// Solidity: function tokenAccount() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendSession) TokenAccount() (common.Address, error) { - return _StakingDailyStipend.Contract.TokenAccount(&_StakingDailyStipend.CallOpts) -} - -// TokenAccount is a free data retrieval call binding the contract method 0x30ddebcb. -// -// Solidity: function tokenAccount() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) TokenAccount() (common.Address, error) { - return _StakingDailyStipend.Contract.TokenAccount(&_StakingDailyStipend.CallOpts) -} - -// UserStake is a free data retrieval call binding the contract method 0x68e5585d. -// -// Solidity: function userStake(address ) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) UserStake(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "userStake", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// UserStake is a free data retrieval call binding the contract method 0x68e5585d. -// -// Solidity: function userStake(address ) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) UserStake(arg0 common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.UserStake(&_StakingDailyStipend.CallOpts, arg0) -} - -// UserStake is a free data retrieval call binding the contract method 0x68e5585d. -// -// Solidity: function userStake(address ) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) UserStake(arg0 common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.UserStake(&_StakingDailyStipend.CallOpts, arg0) -} - -// WithdrawableStakeBalance is a free data retrieval call binding the contract method 0x7594e4d9. -// -// Solidity: function withdrawableStakeBalance(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) WithdrawableStakeBalance(opts *bind.CallOpts, userAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "withdrawableStakeBalance", userAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// WithdrawableStakeBalance is a free data retrieval call binding the contract method 0x7594e4d9. -// -// Solidity: function withdrawableStakeBalance(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) WithdrawableStakeBalance(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.WithdrawableStakeBalance(&_StakingDailyStipend.CallOpts, userAddress) -} - -// WithdrawableStakeBalance is a free data retrieval call binding the contract method 0x7594e4d9. -// -// Solidity: function withdrawableStakeBalance(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) WithdrawableStakeBalance(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.WithdrawableStakeBalance(&_StakingDailyStipend.CallOpts, userAddress) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _token, address _tokenAccount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) Initialize(opts *bind.TransactOpts, _token common.Address, _tokenAccount common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "initialize", _token, _tokenAccount) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _token, address _tokenAccount) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) Initialize(_token common.Address, _tokenAccount common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Initialize(&_StakingDailyStipend.TransactOpts, _token, _tokenAccount) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _token, address _tokenAccount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) Initialize(_token common.Address, _tokenAccount common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Initialize(&_StakingDailyStipend.TransactOpts, _token, _tokenAccount) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StakingDailyStipend *StakingDailyStipendSession) RenounceOwnership() (*types.Transaction, error) { - return _StakingDailyStipend.Contract.RenounceOwnership(&_StakingDailyStipend.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _StakingDailyStipend.Contract.RenounceOwnership(&_StakingDailyStipend.TransactOpts) -} - -// ReturnStipend is a paid mutator transaction binding the contract method 0x93c87377. -// -// Solidity: function returnStipend(address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) ReturnStipend(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "returnStipend", to, amount) -} - -// ReturnStipend is a paid mutator transaction binding the contract method 0x93c87377. -// -// Solidity: function returnStipend(address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) ReturnStipend(to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.ReturnStipend(&_StakingDailyStipend.TransactOpts, to, amount) -} - -// ReturnStipend is a paid mutator transaction binding the contract method 0x93c87377. -// -// Solidity: function returnStipend(address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) ReturnStipend(to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.ReturnStipend(&_StakingDailyStipend.TransactOpts, to, amount) -} - -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. -// -// Solidity: function stake(address addr, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) Stake(opts *bind.TransactOpts, addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "stake", addr, amount) -} - -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. -// -// Solidity: function stake(address addr, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) Stake(addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Stake(&_StakingDailyStipend.TransactOpts, addr, amount) -} - -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. -// -// Solidity: function stake(address addr, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) Stake(addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Stake(&_StakingDailyStipend.TransactOpts, addr, amount) -} - -// TransferDailyStipend is a paid mutator transaction binding the contract method 0x93a7483a. -// -// Solidity: function transferDailyStipend(address from, address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) TransferDailyStipend(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "transferDailyStipend", from, to, amount) -} - -// TransferDailyStipend is a paid mutator transaction binding the contract method 0x93a7483a. -// -// Solidity: function transferDailyStipend(address from, address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) TransferDailyStipend(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.TransferDailyStipend(&_StakingDailyStipend.TransactOpts, from, to, amount) -} - -// TransferDailyStipend is a paid mutator transaction binding the contract method 0x93a7483a. -// -// Solidity: function transferDailyStipend(address from, address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) TransferDailyStipend(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.TransferDailyStipend(&_StakingDailyStipend.TransactOpts, from, to, amount) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.TransferOwnership(&_StakingDailyStipend.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.TransferOwnership(&_StakingDailyStipend.TransactOpts, newOwner) -} - -// Unstake is a paid mutator transaction binding the contract method 0x926e31d6. -// -// Solidity: function unstake(address addr, uint256 amount, address sendToAddr) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) Unstake(opts *bind.TransactOpts, addr common.Address, amount *big.Int, sendToAddr common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "unstake", addr, amount, sendToAddr) -} - -// Unstake is a paid mutator transaction binding the contract method 0x926e31d6. -// -// Solidity: function unstake(address addr, uint256 amount, address sendToAddr) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) Unstake(addr common.Address, amount *big.Int, sendToAddr common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Unstake(&_StakingDailyStipend.TransactOpts, addr, amount, sendToAddr) -} - -// Unstake is a paid mutator transaction binding the contract method 0x926e31d6. -// -// Solidity: function unstake(address addr, uint256 amount, address sendToAddr) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) Unstake(addr common.Address, amount *big.Int, sendToAddr common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Unstake(&_StakingDailyStipend.TransactOpts, addr, amount, sendToAddr) -} - -// StakingDailyStipendInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the StakingDailyStipend contract. -type StakingDailyStipendInitializedIterator struct { - Event *StakingDailyStipendInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingDailyStipendInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingDailyStipendInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingDailyStipendInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingDailyStipendInitialized represents a Initialized event raised by the StakingDailyStipend contract. -type StakingDailyStipendInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StakingDailyStipend *StakingDailyStipendFilterer) FilterInitialized(opts *bind.FilterOpts) (*StakingDailyStipendInitializedIterator, error) { - - logs, sub, err := _StakingDailyStipend.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &StakingDailyStipendInitializedIterator{contract: _StakingDailyStipend.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StakingDailyStipend *StakingDailyStipendFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *StakingDailyStipendInitialized) (event.Subscription, error) { - - logs, sub, err := _StakingDailyStipend.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingDailyStipendInitialized) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StakingDailyStipend *StakingDailyStipendFilterer) ParseInitialized(log types.Log) (*StakingDailyStipendInitialized, error) { - event := new(StakingDailyStipendInitialized) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingDailyStipendOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the StakingDailyStipend contract. -type StakingDailyStipendOwnershipTransferredIterator struct { - Event *StakingDailyStipendOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingDailyStipendOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingDailyStipendOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingDailyStipendOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingDailyStipendOwnershipTransferred represents a OwnershipTransferred event raised by the StakingDailyStipend contract. -type StakingDailyStipendOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StakingDailyStipend *StakingDailyStipendFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*StakingDailyStipendOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _StakingDailyStipend.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &StakingDailyStipendOwnershipTransferredIterator{contract: _StakingDailyStipend.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StakingDailyStipend *StakingDailyStipendFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *StakingDailyStipendOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _StakingDailyStipend.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingDailyStipendOwnershipTransferred) - if err := _StakingDailyStipend.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StakingDailyStipend *StakingDailyStipendFilterer) ParseOwnershipTransferred(log types.Log) (*StakingDailyStipendOwnershipTransferred, error) { - event := new(StakingDailyStipendOwnershipTransferred) - if err := _StakingDailyStipend.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingDailyStipendStakedIterator is returned from FilterStaked and is used to iterate over the raw logs and unpacked data for Staked events raised by the StakingDailyStipend contract. -type StakingDailyStipendStakedIterator struct { - Event *StakingDailyStipendStaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingDailyStipendStakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingDailyStipendStakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingDailyStipendStakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingDailyStipendStaked represents a Staked event raised by the StakingDailyStipend contract. -type StakingDailyStipendStaked struct { - UserAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterStaked is a free log retrieval operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) FilterStaked(opts *bind.FilterOpts, userAddress []common.Address) (*StakingDailyStipendStakedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _StakingDailyStipend.contract.FilterLogs(opts, "Staked", userAddressRule) - if err != nil { - return nil, err - } - return &StakingDailyStipendStakedIterator{contract: _StakingDailyStipend.contract, event: "Staked", logs: logs, sub: sub}, nil -} - -// WatchStaked is a free log subscription operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) WatchStaked(opts *bind.WatchOpts, sink chan<- *StakingDailyStipendStaked, userAddress []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _StakingDailyStipend.contract.WatchLogs(opts, "Staked", userAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingDailyStipendStaked) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Staked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseStaked is a log parse operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) ParseStaked(log types.Log) (*StakingDailyStipendStaked, error) { - event := new(StakingDailyStipendStaked) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Staked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingDailyStipendUnstakedIterator is returned from FilterUnstaked and is used to iterate over the raw logs and unpacked data for Unstaked events raised by the StakingDailyStipend contract. -type StakingDailyStipendUnstakedIterator struct { - Event *StakingDailyStipendUnstaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingDailyStipendUnstakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingDailyStipendUnstakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingDailyStipendUnstakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingDailyStipendUnstaked represents a Unstaked event raised by the StakingDailyStipend contract. -type StakingDailyStipendUnstaked struct { - UserAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUnstaked is a free log retrieval operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) FilterUnstaked(opts *bind.FilterOpts, userAddress []common.Address) (*StakingDailyStipendUnstakedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _StakingDailyStipend.contract.FilterLogs(opts, "Unstaked", userAddressRule) - if err != nil { - return nil, err - } - return &StakingDailyStipendUnstakedIterator{contract: _StakingDailyStipend.contract, event: "Unstaked", logs: logs, sub: sub}, nil -} - -// WatchUnstaked is a free log subscription operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) WatchUnstaked(opts *bind.WatchOpts, sink chan<- *StakingDailyStipendUnstaked, userAddress []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _StakingDailyStipend.contract.WatchLogs(opts, "Unstaked", userAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingDailyStipendUnstaked) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Unstaked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUnstaked is a log parse operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) ParseUnstaked(log types.Log) (*StakingDailyStipendUnstaked, error) { - event := new(StakingDailyStipendUnstaked) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Unstaked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/proxy-router/go.mod b/proxy-router/go.mod index 3338e8e6..85548a1b 100644 --- a/proxy-router/go.mod +++ b/proxy-router/go.mod @@ -1,17 +1,18 @@ module github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal -go 1.19 +go 1.20 require ( github.com/Lumerin-protocol/contracts-go v0.2.0 github.com/ethereum/go-ethereum v1.12.0 + github.com/gin-contrib/cors v1.7.2 github.com/gin-gonic/gin v1.9.1 - github.com/go-playground/validator/v10 v10.14.0 + github.com/go-playground/validator/v10 v10.20.0 github.com/joho/godotenv v1.5.1 github.com/omeid/uconfig v0.5.0 github.com/sashabaranov/go-openai v1.21.0 github.com/shirou/gopsutil/v3 v3.23.11 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 go.uber.org/multierr v1.6.0 go.uber.org/zap v1.24.0 golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 @@ -21,13 +22,16 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect - github.com/bytedance/sonic v1.9.1 // indirect + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-playground/locales v0.14.1 // indirect @@ -38,15 +42,15 @@ require ( github.com/gorilla/websocket v1.4.2 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.2.4 // indirect - github.com/leodido/go-urn v1.2.4 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pelletier/go-toml/v2 v2.2.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect @@ -54,15 +58,15 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.11 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/arch v0.3.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/arch v0.7.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.34.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/proxy-router/go.sum b/proxy-router/go.sum index 99bb5a55..711bb5e8 100644 --- a/proxy-router/go.sum +++ b/proxy-router/go.sum @@ -12,11 +12,19 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= @@ -38,8 +46,12 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= +github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw= +github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= @@ -55,6 +67,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= @@ -89,6 +103,9 @@ github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7y github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -97,11 +114,15 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= @@ -118,6 +139,8 @@ github.com/omeid/uconfig v0.5.0 h1:jNI7QgdGvoazDm95yoFNSg7NL+TcjIScTOLn5nk4f4E= github.com/omeid/uconfig v0.5.0/go.mod h1:a+bL4SpC/ZYQjRQGMkyT8Wk3z8XXGBqwtbNRnCukLP0= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg= +github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -146,6 +169,7 @@ github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobt github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -155,6 +179,8 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= @@ -165,6 +191,8 @@ github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2 github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= @@ -180,12 +208,18 @@ go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc= +golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ= golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -193,12 +227,15 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= @@ -206,6 +243,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -215,4 +254,5 @@ gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHN gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/proxy-router/internal/aiengine/ai_engine.go b/proxy-router/internal/aiengine/ai_engine.go index f37a39f7..be7a0e07 100644 --- a/proxy-router/internal/aiengine/ai_engine.go +++ b/proxy-router/internal/aiengine/ai_engine.go @@ -1,9 +1,13 @@ package aiengine import ( + "bufio" + "bytes" "context" + "encoding/json" "net/http" "os" + "strings" "fmt" @@ -11,23 +15,95 @@ import ( ) type AiEngine struct { + client *api.Client } func NewAiEngine() *AiEngine { - return &AiEngine{} + return &AiEngine{ + + client: api.NewClientWithConfig(api.ClientConfig{ + BaseURL: os.Getenv("OPENAI_BASE_URL"), + APIType: api.APITypeOpenAI, + HTTPClient: &http.Client{}, + }), + } +} + +type CompletionCallback func(completion api.ChatCompletionStreamResponse) error + +func requestChatCompletionStream(ctx context.Context, request *api.ChatCompletionRequest, callback CompletionCallback) (*api.ChatCompletionStreamResponse, error) { + requestBody, err := json.Marshal(request) + if err != nil { + return nil, fmt.Errorf("failed to encode request: %v", err) + } + + req, err := http.NewRequestWithContext(ctx, "POST", os.Getenv("OPENAI_BASE_URL")+"/chat/completions", bytes.NewReader(requestBody)) + if err != nil { + return nil, fmt.Errorf("failed to create request: %v", err) + } + + apiKey := os.Getenv("OPENAI_API_KEY") + if apiKey != "" { + req.Header.Set("Authorization", "Bearer "+apiKey) + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Accept", "text/event-stream") + req.Header.Set("Connection", "keep-alive") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + return nil, fmt.Errorf("failed to send request: %v", err) + } + defer resp.Body.Close() + + scanner := bufio.NewScanner(resp.Body) + for scanner.Scan() { + line := scanner.Text() + // Handle the completion of the stream + // if line == "data: [DONE]" { + // fmt.Println("Stream completed.") + + // completion := &api.ChatCompletionStreamResponse{ + // Choices: []api.ChatCompletionStreamChoice{ + // { + // Delta: api.ChatCompletionStreamChoiceDelta{ + // Content: "[DONE]", + // }, + // }, + // }, + // } + + // return completion, nil + // } + + if strings.HasPrefix(line, "data: ") { + data := line[6:] // Skip the "data: " prefix + // fmt.Println("data: ", data) + var completion api.ChatCompletionStreamResponse + if err := json.Unmarshal([]byte(data), &completion); err != nil { + fmt.Printf("Error decoding response: %v\n", err) + continue + } + // Call the callback function with the unmarshalled completion + callback(completion) + } + } + + if err := scanner.Err(); err != nil { + return nil, fmt.Errorf("error reading stream: %v", err) + } + + return nil, err } func (aiEngine *AiEngine) Prompt(ctx context.Context, req interface{}) (*api.ChatCompletionResponse, error) { request := req.(*api.ChatCompletionRequest) client := api.NewClientWithConfig(api.ClientConfig{ - BaseURL: os.Getenv("OPENAI_BASE_URL"), - APIType: api.APITypeOpenAI, + BaseURL: os.Getenv("OPENAI_BASE_URL"), + APIType: api.APITypeOpenAI, HTTPClient: &http.Client{}, }) - - fmt.Printf("client: %+v\r\n", *client) - fmt.Printf("base url: %+v\r\n", os.Getenv("OPENAI_BASE_URL")) - fmt.Printf("request: %+v\r\n", *request) response, err := client.CreateChatCompletion( ctx, @@ -41,3 +117,20 @@ func (aiEngine *AiEngine) Prompt(ctx context.Context, req interface{}) (*api.Cha return &response, nil } +type ChunkSubmit func(*api.ChatCompletionStreamResponse) error + +func (aiEngine *AiEngine) PromptStream(ctx context.Context, req interface{}, chunkSubmitCallback interface{}) (*api.ChatCompletionStreamResponse, error) { + request := req.(*api.ChatCompletionRequest) + chunkCallback := chunkSubmitCallback.(func(*api.ChatCompletionStreamResponse) error) + + resp, err := requestChatCompletionStream(ctx, request, func(completion api.ChatCompletionStreamResponse) error { + return chunkCallback(&completion) + }) + + if err != nil { + fmt.Printf("ChatCompletion error: %v\n", err) + return nil, err + } + + return resp, err +} diff --git a/proxy-router/internal/aiengine/ai_engine_test.go b/proxy-router/internal/aiengine/ai_engine_test.go new file mode 100644 index 00000000..10a46678 --- /dev/null +++ b/proxy-router/internal/aiengine/ai_engine_test.go @@ -0,0 +1,96 @@ +package aiengine + +import ( + "context" + "errors" + "fmt" + "os" + "strings" + "testing" + + api "github.com/sashabaranov/go-openai" +) + +func AiEngine_Prompt(t *testing.T) { + os.Setenv("OPENAI_BASE_URL", "http://localhost:11434/v1") + + aiEngine := NewAiEngine() + ctx := context.Background() + req := &api.ChatCompletionRequest{ + Model: "llama2", + MaxTokens: 100, + Messages: []api.ChatCompletionMessage{ + { + Role: "user", + Content: "Hello, I am a test user"}, + }, // This is a test + } + resp, err := aiEngine.Prompt(ctx, req) + if err != nil { + t.Errorf("Prompt error: %v", err) + } + fmt.Printf("Prompt response: %+v\n", resp) +} + +func TestAiEngine_PromptStream(t *testing.T) { + os.Setenv("OPENAI_BASE_URL", "http://localhost:11434/v1") + + ctx := context.Background() + req := &api.ChatCompletionRequest{ + Model: "llama2", + MaxTokens: 100, + Stream: true, + Messages: []api.ChatCompletionMessage{ + { + Role: "user", + Content: "Hello, I am a test user"}, + }, // This is a test + } + + choices := make([]api.ChatCompletionStreamChoice, 0) + + resp, err := requestChatCompletionStream(ctx, req, func(response api.ChatCompletionStreamResponse) error { + choices = append(choices, response.Choices...) + + if response.Choices[0].Delta.Content == "" { + return errors.New("empty response") + } + + return nil + }) + + if err != nil { + t.Errorf("error: %v", err) + fmt.Println("error: ", err) + } + + if resp == nil { + t.Errorf("invalid nil response") + } + + if resp.Choices[0].Delta.Content != "[DONE]" { + t.Errorf("invalid end of stream response: %s", resp.Choices[0].Delta.Content) + } + + content := concatenateDeltaContent(choices) + + if content == "" { + t.Errorf("content is empty") + } + + if content == "" { + t.Errorf("content is empty") + } + + if strings.Contains(content, "Hello there! ") { + t.Errorf("content is invalid") + } +} + +func concatenateDeltaContent(choices []api.ChatCompletionStreamChoice) string { + var concatenatedContent string + for _, choice := range choices { + concatenatedContent += choice.Delta.Content + } + return concatenatedContent +} diff --git a/proxy-router/internal/apibus/api_bus.go b/proxy-router/internal/apibus/api_bus.go index 8b215c99..897a2075 100644 --- a/proxy-router/internal/apibus/api_bus.go +++ b/proxy-router/internal/apibus/api_bus.go @@ -11,7 +11,7 @@ import ( "github.com/gin-gonic/gin" ) -//TODO: split implementations into separate client layer +// TODO: split implementations into separate client layer type ApiBus struct { rpcProxy *rpcproxy.RpcProxy aiEngine *aiengine.AiEngine @@ -43,7 +43,7 @@ func (apiBus *ApiBus) InitiateSession(ctx *gin.Context) (int, interface{}) { return apiBus.proxyRouterApi.InitiateSession(ctx) } -func (apiBus *ApiBus) SendPrompt(ctx *gin.Context) (int, interface{}) { +func (apiBus *ApiBus) SendPrompt(ctx *gin.Context) (bool, int, interface{}) { return apiBus.proxyRouterApi.SendPrompt(ctx) } @@ -52,11 +52,28 @@ func (apiBus *ApiBus) Prompt(ctx context.Context, req interface{}) (interface{}, return apiBus.aiEngine.Prompt(ctx, req) } +// AiEngine +func (apiBus *ApiBus) PromptStream(ctx context.Context, req interface{}, flush interface{}) (interface{}, error) { + return apiBus.aiEngine.PromptStream(ctx, req, flush) +} + // RpcProxy func (apiBus *ApiBus) GetLatestBlock(ctx context.Context) (uint64, error) { return apiBus.rpcProxy.GetLatestBlock(ctx) } +func (apiBus *ApiBus) GetBalance(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.GetBalance(ctx) +} + +func (apiBus *ApiBus) GetAllowance(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.GetAllowance(ctx) +} + +func (apiBus *ApiBus) Approve(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.Approve(ctx) +} + func (apiBus *ApiBus) GetAllProviders(ctx context.Context) (int, gin.H) { return apiBus.rpcProxy.GetAllProviders(ctx) } @@ -65,6 +82,10 @@ func (apiBus *ApiBus) GetAllModels(ctx context.Context) (int, gin.H) { return apiBus.rpcProxy.GetAllModels(ctx) } +func (apiBus *ApiBus) GetTransactions(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.GetTransactions(ctx) +} + func (apiBus *ApiBus) GetBidsByProvider(ctx context.Context, providerAddr string, offset *big.Int, limit uint8) (int, gin.H) { addr := common.HexToAddress(providerAddr) return apiBus.rpcProxy.GetBidsByProvider(ctx, addr, offset, limit) @@ -73,3 +94,39 @@ func (apiBus *ApiBus) GetBidsByProvider(ctx context.Context, providerAddr string func (apiBus *ApiBus) GetBidsByModelAgent(ctx context.Context, modelAgentId [32]byte, offset *big.Int, limit uint8) (int, gin.H) { return apiBus.rpcProxy.GetBidsByModelAgent(ctx, modelAgentId, offset, limit) } + +func (apiBus *ApiBus) SendEth(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.SendEth(ctx) +} + +func (apiBus *ApiBus) SendMor(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.SendMor(ctx) +} + +func (apiBus *ApiBus) OpenSession(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.OpenSession(ctx) +} + +func (apiBus *ApiBus) CloseSession(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.CloseSession(ctx) +} + +func (apiBus *ApiBus) ClaimProviderBalance(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.ClaimProviderBalance(ctx) +} + +func (apiBus *ApiBus) GetProviderClaimableBalance(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.GetProviderClaimableBalance(ctx) +} + +func (apiBus *ApiBus) GetTodaysBudget(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.GetTodaysBudget(ctx) +} + +func (apiBus *ApiBus) GetTokenSupply(ctx *gin.Context) (int, gin.H) { + return apiBus.rpcProxy.GetTokenSupply(ctx) +} + +func (apiBus *ApiBus) GetSessions(ctx *gin.Context, offset *big.Int, limit uint8) (int, gin.H) { + return apiBus.rpcProxy.GetSessions(ctx, offset, limit) +} diff --git a/proxy-router/internal/config/config.go b/proxy-router/internal/config/config.go index 08801ec1..a241066b 100644 --- a/proxy-router/internal/config/config.go +++ b/proxy-router/internal/config/config.go @@ -14,14 +14,14 @@ type Config struct { Blockchain struct { EthNodeAddress string `env:"ETH_NODE_ADDRESS" flag:"eth-node-address" validate:"required,url"` EthLegacyTx bool `env:"ETH_NODE_LEGACY_TX" flag:"eth-node-legacy-tx" desc:"use it to disable EIP-1559 transactions"` + ExplorerApiUrl string `env:"EXPLORER_API_URL" flag:"explorer-api-url" validate:"required,url"` } Environment string `env:"ENVIRONMENT" flag:"environment"` Marketplace struct { - ProviderRegistryAddress string `env:"PROVIDER_REGISTRY_ADDRESS" flag:"provider-registry-address" validate:"required_if=Disable false,omitempty,eth_addr"` - ModelRegistryAddress string `env:"MODEL_REGISTRY_ADDRESS" flag:"model-registry-address" validate:"required_if=Disable false,omitempty,eth_addr"` - MarketplaceAddress string `env:"MARKETPLACE_ADDRESS" flag:"marketplace-address" validate:"required_if=Disable false,omitempty,eth_addr"` - Mnemonic string `env:"CONTRACT_MNEMONIC" flag:"contract-mnemonic" validate:"required_without=WalletPrivateKey|required_if=Disable false"` - WalletPrivateKey string `env:"WALLET_PRIVATE_KEY" flag:"wallet-private-key" validate:"required_without=Mnemonic|required_if=Disable false"` + DiamondContractAddress string `env:"DIAMOND_CONTRACT_ADDRESS" flag:"diamond-address" validate:"required_if=Disable false,omitempty,eth_addr"` + MorTokenAddress string `env:"MOR_TOKEN_ADDRESS" flag:"mor-token-address" validate:"required_if=Disable false,omitempty,eth_addr"` + Mnemonic string `env:"CONTRACT_MNEMONIC" flag:"contract-mnemonic" validate:"required_without=WalletPrivateKey|required_if=Disable false"` + WalletPrivateKey string `env:"WALLET_PRIVATE_KEY" flag:"wallet-private-key" validate:"required_without=Mnemonic|required_if=Disable false"` } Log struct { Color bool `env:"LOG_COLOR" flag:"log-color"` diff --git a/proxy-router/internal/constants.go b/proxy-router/internal/constants.go index fc6c5e93..93d321a8 100644 --- a/proxy-router/internal/constants.go +++ b/proxy-router/internal/constants.go @@ -1,4 +1,9 @@ package constants -const HTTP_STATUS_OK = 200 -const HTTP_STATUS_BAD_REQUEST = 400 +import "net/http" + +const ( + HTTP_STATUS_BAD_REQUEST = http.StatusBadRequest + HTTP_STATUS_OK = http.StatusOK + HTTP_INTERNAL_SERVER_ERROR = http.StatusInternalServerError +) diff --git a/proxy-router/internal/handlers/httphandlers/http.go b/proxy-router/internal/handlers/httphandlers/http.go index ef7ee590..3b75a1f5 100644 --- a/proxy-router/internal/handlers/httphandlers/http.go +++ b/proxy-router/internal/handlers/httphandlers/http.go @@ -1,7 +1,7 @@ package httphandlers import ( - "encoding/hex" + "encoding/json" "errors" "fmt" "io" @@ -9,8 +9,9 @@ import ( "net/http" "net/http/pprof" - constants "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/apibus" + "github.com/ethereum/go-ethereum/common" + "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" openai "github.com/sashabaranov/go-openai" @@ -27,11 +28,15 @@ func NewHTTPHandler(apiBus *apibus.ApiBus) *gin.Engine { gin.SetMode(gin.ReleaseMode) r := gin.New() + r.Use(cors.New(cors.Config{ + AllowOrigins: []string{"*"}, + })) + r.GET("/healthcheck", (func(ctx *gin.Context) { - ctx.JSON(SUCCESS_STATUS, apiBus.HealthCheck(ctx)) + ctx.JSON(http.StatusOK, apiBus.HealthCheck(ctx)) })) r.GET("/config", (func(ctx *gin.Context) { - ctx.JSON(SUCCESS_STATUS, apiBus.GetConfig(ctx)) + ctx.JSON(http.StatusOK, apiBus.GetConfig(ctx)) })) r.GET("/files", (func(ctx *gin.Context) { status, files := apiBus.GetFiles(ctx) @@ -51,14 +56,39 @@ func NewHTTPHandler(apiBus *apibus.ApiBus) *gin.Engine { return } - response, err := apiBus.Prompt(ctx, req) - fmt.Println("apibus prompt response: ", response) + req.Stream = ctx.GetHeader("Accept") == "application/json" + + var response interface{} + + if req.Stream { + response, err = apiBus.PromptStream(ctx, req, func(response *openai.ChatCompletionStreamResponse) error { + + marshalledResponse, err := json.Marshal(response) + + if err != nil { + return err + } + + ctx.Writer.Header().Set("Content-Type", "text/event-stream") + _, err = ctx.Writer.Write([]byte(fmt.Sprintf("data: %s\n\n", marshalledResponse))) + ctx.Writer.Flush() + + if err != nil { + return err + } + + return nil + }) + } else { + response, err = apiBus.Prompt(ctx, req) + } + if err != nil { - ctx.AbortWithError(ERROR_STATUS, err) + ctx.AbortWithError(http.StatusInternalServerError, err) return } - ctx.JSON(SUCCESS_STATUS, response) + ctx.JSON(http.StatusOK, response) })) r.POST("/proxy/sessions/initiate", (func(ctx *gin.Context) { @@ -67,7 +97,21 @@ func NewHTTPHandler(apiBus *apibus.ApiBus) *gin.Engine { })) r.POST("/proxy/sessions/:id/prompt", (func(ctx *gin.Context) { - status, response := apiBus.SendPrompt(ctx) + ok, status, response := apiBus.SendPrompt(ctx) + if !ok { + ctx.JSON(status, response) + return + } + return + })) + + r.GET("/proxy/sessions/:id/providerClaimableBalance", (func(ctx *gin.Context) { + status, response := apiBus.GetProviderClaimableBalance(ctx) + ctx.JSON(status, response) + })) + + r.POST("/proxy/sessions/:id/providerClaim", (func(ctx *gin.Context) { + status, response := apiBus.ClaimProviderBalance(ctx) ctx.JSON(status, response) })) @@ -76,6 +120,16 @@ func NewHTTPHandler(apiBus *apibus.ApiBus) *gin.Engine { ctx.JSON(status, providers) })) + r.POST("/blockchain/send/eth", (func(ctx *gin.Context) { + status, response := apiBus.SendEth(ctx) + ctx.JSON(status, response) + })) + + r.POST("/blockchain/send/mor", (func(ctx *gin.Context) { + status, response := apiBus.SendMor(ctx) + ctx.JSON(status, response) + })) + r.GET("/blockchain/providers/:id/bids", (func(ctx *gin.Context) { providerId := ctx.Param("id") offset, limit := getOffsetLimit(ctx) @@ -100,15 +154,59 @@ func NewHTTPHandler(apiBus *apibus.ApiBus) *gin.Engine { return } - id, err := hex.DecodeString(modelAgentId) - if err != nil { - ctx.JSON(constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "invalid model agent id"}) + id := common.FromHex(modelAgentId) + + status, models := apiBus.GetBidsByModelAgent(ctx, ([32]byte)(id), offset, limit) + ctx.JSON(status, models) + })) + + r.GET("/blockchain/balance", (func(ctx *gin.Context) { + status, balance := apiBus.GetBalance(ctx) + ctx.JSON(status, balance) + })) + + r.GET("/blockchain/transactions", (func(ctx *gin.Context) { + status, transactions := apiBus.GetTransactions(ctx) + ctx.JSON(status, transactions) + })) + + r.GET("/blockchain/allowance", (func(ctx *gin.Context) { + status, balance := apiBus.GetAllowance(ctx) + ctx.JSON(status, balance) + })) + + r.POST("/blockchain/approve", (func(ctx *gin.Context) { + status, response := apiBus.Approve(ctx) + ctx.JSON(status, response) + })) + + r.POST("/blockchain/sessions", (func(ctx *gin.Context) { + status, response := apiBus.OpenSession(ctx) + ctx.JSON(status, response) + })) + + r.GET("/blockchain/sessions", (func(ctx *gin.Context) { + offset, limit := getOffsetLimit(ctx) + if offset == nil { return } - var idBytes [32]byte - copy(idBytes[:], id) - status, models := apiBus.GetBidsByModelAgent(ctx, idBytes, offset, limit) - ctx.JSON(status, models) + status, response := apiBus.GetSessions(ctx, offset, limit) + ctx.JSON(status, response) + })) + + r.GET("/blockchain/sessions/budget", (func(ctx *gin.Context) { + status, response := apiBus.GetTodaysBudget(ctx) + ctx.JSON(status, response) + })) + + r.GET("/blockchain/token/supply", (func(ctx *gin.Context) { + status, response := apiBus.GetTokenSupply(ctx) + ctx.JSON(status, response) + })) + + r.POST("/blockchain/sessions/:id/close", (func(ctx *gin.Context) { + status, response := apiBus.CloseSession(ctx) + ctx.JSON(status, response) })) r.Any("/debug/pprof/*action", gin.WrapF(pprof.Index)) @@ -128,19 +226,19 @@ func getOffsetLimit(ctx *gin.Context) (*big.Int, uint8) { } limitStr := ctx.Query("limit") if limitStr == "" { - limitStr = "10" + limitStr = "100" } offset, ok := new(big.Int).SetString(offsetStr, 10) if !ok { - ctx.JSON(constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "invalid offset"}) + ctx.JSON(http.StatusBadRequest, gin.H{"error": "invalid offset"}) return nil, 0 } var limit uint8 _, err := fmt.Sscanf(limitStr, "%d", &limit) if err != nil { - ctx.JSON(constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "invalid limit"}) + ctx.JSON(http.StatusBadRequest, gin.H{"error": "invalid limit"}) return nil, 0 } return offset, limit diff --git a/proxy-router/internal/handlers/tcphandlers/mor_rpc_handler.go b/proxy-router/internal/handlers/tcphandlers/mor_rpc_handler.go index 31f465f2..8aef4713 100644 --- a/proxy-router/internal/handlers/tcphandlers/mor_rpc_handler.go +++ b/proxy-router/internal/handlers/tcphandlers/mor_rpc_handler.go @@ -1,30 +1,39 @@ package tcphandlers import ( + "context" + "encoding/json" "fmt" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/apibus" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/interfaces" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/morrpc" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/storages" + "github.com/sashabaranov/go-openai" ) type MorRpcHandler struct { - privateKeyHex string - publicKeyHex string - address string - morRpc *morrpc.MorRpc + privateKeyHex string + publicKeyHex string + address string + morRpc *morrpc.MorRpc + sessionStorage *storages.SessionStorage + apibus *apibus.ApiBus } -func NewMorRpcHandler(privateKeyHex string, publicKeyHex string, address string, morRpc *morrpc.MorRpc) *MorRpcHandler { +func NewMorRpcHandler(privateKeyHex string, publicKeyHex string, address string, morRpc *morrpc.MorRpc, sessionStorage *storages.SessionStorage, apiBus *apibus.ApiBus) *MorRpcHandler { return &MorRpcHandler{ - privateKeyHex: privateKeyHex, - address: address, - publicKeyHex: publicKeyHex, - morRpc: morRpc, + privateKeyHex: privateKeyHex, + address: address, + publicKeyHex: publicKeyHex, + morRpc: morRpc, + sessionStorage: sessionStorage, + apibus: apiBus, } } -func (m *MorRpcHandler) Handle(msg morrpc.RpcMessage, sourceLog interfaces.ILogger) (*morrpc.RpcResponse, error) { +func (m *MorRpcHandler) Handle(ctx context.Context, msg morrpc.RpcMessage, sourceLog interfaces.ILogger, sendCallback func(*morrpc.RpcResponse) error) error { switch msg.Method { case "session.request": requestId := fmt.Sprintf("%v", msg.ID) @@ -33,36 +42,45 @@ func (m *MorRpcHandler) Handle(msg morrpc.RpcMessage, sourceLog interfaces.ILogg userPubKey := fmt.Sprintf("%v", msg.Params["key"]) spend := fmt.Sprintf("%v", msg.Params["spend"]) timeStamp := fmt.Sprintf("%v", msg.Params["timestamp"]) + bidId := fmt.Sprintf("%v", msg.Params["bidid"]) sourceLog.Debugf("Received session request from %s, timestamp: %s", userAddr, timeStamp) isValid := m.morRpc.VerifySignature(msg.Params, signature, userPubKey, sourceLog) if !isValid { err := fmt.Errorf("invalid signature") sourceLog.Error(err) - return nil, err + return err } hasCapacity := true // check if there is capacity if !hasCapacity && spend != "" { err := fmt.Errorf("no capacity") sourceLog.Error(err) - return nil, err + return err } // Send response response, err := m.morRpc.InitiateSessionResponse( m.publicKeyHex, userAddr, + bidId, m.privateKeyHex, requestId, ) if err != nil { err := lib.WrapError(fmt.Errorf("failed to create response"), err) sourceLog.Error(err) - return nil, err + return err } - return response, nil + user := storages.User{ + Addr: userAddr, + PubKey: userPubKey, + } + + m.sessionStorage.AddUser(&user) + sendCallback(response) + return nil case "session.prompt": requestId := fmt.Sprintf("%v", msg.ID) signature := fmt.Sprintf("%v", msg.Params["signature"]) @@ -70,32 +88,72 @@ func (m *MorRpcHandler) Handle(msg morrpc.RpcMessage, sourceLog interfaces.ILogg prompt := fmt.Sprintf("%v", msg.Params["message"]) timeStamp := fmt.Sprintf("%v", msg.Params["timestamp"]) sourceLog.Debugf("Received prompt from session %s, timestamp: %s", sessionId, timeStamp) - - userPubKey := "mocked_pub_key" // get user public key from storage for sessionId + session, ok := m.sessionStorage.GetSession(sessionId) + if !ok { + err := fmt.Errorf("session not found") + sourceLog.Error(err) + return err + } + user, ok := m.sessionStorage.GetUser(session.UserAddr) + if !ok { + err := fmt.Errorf("user not found") + sourceLog.Error(err) + return err + } + userPubKey := user.PubKey isValid := m.morRpc.VerifySignature(msg.Params, signature, userPubKey, sourceLog) if !isValid { err := fmt.Errorf("invalid signature") sourceLog.Error(err) - return nil, err + return err } - // Send response - response, err := m.morRpc.SessionPromptResponse( - fmt.Sprintf("Prompt: %v, my resp: %v", prompt, "ok"), - m.privateKeyHex, - requestId, - ) + var req *openai.ChatCompletionRequest + + err := json.Unmarshal([]byte(prompt), &req) if err != nil { - err := lib.WrapError(fmt.Errorf("failed to create response"), err) + err := lib.WrapError(fmt.Errorf("failed to unmarshal prompt"), err) + sourceLog.Error(err) + return err + } + + _, err = m.apibus.PromptStream(ctx, req, func(response *openai.ChatCompletionStreamResponse) error { + marshalledResponse, err := json.Marshal(response) + if err != nil { + return err + } + + encryptedResponse, err := lib.EncryptString(string(marshalledResponse), userPubKey) + if err != nil { + return err + } + + // Send response + r, err := m.morRpc.SessionPromptResponse( + encryptedResponse, + m.privateKeyHex, + requestId, + ) + if err != nil { + err := lib.WrapError(fmt.Errorf("failed to create response"), err) + sourceLog.Error(err) + return err + } + sendCallback(r) + return nil + }) + + if err != nil { + err := lib.WrapError(fmt.Errorf("failed to prompt"), err) sourceLog.Error(err) - return nil, err + return err } - return response, nil + return nil default: err := fmt.Errorf("unknown method: %s", msg.Method) sourceLog.Error(err) - return nil, err + return err } - return nil, nil + return nil } diff --git a/proxy-router/internal/handlers/tcphandlers/tcp.go b/proxy-router/internal/handlers/tcphandlers/tcp.go index 41e2e4d6..b7a07b48 100644 --- a/proxy-router/internal/handlers/tcphandlers/tcp.go +++ b/proxy-router/internal/handlers/tcphandlers/tcp.go @@ -4,6 +4,7 @@ import ( "bufio" "context" "encoding/json" + "fmt" "net" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/interfaces" @@ -31,17 +32,18 @@ func NewTCPHandler( return } - resp, err := morRpcHandler.Handle(*msg, sourceLog) - if err != nil { - sourceLog.Error("Error handling message", err) - return - } - if resp != nil { + err = morRpcHandler.Handle(ctx, *msg, sourceLog, func(resp *morrpc.RpcResponse) error { _, err := sendMsg(conn, resp) if err != nil { - sourceLog.Error("Error sending response", err) - return + sourceLog.Error("Error sending message", err) + return err } + fmt.Println("sent message") + return err + }) + if err != nil { + sourceLog.Error("Error handling message", err) + return } } } diff --git a/proxy-router/internal/lib/eth.go b/proxy-router/internal/lib/eth.go new file mode 100644 index 00000000..2632351c --- /dev/null +++ b/proxy-router/internal/lib/eth.go @@ -0,0 +1,48 @@ +package lib + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/crypto" +) + +type AbiParameter struct { + Type string +} + +func EncodeAbiParameters(abiParams []AbiParameter, params []interface{}) ([]byte, error) { + // Construct the ABI arguments + arguments := make(abi.Arguments, len(abiParams)) + for i, param := range abiParams { + argType, err := abi.NewType(param.Type, "", nil) + if err != nil { + return nil, err + } + arguments[i] = abi.Argument{Type: argType} + } + + // Pack the parameters into a byte array + return arguments.Pack(params...) +} + +func SignEthMessage(msg []byte, privateKeyHex string) ([]byte, error) { + privateKey, err := crypto.HexToECDSA(privateKeyHex) + if err != nil { + return nil, err + } + hash := crypto.Keccak256Hash(msg) + + prefixStr := fmt.Sprintf("\x19Ethereum Signed Message:\n%d", len(hash.Bytes())) + message := append([]byte(prefixStr), hash.Bytes()...) + resultHash := crypto.Keccak256Hash(message) + + signature, err := crypto.Sign(resultHash.Bytes(), privateKey) + if err != nil { + return nil, err + } + + // https://github.com/ethereum/go-ethereum/blob/44a50c9f96386f44a8682d51cf7500044f6cbaea/internal/ethapi/api.go#L580 + signature[64] += 27 // Transform V from 0/1 to 27/28 + return signature, nil +} diff --git a/proxy-router/internal/lib/ethclient.go b/proxy-router/internal/lib/ethclient.go new file mode 100644 index 00000000..639be655 --- /dev/null +++ b/proxy-router/internal/lib/ethclient.go @@ -0,0 +1,80 @@ +package lib + +import ( + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" +) + +type EVMError struct { + Abi abi.Error + Cause error + Args interface{} +} + +func (e EVMError) Error() string { + idBytes := e.Abi.ID.Bytes() + if len(idBytes) > 4 { + idBytes = idBytes[:4] + } + return "EVM error: " + e.Abi.Sig + " " + common.BytesToHash(idBytes).Hex() +} + +// TryConvertGethError attempts to convert geth error to an EVMError, otherwise just returns original error +func TryConvertGethError(err error, contractMeta *bind.MetaData) error { + evmErr, ok := ConvertGethError(err, contractMeta) + if !ok { + return err + } + return evmErr +} + +// ConvertGethError converts a geth error to an EVMError with exposed error signature and arguments +func ConvertGethError(err error, contractMeta *bind.MetaData) (*EVMError, bool) { + errData, ok := ExtractGETHErrorData(err) + if !ok { + return nil, false + } + + abiError, args, ok := CastErrorData(errData, contractMeta) + if !ok { + return nil, false + } + + return &EVMError{ + Abi: abiError, + Args: args, + Cause: err, + }, true +} + +// ExtractGETHErrorData extracts the error data from an unexproted geth error +func ExtractGETHErrorData(err error) ([]byte, bool) { + asErr, ok := err.(interface{ ErrorData() interface{} }) + if !ok { + return nil, false + } + errDataHex, ok := asErr.ErrorData().(string) + if !ok { + return nil, false + } + errDataBytes := common.FromHex(errDataHex) + if len(errDataBytes) < 4 { + return nil, false + } + return errDataBytes, true +} + +// CastErrorData casts the error data to the appropriate error type +func CastErrorData(errData []byte, contractMetadata *bind.MetaData) (abi.Error, interface{}, bool) { + abiData, err := contractMetadata.GetAbi() + if err == nil { + for _, abiError := range abiData.Errors { + args, err := abiError.Unpack(errData) + if err == nil { + return abiError, args, true + } + } + } + return abi.Error{}, nil, false +} diff --git a/proxy-router/internal/lib/string.go b/proxy-router/internal/lib/string.go index 6c0f44e7..d77d787f 100644 --- a/proxy-router/internal/lib/string.go +++ b/proxy-router/internal/lib/string.go @@ -1,6 +1,7 @@ package lib import ( + "encoding/hex" "fmt" ) @@ -20,3 +21,7 @@ func StrShortConf(str string, prefix, suffix int) string { } return str } + +func BytesToString(b []byte) string { + return "0x" + hex.EncodeToString(b) +} diff --git a/proxy-router/internal/morrpc/mor_rpc.go b/proxy-router/internal/morrpc/mor_rpc.go index 7a7c3eb6..38779ea2 100644 --- a/proxy-router/internal/morrpc/mor_rpc.go +++ b/proxy-router/internal/morrpc/mor_rpc.go @@ -4,9 +4,12 @@ import ( "encoding/hex" "encoding/json" "fmt" + "math/big" "time" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/interfaces" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" ) @@ -45,6 +48,11 @@ type ReqObject struct { Toks uint `json:"toks"` } +var approvalAbi = []lib.AbiParameter{ + {Type: "bytes32"}, + {Type: "uint128"}, +} + type MorRpc struct{} func NewMorRpc() *MorRpc { @@ -53,12 +61,25 @@ func NewMorRpc() *MorRpc { // Provider Node Communication -func (m *MorRpc) InitiateSessionResponse(providerPubKey string, userAddr string, providerPrivateKeyHex string, requestId string) (*RpcResponse, error) { +func (m *MorRpc) InitiateSessionResponse(providerPubKey string, userAddr string, bidId string, providerPrivateKeyHex string, requestId string) (*RpcResponse, error) { timestamp := m.generateTimestamp() + + bidIdBytes := common.FromHex(bidId) + approval, err := lib.EncodeAbiParameters(approvalAbi, []interface{}{[32]byte(bidIdBytes), big.NewInt(timestamp)}) + if err != nil { + return &RpcResponse{}, err + } + approvalSig, err := lib.SignEthMessage(approval, providerPrivateKeyHex) + if err != nil { + return &RpcResponse{}, err + } + params := map[string]interface{}{ - "message": providerPubKey, - "user": userAddr, - "timestamp": timestamp, + "message": providerPubKey, + "approval": hex.EncodeToString(approval), + "approvalSig": hex.EncodeToString(approvalSig), + "user": userAddr, + "timestamp": timestamp, } signature, err := m.generateSignature(params, providerPrivateKeyHex) @@ -163,7 +184,7 @@ func (m *MorRpc) generateReport(sessionID string, start uint, end uint, prompts // User Node Communication -func (m *MorRpc) InitiateSessionRequest(user string, provider string, userPubKey string, spend float64, userPrivateKeyHex string, requestId string) (*RpcMessage, error) { +func (m *MorRpc) InitiateSessionRequest(user string, provider string, userPubKey string, spend float64, bidId string, userPrivateKeyHex string, requestId string) (*RpcMessage, error) { method := "session.request" timestamp := m.generateTimestamp() params := map[string]interface{}{ @@ -172,6 +193,7 @@ func (m *MorRpc) InitiateSessionRequest(user string, provider string, userPubKey "provider": provider, "key": userPubKey, "spend": fmt.Sprintf("%f", spend), + "bidid": bidId, } signature, err := m.generateSignature(params, userPrivateKeyHex) @@ -186,11 +208,16 @@ func (m *MorRpc) InitiateSessionRequest(user string, provider string, userPubKey }, nil } -func (m *MorRpc) SessionPromptRequest(sessionID string, prompt string, providerPubKey string, userPrivateKeyHex string, requestId string) (*RpcMessage, error) { +func (m *MorRpc) SessionPromptRequest(sessionID string, prompt interface{}, providerPubKey string, userPrivateKeyHex string, requestId string) (*RpcMessage, error) { method := "session.prompt" timestamp := m.generateTimestamp() + + promptStr, err := json.Marshal(prompt) + if err != nil { + return &RpcMessage{}, err + } params := map[string]interface{}{ - "message": prompt, + "message": string(promptStr), "sessionid": sessionID, "timestamp": timestamp, } diff --git a/proxy-router/internal/proxyapi/proxy_router_api.go b/proxy-router/internal/proxyapi/proxy_router_api.go index d9503b0c..25ff11a1 100644 --- a/proxy-router/internal/proxyapi/proxy_router_api.go +++ b/proxy-router/internal/proxyapi/proxy_router_api.go @@ -16,6 +16,7 @@ import ( "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/interfaces" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/morrpc" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/storages" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/system" "github.com/gin-gonic/gin" ) @@ -32,28 +33,30 @@ type ConfigResponse struct { } type ProxyRouterApi struct { - sysConfig *system.SystemConfigurator - publicUrl *url.URL - pubKey string - privateKey string - config Sanitizable - derivedConfig *config.DerivedConfig - appStartTime time.Time - logStorage *lib.Collection[*interfaces.LogStorage] - log interfaces.ILogger + sysConfig *system.SystemConfigurator + publicUrl *url.URL + pubKey string + privateKey string + config Sanitizable + derivedConfig *config.DerivedConfig + appStartTime time.Time + logStorage *lib.Collection[*interfaces.LogStorage] + sessionStorage *storages.SessionStorage + log interfaces.ILogger } -func NewProxyRouterApi(sysConfig *system.SystemConfigurator, publicUrl *url.URL, pubKey string, privateKey string, config Sanitizable, derivedConfig *config.DerivedConfig, appStartTime time.Time, logStorage *lib.Collection[*interfaces.LogStorage], log interfaces.ILogger) *ProxyRouterApi { +func NewProxyRouterApi(sysConfig *system.SystemConfigurator, publicUrl *url.URL, pubKey string, privateKey string, config Sanitizable, derivedConfig *config.DerivedConfig, appStartTime time.Time, logStorage *lib.Collection[*interfaces.LogStorage], sessionStorage *storages.SessionStorage, log interfaces.ILogger) *ProxyRouterApi { return &ProxyRouterApi{ - sysConfig: sysConfig, - publicUrl: publicUrl, - pubKey: pubKey, - privateKey: privateKey, - config: config, - derivedConfig: derivedConfig, - appStartTime: appStartTime, - logStorage: logStorage, - log: log, + sysConfig: sysConfig, + publicUrl: publicUrl, + pubKey: pubKey, + privateKey: privateKey, + config: config, + derivedConfig: derivedConfig, + appStartTime: appStartTime, + logStorage: logStorage, + sessionStorage: sessionStorage, + log: log, } } @@ -100,50 +103,28 @@ func (p *ProxyRouterApi) InitiateSession(ctx *gin.Context) (int, gin.H) { return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "providerUrl is required"} } + bidId, ok := reqPayload["bidId"].(string) + if !ok { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "bidId is required"} + } + requestID := "1" - initiateSessionRequest, err := morrpc.NewMorRpc().InitiateSessionRequest(user, provider, p.pubKey, spend, p.privateKey, requestID) + initiateSessionRequest, err := morrpc.NewMorRpc().InitiateSessionRequest(user, provider, p.pubKey, spend, bidId, p.privateKey, requestID) if err != nil { err = lib.WrapError(fmt.Errorf("failed to create initiate session request"), err) p.log.Errorf("%s", err) return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } - conn, err := net.Dial("tcp", providerUrl) - if err != nil { - err = lib.WrapError(fmt.Errorf("failed to connect to provider"), err) - p.log.Errorf("%s", err) - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} - } - defer conn.Close() - - msgJSON, err := json.Marshal(initiateSessionRequest) - if err != nil { - err = lib.WrapError(fmt.Errorf("failed to marshal initiate session request"), err) - p.log.Errorf("%s", err) - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + msg, code, ginErr := p.rpcRequest(providerUrl, initiateSessionRequest) + if ginErr != nil { + return code, ginErr } - conn.Write([]byte(msgJSON)) - // read response - reader := bufio.NewReader(conn) - d := json.NewDecoder(reader) - var msg *morrpc.RpcResponse - err = d.Decode(&msg) - if err != nil { - err = lib.WrapError(fmt.Errorf("failed to decode response"), err) - p.log.Errorf("%s", err) - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} - } - - signature := fmt.Sprintf("%v", msg.Result["signature"]) providerPubKey := fmt.Sprintf("%v", msg.Result["message"]) - p.log.Debugf("Signature: %s, Provider Pub Key: %s", signature, providerPubKey) - - isValidSignature := morrpc.NewMorRpc().VerifySignature(msg.Result, signature, providerPubKey, p.log) - p.log.Debugf("Is valid signature: %t", isValidSignature) - if !isValidSignature { - err = fmt.Errorf("invalid signature from provider") + if !p.validateMsgSignature(msg, providerPubKey) { + err = fmt.Errorf("Received invalid signature from provider") p.log.Errorf("%s", err) return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } @@ -153,30 +134,30 @@ func (p *ProxyRouterApi) InitiateSession(ctx *gin.Context) (int, gin.H) { } } -func (p *ProxyRouterApi) SendPrompt(ctx *gin.Context) (int, gin.H) { +func (p *ProxyRouterApi) SendPrompt(ctx *gin.Context) (bool, int, gin.H) { var reqPayload map[string]interface{} if err := ctx.ShouldBindJSON(&reqPayload); err != nil { - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } providerPublicKey, ok := reqPayload["providerPublicKey"].(string) if !ok { - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "providerPublicKey is required"} + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "providerPublicKey is required"} } - prompt, ok := reqPayload["prompt"].(string) + prompt, ok := reqPayload["prompt"] if !ok { - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "prompt is required"} + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "prompt is required"} } sessionId := ctx.Param("id") if sessionId == "" { - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "sessionId is required"} + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "sessionId is required"} } providerUrl, ok := reqPayload["providerUrl"].(string) if !ok { - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "providerUrl is required"} + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "providerUrl is required"} } requestID := "1" @@ -184,22 +165,54 @@ func (p *ProxyRouterApi) SendPrompt(ctx *gin.Context) (int, gin.H) { if err != nil { err = lib.WrapError(fmt.Errorf("failed to create session prompt request"), err) p.log.Errorf("%s", err) - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } - conn, err := net.Dial("tcp", providerUrl) + return p.rpcRequestStream(ctx, providerUrl, promptRequest, providerPublicKey) +} + +func (p *ProxyRouterApi) GetFiles(ctx *gin.Context) (int, gin.H) { + files, err := p.sysConfig.GetFileDescriptors(ctx, os.Getpid()) + if err != nil { + return 500, gin.H{"error": err.Error()} + } + + systemCfg, err := p.sysConfig.GetConfig() + if err != nil { + fmt.Fprintf(ctx.Writer, "failed to get system config: %s\n", err) + } else { + json, err := json.Marshal(systemCfg) + if err != nil { + fmt.Fprintf(ctx.Writer, "failed to marshal system config: %s\n", err) + } else { + fmt.Fprintf(ctx.Writer, "system config: %s\n", json) + } + } + fmt.Fprintf(ctx.Writer, "\n") + + err = writeFiles(ctx.Writer, files) + if err != nil { + p.log.Errorf("failed to write files: %s", err) + _ = ctx.Error(err) + ctx.Abort() + } + return constants.HTTP_STATUS_OK, gin.H{} +} + +func (p *ProxyRouterApi) rpcRequest(url string, rpcMessage *morrpc.RpcMessage) (*morrpc.RpcResponse, int, gin.H) { + conn, err := net.Dial("tcp", url) if err != nil { err = lib.WrapError(fmt.Errorf("failed to connect to provider"), err) p.log.Errorf("%s", err) - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + return nil, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } defer conn.Close() - msgJSON, err := json.Marshal(promptRequest) + msgJSON, err := json.Marshal(rpcMessage) if err != nil { - err = lib.WrapError(fmt.Errorf("failed to marshal initiate session request"), err) + err = lib.WrapError(fmt.Errorf("failed to marshal request"), err) p.log.Errorf("%s", err) - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + return nil, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } conn.Write([]byte(msgJSON)) @@ -211,53 +224,100 @@ func (p *ProxyRouterApi) SendPrompt(ctx *gin.Context) (int, gin.H) { if err != nil { err = lib.WrapError(fmt.Errorf("failed to decode response"), err) p.log.Errorf("%s", err) - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + return nil, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } + return msg, 0, nil +} - signature := fmt.Sprintf("%v", msg.Result["signature"]) - providerPubKey := "mock_provider_pub_key" // get provider public key from storage for sessionId - p.log.Debugf("Signature: %s, Provider Pub Key: %s", signature, providerPubKey) - - isValidSignature := morrpc.NewMorRpc().VerifySignature(msg.Result, signature, providerPubKey, p.log) - p.log.Debugf("Is valid signature: %t", isValidSignature) - if !isValidSignature { - err = fmt.Errorf("invalid signature from provider") +func (p *ProxyRouterApi) rpcRequestStream(ctx *gin.Context, url string, rpcMessage *morrpc.RpcMessage, providerPublicKey string) (bool, int, gin.H) { + conn, err := net.Dial("tcp", url) + if err != nil { + err = lib.WrapError(fmt.Errorf("failed to connect to provider"), err) p.log.Errorf("%s", err) - return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} - } - - return constants.HTTP_STATUS_OK, gin.H{ - "response": msg, + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } -} + defer conn.Close() -func (p *ProxyRouterApi) GetFiles(ctx *gin.Context) (int, gin.H) { - files, err := p.sysConfig.GetFileDescriptors(ctx, os.Getpid()) + msgJSON, err := json.Marshal(rpcMessage) if err != nil { - return 500, gin.H{"error": err.Error()} + err = lib.WrapError(fmt.Errorf("failed to marshal request"), err) + p.log.Errorf("%s", err) + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } + conn.Write([]byte(msgJSON)) - systemCfg, err := p.sysConfig.GetConfig() - if err != nil { - fmt.Fprintf(ctx.Writer, "failed to get system config: %s\n", err) - } else { - json, err := json.Marshal(systemCfg) + // read response + reader := bufio.NewReader(conn) + d := json.NewDecoder(reader) + ctx.Writer.Header().Set("Content-Type", "text/event-stream") + + for { + var msg *morrpc.RpcResponse + err = d.Decode(&msg) + p.log.Debugf("Received stream msg:", msg) if err != nil { - fmt.Fprintf(ctx.Writer, "failed to marshal system config: %s\n", err) - } else { - fmt.Fprintf(ctx.Writer, "system config: %s\n", json) + err = lib.WrapError(fmt.Errorf("failed to decode response"), err) + p.log.Errorf("%s", err) + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } - } - fmt.Fprintf(ctx.Writer, "\n") + if !p.validateMsgSignature(msg, providerPublicKey) { + err = fmt.Errorf("Received invalid signature from provider") + p.log.Errorf("%s", err) + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } - err = writeFiles(ctx.Writer, files) - if err != nil { - p.log.Errorf("failed to write files: %s", err) - _ = ctx.Error(err) - ctx.Abort() + aiResponseEncrypted := msg.Result["message"].(string) + aiResponse, err := lib.DecryptString(aiResponseEncrypted, p.privateKey) + if err != nil { + err = lib.WrapError(fmt.Errorf("failed to decrypt ai response chunk"), err) + p.log.Errorf("%s", err) + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + var payload map[string]interface{} + err = json.Unmarshal([]byte(aiResponse), &payload) + if err != nil { + err = lib.WrapError(fmt.Errorf("failed to unmarshal response"), err) + p.log.Errorf("%s", err) + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + var stop = false + choices := payload["choices"].([]interface{}) + for _, choice := range choices { + choiceMap := choice.(map[string]interface{}) + finishReason, ok := choiceMap["finish_reason"].(string) + if ok && finishReason == "stop" { + stop = true + } + } + + msgJSON, err := json.Marshal(payload) + if err != nil { + err = lib.WrapError(fmt.Errorf("failed to marshal response"), err) + p.log.Errorf("%s", err) + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + _, err = ctx.Writer.Write([]byte(fmt.Sprintf("data: %s\n\n", msgJSON))) + if err != nil { + return false, constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + ctx.Writer.Flush() + if stop { + break + } } - return constants.HTTP_STATUS_OK, gin.H{} + + return true, constants.HTTP_STATUS_OK, gin.H{} +} + +func (p *ProxyRouterApi) validateMsgSignature(msg *morrpc.RpcResponse, providerPubicKey string) bool { + signature := fmt.Sprintf("%v", msg.Result["signature"]) + + isValidSignature := morrpc.NewMorRpc().VerifySignature(msg.Result, signature, providerPubicKey, p.log) + p.log.Debugf("Is valid signature: %t", isValidSignature) + return isValidSignature } func writeFiles(writer io.Writer, files []system.FD) error { diff --git a/proxy-router/internal/repositories/contracts/mapper.go b/proxy-router/internal/repositories/contracts/mapper.go index 0c7329d2..75fd65cc 100644 --- a/proxy-router/internal/repositories/contracts/mapper.go +++ b/proxy-router/internal/repositories/contracts/mapper.go @@ -17,6 +17,8 @@ type EventFactory func(name string) interface{} func CreateEventMapper(eventFactory EventFactory, abi *abi.ABI) func(log types.Log) (interface{}, error) { return func(log types.Log) (interface{}, error) { + fmt.Println("log.Topics[0]:", log.Topics[0]) + fmt.Println("abi", abi.Events) namedEvent, err := abi.EventByID(log.Topics[0]) if err != nil { return nil, err diff --git a/proxy-router/internal/repositories/contracts/subscription.go b/proxy-router/internal/repositories/contracts/subscription.go index 03edfe83..15e20dcf 100644 --- a/proxy-router/internal/repositories/contracts/subscription.go +++ b/proxy-router/internal/repositories/contracts/subscription.go @@ -5,8 +5,7 @@ import ( "errors" "time" - "github.com/Lumerin-protocol/contracts-go/clonefactory" - "github.com/Lumerin-protocol/contracts-go/implementation" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/contracts/sessionrouter" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/interfaces" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" "github.com/ethereum/go-ethereum" @@ -18,31 +17,10 @@ const RECONNECT_TIMEOUT = 2 * time.Second type EventMapper func(types.Log) (interface{}, error) -func implementationEventFactory(name string) interface{} { +func BlockchainEventFactory(name string) interface{} { switch name { - case "contractPurchased": - return new(implementation.ImplementationContractPurchased) - case "contractClosed": - return new(implementation.ImplementationContractClosed) - case "cipherTextUpdated": - return new(implementation.ImplementationCipherTextUpdated) - case "purchaseInfoUpdated": - return new(implementation.ImplementationPurchaseInfoUpdated) - default: - return nil - } -} - -func clonefactoryEventFactory(name string) interface{} { - switch name { - case "contractCreated": - return new(clonefactory.ClonefactoryContractCreated) - case "clonefactoryContractPurchased": - return new(clonefactory.ClonefactoryClonefactoryContractPurchased) - case "purchaseInfoUpdated": - return new(clonefactory.ClonefactoryPurchaseInfoUpdated) - case "contractDeleteUpdated": - return new(clonefactory.ClonefactoryContractDeleteUpdated) + case "SessionOpened": + return new(sessionrouter.SessionRouterSessionOpened) default: return nil } @@ -99,7 +77,8 @@ func WatchContractEvents(ctx context.Context, client EthereumClient, contractAdd continue } // mapper error, retry won't help - return err + // return err + continue } select { diff --git a/proxy-router/internal/repositories/registries/marketplace.go b/proxy-router/internal/repositories/registries/marketplace.go index b7e96e80..4940a487 100644 --- a/proxy-router/internal/repositories/registries/marketplace.go +++ b/proxy-router/internal/repositories/registries/marketplace.go @@ -48,20 +48,20 @@ func NewMarketplace(marketplaceAddr common.Address, client *ethclient.Client, lo } } -func (g *Marketplace) GetBidsByProvider(ctx context.Context, provider common.Address, offset *big.Int, limit uint8) ([]marketplace.MarketplaceBid, error) { - bids, err := g.marketplace.GetBidsByProvider(&bind.CallOpts{Context: ctx}, provider, offset, limit) +func (g *Marketplace) GetBidsByProvider(ctx context.Context, provider common.Address, offset *big.Int, limit uint8) ([][32]byte, []marketplace.Bid, error) { + adresses, bids, err := g.marketplace.GetBidsByProvider(&bind.CallOpts{Context: ctx}, provider, offset, limit) if err != nil { - return nil, err + return nil, nil, err } - return bids, nil + return adresses, bids, nil } -func (g *Marketplace) GetBidsByModelAgent(ctx context.Context, modelAgentId [32]byte, offset *big.Int, limit uint8) ([]marketplace.MarketplaceBid, error) { - bids, err := g.marketplace.GetBidsByModelAgent(&bind.CallOpts{Context: ctx}, modelAgentId, offset, limit) +func (g *Marketplace) GetBidsByModelAgent(ctx context.Context, modelAgentId [32]byte, offset *big.Int, limit uint8) ([][32]byte, []marketplace.Bid, error) { + addresses, bids, err := g.marketplace.GetBidsByModelAgent(&bind.CallOpts{Context: ctx}, modelAgentId, offset, limit) if err != nil { - return nil, err + return nil, nil, err } - return bids, nil + return addresses, bids, nil } diff --git a/proxy-router/internal/repositories/registries/model_registry.go b/proxy-router/internal/repositories/registries/model_registry.go index e14eb09b..ce4b9694 100644 --- a/proxy-router/internal/repositories/registries/model_registry.go +++ b/proxy-router/internal/repositories/registries/model_registry.go @@ -46,11 +46,11 @@ func NewModelRegistry(modelRegistryAddr common.Address, client *ethclient.Client } } -func (g *ModelRegistry) GetAllProviders(ctx context.Context) ([]modelregistry.ModelRegistryModel, error) { - models, err := g.modelRegistry.GetAll(&bind.CallOpts{Context: ctx}) +func (g *ModelRegistry) GetAllModels(ctx context.Context) ([][32]byte, []modelregistry.Model, error) { + adresses, models, err := g.modelRegistry.ModelGetAll(&bind.CallOpts{Context: ctx}) if err != nil { - return nil, err + return nil, nil, err } - return models, nil + return adresses, models, nil } diff --git a/proxy-router/internal/repositories/registries/mor_token.go b/proxy-router/internal/repositories/registries/mor_token.go new file mode 100644 index 00000000..226e8408 --- /dev/null +++ b/proxy-router/internal/repositories/registries/mor_token.go @@ -0,0 +1,92 @@ +package registries + +import ( + "context" + "math/big" + + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/contracts/morpheustoken" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/interfaces" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" +) + +type MorToken struct { + // config + morTokenAddr common.Address + + // state + nonce uint64 + mutex lib.Mutex + morABI *abi.ABI + + // deps + mor *morpheustoken.MorpheusToken + client *ethclient.Client + log interfaces.ILogger +} + +func NewMorToken(morTokenAddr common.Address, client *ethclient.Client, log interfaces.ILogger) *MorToken { + mor, err := morpheustoken.NewMorpheusToken(morTokenAddr, client) + if err != nil { + panic("invalid mor ABI") + } + morABI, err := morpheustoken.MorpheusTokenMetaData.GetAbi() + if err != nil { + panic("invalid mpr ABI: " + err.Error()) + } + return &MorToken{ + mor: mor, + morTokenAddr: morTokenAddr, + client: client, + morABI: morABI, + mutex: lib.NewMutex(), + log: log, + } +} + +func (g *MorToken) GetBalance(ctx context.Context, account common.Address) (*big.Int, error) { + return g.mor.BalanceOf(&bind.CallOpts{Context: ctx}, account) +} + +func (g *MorToken) GetAllowance(ctx context.Context, owner common.Address, spender common.Address) (*big.Int, error) { + return g.mor.Allowance(&bind.CallOpts{Context: ctx}, owner, spender) +} + +func (g *MorToken) Approve(ctx *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { + tx, err := g.mor.Approve(ctx, spender, amount) + if err != nil { + return nil, lib.TryConvertGethError(err, morpheustoken.MorpheusTokenMetaData) + } + // Wait for the transaction receipt + _, err = bind.WaitMined(ctx.Context, g.client, tx) + if err != nil { + return nil, err + } + return tx, nil +} + +func (g *MorToken) GetTotalSupply(ctx context.Context) (*big.Int, error) { + supply, err := g.mor.TotalSupply(&bind.CallOpts{Context: ctx}) + if err != nil { + return nil, lib.TryConvertGethError(err, morpheustoken.MorpheusTokenMetaData) + } + return supply, nil +} + +func (g *MorToken) Transfer(ctx *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) { + tx, err := g.mor.Transfer(ctx, to, value) + if err != nil { + return nil, lib.TryConvertGethError(err, morpheustoken.MorpheusTokenMetaData) + } + + // Wait for the transaction receipt + _, err = bind.WaitMined(ctx.Context, g.client, tx) + if err != nil { + return nil, err + } + return tx, nil +} diff --git a/proxy-router/internal/repositories/registries/provider_registry.go b/proxy-router/internal/repositories/registries/provider_registry.go index 11155f85..2e1c2c0c 100644 --- a/proxy-router/internal/repositories/registries/provider_registry.go +++ b/proxy-router/internal/repositories/registries/provider_registry.go @@ -48,8 +48,8 @@ func NewProviderRegistry(providerRegistryAddr common.Address, client *ethclient. } } -func (g *ProviderRegistry) GetAllProviders(ctx context.Context) ([]string, []providerregistry.ProviderRegistryProvider, error) { - providerAddrs, providers, err := g.providerRegistry.GetAll(&bind.CallOpts{Context: ctx}) +func (g *ProviderRegistry) GetAllProviders(ctx context.Context) ([]string, []providerregistry.Provider, error) { + providerAddrs, providers, err := g.providerRegistry.ProviderGetAll(&bind.CallOpts{Context: ctx}) if err != nil { return nil, nil, err } diff --git a/proxy-router/internal/repositories/registries/session_router.go b/proxy-router/internal/repositories/registries/session_router.go new file mode 100644 index 00000000..581a60c2 --- /dev/null +++ b/proxy-router/internal/repositories/registries/session_router.go @@ -0,0 +1,196 @@ +package registries + +import ( + "context" + "fmt" + "math/big" + "time" + + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/contracts/sessionrouter" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/interfaces" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" +) + +type SessionRouter struct { + // config + sessionRouterAddr common.Address + + // state + nonce uint64 + mutex lib.Mutex + srABI *abi.ABI + + // deps + sessionRouter *sessionrouter.SessionRouter + client *ethclient.Client + log interfaces.ILogger +} + +var closeReportAbi = []lib.AbiParameter{ + {Type: "bytes32"}, + {Type: "uint128"}, + {Type: "uint32"}, +} + +func NewSessionRouter(sessionRouterAddr common.Address, client *ethclient.Client, log interfaces.ILogger) *SessionRouter { + sr, err := sessionrouter.NewSessionRouter(sessionRouterAddr, client) + if err != nil { + panic("invalid marketplace ABI") + } + srABI, err := sessionrouter.SessionRouterMetaData.GetAbi() + if err != nil { + panic("invalid marketplace ABI: " + err.Error()) + } + return &SessionRouter{ + sessionRouter: sr, + sessionRouterAddr: sessionRouterAddr, + client: client, + srABI: srABI, + mutex: lib.NewMutex(), + log: log, + } +} + +func (g *SessionRouter) OpenSession(ctx *bind.TransactOpts, approval []byte, approvalSig []byte, stake *big.Int, privateKeyHex string) (string, error) { + sessionTx, err := g.sessionRouter.OpenSession(ctx, stake, approval, approvalSig) + if err != nil { + return "", lib.TryConvertGethError(err, sessionrouter.SessionRouterMetaData) + } + + // Wait for the transaction receipt + receipt, err := bind.WaitMined(context.Background(), g.client, sessionTx) + if err != nil { + return "", lib.TryConvertGethError(err, sessionrouter.SessionRouterMetaData) + } + + // Find the event log + for _, log := range receipt.Logs { + // Check if the log belongs to the OpenSession event + event, err := g.sessionRouter.ParseSessionOpened(*log) + if err != nil { + continue // not our event, skip it + } + + // Convert the sessionId to string + sessionId := lib.BytesToString(event.SessionId[:]) + return sessionId, nil + } + + return "", fmt.Errorf("OpenSession event not found in transaction logs") +} + +func (g *SessionRouter) GetSession(ctx context.Context, sessionId string) (*sessionrouter.Session, error) { + id := common.FromHex(sessionId) + + session, err := g.sessionRouter.GetSession(&bind.CallOpts{Context: ctx}, [32]byte(id)) + if err != nil { + return nil, err + } + + return &session, nil +} + +func (g *SessionRouter) GetSessionsByProvider(ctx context.Context, providerAddr common.Address, offset *big.Int, limit uint8) ([]sessionrouter.Session, error) { + sessions, err := g.sessionRouter.GetSessionsByProvider(&bind.CallOpts{Context: ctx}, providerAddr, offset, limit) + if err != nil { + return nil, lib.TryConvertGethError(err, sessionrouter.SessionRouterMetaData) + } + return sessions, nil +} + +func (g *SessionRouter) GetSessionsByUser(ctx context.Context, userAddr common.Address, offset *big.Int, limit uint8) ([]sessionrouter.Session, error) { + sessions, err := g.sessionRouter.GetSessionsByUser(&bind.CallOpts{Context: ctx}, userAddr, offset, limit) + if err != nil { + return nil, lib.TryConvertGethError(err, sessionrouter.SessionRouterMetaData) + } + return sessions, nil +} + +func (g *SessionRouter) CloseSession(ctx *bind.TransactOpts, sessionId string, privateKeyHex string) (string, error) { + id := [32]byte(common.FromHex(sessionId)) + + ips := uint32(1) + timestamp := big.NewInt(time.Now().UnixMilli()) + report, err := lib.EncodeAbiParameters(closeReportAbi, []interface{}{id, timestamp, ips}) + if err != nil { + return "", err + } + + signature, err := lib.SignEthMessage(report, privateKeyHex) + if err != nil { + return "", err + } + + sessionTx, err := g.sessionRouter.CloseSession(ctx, report, signature) + if err != nil { + return "", lib.TryConvertGethError(err, sessionrouter.SessionRouterMetaData) + } + + // Wait for the transaction receipt + receipt, err := bind.WaitMined(context.Background(), g.client, sessionTx) + if err != nil { + fmt.Println(err) + return "", err + } + + // Find the event log + for _, log := range receipt.Logs { + // Check if the log belongs to the CloseSession event + event, err := g.sessionRouter.ParseSessionClosed(*log) + if err != nil { + continue // not our event, skip it + } + + // Convert the sessionId to string + sessionId := lib.BytesToString(event.SessionId[:]) + return sessionId, nil + } + + return "", fmt.Errorf("CloseSession event not found in transaction logs") +} + +func (g *SessionRouter) GetProviderClaimableBalance(ctx context.Context, sessionId string) (*big.Int, error) { + id := [32]byte(common.FromHex(sessionId)) + balance, err := g.sessionRouter.GetProviderClaimableBalance(&bind.CallOpts{Context: ctx}, id) + if err != nil { + return nil, lib.TryConvertGethError(err, sessionrouter.SessionRouterMetaData) + } + return balance, nil +} + +func (g *SessionRouter) ClaimProviderBalance(ctx *bind.TransactOpts, sessionId string, amount *big.Int, to common.Address) (string, error) { + id := [32]byte(common.FromHex(sessionId)) + tx, err := g.sessionRouter.ClaimProviderBalance(ctx, id, amount, to) + if err != nil { + return "", lib.TryConvertGethError(err, sessionrouter.SessionRouterMetaData) + } + + // Wait for the transaction receipt + _, err = bind.WaitMined(context.Background(), g.client, tx) + if err != nil { + return "", err + } + + return tx.Hash().String(), nil +} + +func (g *SessionRouter) GetTodaysBudget(ctx context.Context) (*big.Int, error) { + timestamp := big.NewInt(time.Now().Unix()) + budget, err := g.sessionRouter.GetTodaysBudget(&bind.CallOpts{Context: ctx}, timestamp) + if err != nil { + return nil, lib.TryConvertGethError(err, sessionrouter.SessionRouterMetaData) + } + return budget, nil +} + +func (g *SessionRouter) GetContractAddress() common.Address { + return g.sessionRouterAddr +} + +func (g *SessionRouter) GetABI() *abi.ABI { + return g.srABI +} diff --git a/proxy-router/internal/rpcproxy/event_listener.go b/proxy-router/internal/rpcproxy/event_listener.go new file mode 100644 index 00000000..74b89a6c --- /dev/null +++ b/proxy-router/internal/rpcproxy/event_listener.go @@ -0,0 +1,81 @@ +package rpcproxy + +import ( + "context" + + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/contracts/sessionrouter" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/repositories/contracts" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/repositories/registries" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/storages" + "github.com/ethereum/go-ethereum/ethclient" +) + +type EventsListener struct { + sessionRouter *registries.SessionRouter + store *storages.SessionStorage + tsk *lib.Task + log *lib.Logger + client *ethclient.Client +} + +func NewEventsListener(client *ethclient.Client, store *storages.SessionStorage, sessionRouter *registries.SessionRouter, log *lib.Logger) *EventsListener { + return &EventsListener{ + store: store, + log: log, + sessionRouter: sessionRouter, + client: client, + } +} + +func (e *EventsListener) Run(ctx context.Context) error { + defer func() { + _ = e.log.Close() + }() + + sub, err := contracts.WatchContractEvents(ctx, e.client, e.sessionRouter.GetContractAddress(), contracts.CreateEventMapper(contracts.BlockchainEventFactory, e.sessionRouter.GetABI()), e.log) + if err != nil { + return err + } + defer sub.Unsubscribe() + e.log.Infof("started watching events, address %s", e.sessionRouter.GetContractAddress()) + + for { + select { + case <-ctx.Done(): + return ctx.Err() + case event := <-sub.Events(): + err := e.controller(ctx, event) + if err != nil { + e.log.Errorf("error loading data: %s", err) + } + case err := <-sub.Err(): + e.log.Errorf("error in event listener: %s", err) + // return err + } + } +} + +func (e *EventsListener) controller(ctx context.Context, event interface{}) error { + switch ev := event.(type) { + case *sessionrouter.SessionRouterSessionOpened: + return e.handleSessionOpened(ctx, ev) + } + return nil +} + +func (e *EventsListener) handleSessionOpened(ctx context.Context, event *sessionrouter.SessionRouterSessionOpened) error { + sessionId := lib.BytesToString(event.SessionId[:]) + e.log.Debugf("received open session router event, sessionId %s", sessionId) + // session, err := e.sessionRouter.GetSession(ctx, sessionId) + // if err != nil { + // return err + // } + + e.store.AddSession(&storages.Session{ + Id: sessionId, + UserAddr: event.UserAddress.Hex(), + }) + + return nil +} diff --git a/proxy-router/internal/rpcproxy/explorer_client.go b/proxy-router/internal/rpcproxy/explorer_client.go new file mode 100644 index 00000000..f2fad8ab --- /dev/null +++ b/proxy-router/internal/rpcproxy/explorer_client.go @@ -0,0 +1,75 @@ +package rpcproxy + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/rpcproxy/structs" +) + +type ExplorerClient struct { + explorerApiUrl string + morTokenAddr string +} + +func NewExplorerClient(explorerApiUrl string, morTokenAddr string) *ExplorerClient { + return &ExplorerClient{ + explorerApiUrl: explorerApiUrl, + morTokenAddr: morTokenAddr, + } +} + +func (e *ExplorerClient) GetEthTransactions(address string, page string, limit string) ([]structs.RawTransaction, error) { + query := fmt.Sprintf("?module=account&action=txlist&address=%s&page=%s&offset=%s", address, page, limit) + url := e.explorerApiUrl + query + + transactions, err := e.doRequest(url) + if err != nil { + return nil, err + } + return transactions, nil +} + +func (e *ExplorerClient) GetTokenTransactions(address string, page string, limit string) ([]structs.RawTransaction, error) { + query := fmt.Sprintf("?module=account&action=tokentx&contractaddress=%s&address=%s&page=%s&offset=%s", e.morTokenAddr, address, page, limit) + url := e.explorerApiUrl + query + + transactions, err := e.doRequest(url) + if err != nil { + return nil, err + } + return transactions, nil +} + +func (e *ExplorerClient) doRequest(url string) ([]structs.RawTransaction, error) { + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return nil, err + } + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("failed to fetch eth transactions, HTTP status code: %d", resp.StatusCode) + } + + var response structs.RawEthTransactionResponse + if err := json.NewDecoder(resp.Body).Decode(&response); err != nil { + return nil, err + } + if response.Status == "0" { + return make([]structs.RawTransaction, 0), nil + } + + if response.Status != "1" { + return nil, fmt.Errorf("failed to fetch eth transactions, response status: %s", response.Result) + } + + return response.Result, nil +} diff --git a/proxy-router/internal/rpcproxy/rpc_proxy.go b/proxy-router/internal/rpcproxy/rpc_proxy.go index c8269063..474d4945 100644 --- a/proxy-router/internal/rpcproxy/rpc_proxy.go +++ b/proxy-router/internal/rpcproxy/rpc_proxy.go @@ -2,14 +2,25 @@ package rpcproxy import ( "context" + "encoding/hex" + "errors" "math/big" + "sort" + "strconv" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/contracts/sessionrouter" constants "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/interfaces" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/lib" "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/repositories/registries" + "github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/internal/rpcproxy/structs" "github.com/gin-gonic/gin" + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" ) @@ -18,17 +29,32 @@ type RpcProxy struct { providerRegistry *registries.ProviderRegistry modelRegistry *registries.ModelRegistry marketplace *registries.Marketplace + sessionRouter *registries.SessionRouter + morToken *registries.MorToken + explorerClient *ExplorerClient + + legacyTx bool + privateKey string } -func NewRpcProxy(rpcClient *ethclient.Client, providerRegistryAddr common.Address, modelRegistryAddr common.Address, marketplaceAddr common.Address, log interfaces.ILogger) *RpcProxy { - providerRegistry := registries.NewProviderRegistry(providerRegistryAddr, rpcClient, log) - modelRegistry := registries.NewModelRegistry(modelRegistryAddr, rpcClient, log) - marketplace := registries.NewMarketplace(marketplaceAddr, rpcClient, log) +func NewRpcProxy(rpcClient *ethclient.Client, diamonContractAddr common.Address, morTokenAddr common.Address, explorerApiUrl string, privateKey string, log interfaces.ILogger, legacyTx bool) *RpcProxy { + providerRegistry := registries.NewProviderRegistry(diamonContractAddr, rpcClient, log) + modelRegistry := registries.NewModelRegistry(diamonContractAddr, rpcClient, log) + marketplace := registries.NewMarketplace(diamonContractAddr, rpcClient, log) + sessionRouter := registries.NewSessionRouter(diamonContractAddr, rpcClient, log) + morToken := registries.NewMorToken(morTokenAddr, rpcClient, log) + + explorerClient := NewExplorerClient(explorerApiUrl, morTokenAddr.String()) return &RpcProxy{ rpcClient: rpcClient, providerRegistry: providerRegistry, modelRegistry: modelRegistry, marketplace: marketplace, + sessionRouter: sessionRouter, + legacyTx: legacyTx, + privateKey: privateKey, + morToken: morToken, + explorerClient: explorerClient, } } @@ -41,29 +67,501 @@ func (rpcProxy *RpcProxy) GetAllProviders(ctx context.Context) (int, gin.H) { if err != nil { return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } - return constants.HTTP_STATUS_OK, gin.H{"addresses": addrs, "providers": providers} + + result := make([]*structs.Provider, len(addrs)) + for i, value := range providers { + result[i] = &structs.Provider{ + Address: addrs[i], + Endpoint: value.Endpoint, + Stake: value.Stake, + IsDeleted: value.IsDeleted, + CreatedAt: value.CreatedAt, + } + } + + return constants.HTTP_STATUS_OK, gin.H{"providers": result} } func (rpcProxy *RpcProxy) GetAllModels(ctx context.Context) (int, gin.H) { - models, err := rpcProxy.modelRegistry.GetAllProviders(ctx) + ids, models, err := rpcProxy.modelRegistry.GetAllModels(ctx) if err != nil { return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } - return constants.HTTP_STATUS_OK, gin.H{"models": models} + + result := make([]*structs.Model, len(ids)) + for i, value := range models { + result[i] = &structs.Model{ + Id: lib.BytesToString(ids[i][:]), + IpfsCID: lib.BytesToString(value.IpfsCID[:]), + Fee: value.Fee, + Stake: value.Stake, + Owner: value.Owner, + Name: value.Name, + Tags: value.Tags, + CreatedAt: value.CreatedAt, + IsDeleted: value.IsDeleted, + } + } + + return constants.HTTP_STATUS_OK, gin.H{"models": result} } func (rpcProxy *RpcProxy) GetBidsByProvider(ctx context.Context, providerAddr common.Address, offset *big.Int, limit uint8) (int, gin.H) { - bids, err := rpcProxy.marketplace.GetBidsByProvider(ctx, providerAddr, offset, limit) + ids, bids, err := rpcProxy.marketplace.GetBidsByProvider(ctx, providerAddr, offset, limit) if err != nil { return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } - return constants.HTTP_STATUS_OK, gin.H{"bids": bids} + + result := make([]*structs.Bid, len(ids)) + for i, value := range bids { + result[i] = &structs.Bid{ + Id: lib.BytesToString(ids[i][:]), + ModelAgentId: lib.BytesToString(value.ModelAgentId[:]), + Provider: value.Provider, + Nonce: value.Nonce, + CreatedAt: value.CreatedAt, + DeletedAt: value.DeletedAt, + PricePerSecond: value.PricePerSecond, + } + } + return constants.HTTP_STATUS_OK, gin.H{"bids": result} } func (rpcProxy *RpcProxy) GetBidsByModelAgent(ctx context.Context, modelId [32]byte, offset *big.Int, limit uint8) (int, gin.H) { - bids, err := rpcProxy.marketplace.GetBidsByModelAgent(ctx, modelId, offset, limit) + ids, bids, err := rpcProxy.marketplace.GetBidsByModelAgent(ctx, modelId, offset, limit) + if err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + result := make([]*structs.Bid, len(ids)) + for i, value := range bids { + result[i] = &structs.Bid{ + Id: lib.BytesToString(ids[i][:]), + ModelAgentId: lib.BytesToString(value.ModelAgentId[:]), + Provider: value.Provider, + Nonce: value.Nonce, + CreatedAt: value.CreatedAt, + DeletedAt: value.DeletedAt, + PricePerSecond: value.PricePerSecond, + } + } + + return constants.HTTP_STATUS_OK, gin.H{"bids": result} +} + +func (rpcProxy *RpcProxy) OpenSession(ctx *gin.Context) (int, gin.H) { + var reqPayload map[string]interface{} + if err := ctx.ShouldBindJSON(&reqPayload); err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + approval, ok := reqPayload["approval"].(string) + if !ok { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "approval is required"} + } + + approvalSig, ok := reqPayload["approvalSig"].(string) + if !ok { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "approvalSig is required"} + } + + stakeStr, ok := reqPayload["stake"].(string) + if !ok { + print(ok) + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "stake is required"} + } + + stake, ok := new(big.Int).SetString(stakeStr, 10) + if !ok { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "stake is invalid"} + } + + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + + approvalBytes := common.FromHex(approval) + approvalSigBytes := common.FromHex(approvalSig) + + sessionId, err := rpcProxy.sessionRouter.OpenSession(transactOpt, approvalBytes, approvalSigBytes, stake, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + return constants.HTTP_STATUS_OK, gin.H{"sessionId": sessionId} +} + +func (rpcProxy *RpcProxy) CloseSession(ctx *gin.Context) (int, gin.H) { + sessionId := ctx.Param("id") + + if sessionId == "" { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "sessionId is required"} + } + + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + + _, err = rpcProxy.sessionRouter.CloseSession(transactOpt, sessionId, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + return constants.HTTP_STATUS_OK, gin.H{"success": true} +} + +func (rpcProxy *RpcProxy) GetSession(ctx *gin.Context, sessionId string) (int, gin.H) { + session, err := rpcProxy.sessionRouter.GetSession(ctx, sessionId) + if err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + return constants.HTTP_STATUS_OK, gin.H{"session": session} +} + +func (rpc *RpcProxy) GetProviderClaimableBalance(ctx *gin.Context) (int, gin.H) { + sessionId := ctx.Param("id") + if sessionId == "" { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "sessionId is required"} + } + + balance, err := rpc.sessionRouter.GetProviderClaimableBalance(ctx, sessionId) + if err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + return constants.HTTP_STATUS_OK, gin.H{"balance": balance} +} + +func (rpcProxy *RpcProxy) GetBalance(ctx *gin.Context) (int, gin.H) { + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + + ethBalance, err := rpcProxy.rpcClient.BalanceAt(ctx, transactOpt.From, nil) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to get eth balance: " + err.Error()} + } + + balance, err := rpcProxy.morToken.GetBalance(ctx, transactOpt.From) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to get mor balance: " + err.Error()} + } + + return constants.HTTP_STATUS_OK, gin.H{"eth": ethBalance.String(), "mor": balance.String()} +} + +func (rpcProxy *RpcProxy) SendEth(ctx *gin.Context) (int, gin.H) { + to, amount, err := rpcProxy.getSendParams(ctx) + if err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + + nonce, err := rpcProxy.rpcClient.PendingNonceAt(context.Background(), transactOpt.From) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to get nonce: " + err.Error()} + } + + toAddr := common.HexToAddress(to) + estimatedGas, err := rpcProxy.rpcClient.EstimateGas(context.Background(), ethereum.CallMsg{ + From: transactOpt.From, + To: &toAddr, + Value: amount, + }) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to estimate gas: " + err.Error()} + } + + gas := float64(estimatedGas) * 1.5 + tx := types.NewTransaction(nonce, toAddr, amount, uint64(gas), transactOpt.GasPrice, nil) + signedTx, err := rpcProxy.signTx(ctx, tx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to sign eth: " + err.Error()} + } + + err = rpcProxy.rpcClient.SendTransaction(context.Background(), signedTx) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to send eth: " + err.Error()} + } + + // Wait for the transaction receipt + _, err = bind.WaitMined(context.Background(), rpcProxy.rpcClient, signedTx) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to send eth: " + err.Error()} + } + + return constants.HTTP_STATUS_OK, gin.H{"txHash": signedTx.Hash().String()} +} + +func (rpcProxy *RpcProxy) SendMor(ctx *gin.Context) (int, gin.H) { + to, amount, err := rpcProxy.getSendParams(ctx) + if err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + + tx, err := rpcProxy.morToken.Transfer(transactOpt, common.HexToAddress(to), amount) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to transfer mor: " + err.Error()} + } + + return constants.HTTP_STATUS_OK, gin.H{"txHash": tx.Hash().String()} +} + +func (rpcProxy *RpcProxy) GetAllowance(ctx *gin.Context) (int, gin.H) { + spender := ctx.Query("spender") + + if spender == "" { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "spender is required"} + } + + spenderAddr := common.HexToAddress(spender) + + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to get transactOpts: " + err.Error()} + } + + allowance, err := rpcProxy.morToken.GetAllowance(ctx, transactOpt.From, spenderAddr) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to get allowance: " + err.Error()} + } + + return constants.HTTP_STATUS_OK, gin.H{"allowance": allowance.String()} +} + +func (rpcProxy *RpcProxy) Approve(ctx *gin.Context) (int, gin.H) { + spender := ctx.Query("spender") + + if spender == "" { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "spender is required"} + } + + spenderAddr := common.HexToAddress(spender) + + amount := ctx.Query("amount") + if amount == "" { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "amount is required"} + } + + amountInt, ok := new(big.Int).SetString(amount, 10) + if !ok { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "invalid amount"} + } + + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to get transactOpts: " + err.Error()} + } + + tx, err := rpcProxy.morToken.Approve(transactOpt, spenderAddr, amountInt) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to approve: " + err.Error()} + } + + return constants.HTTP_STATUS_OK, gin.H{"tx": tx} +} + +func (rpcProxy *RpcProxy) GetTodaysBudget(ctx *gin.Context) (int, gin.H) { + budget, err := rpcProxy.sessionRouter.GetTodaysBudget(ctx) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to get budget: " + err.Error()} + } + + return constants.HTTP_STATUS_OK, gin.H{"budget": budget.String()} +} + +func (rpcProxy *RpcProxy) ClaimProviderBalance(ctx *gin.Context) (int, gin.H) { + sessionId := ctx.Param("id") + if sessionId == "" { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "sessionId is required"} + } + + to, amount, err := rpcProxy.getSendParams(ctx) + if err != nil { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} + } + + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + + txHash, err := rpcProxy.sessionRouter.ClaimProviderBalance(transactOpt, sessionId, amount, common.HexToAddress(to)) if err != nil { return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": err.Error()} } - return constants.HTTP_STATUS_OK, gin.H{"bids": bids} + + return constants.HTTP_STATUS_OK, gin.H{"txHash": txHash} +} + +func (rpcProxy *RpcProxy) GetTokenSupply(ctx *gin.Context) (int, gin.H) { + supply, err := rpcProxy.morToken.GetTotalSupply(ctx) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": "failed to get supply: " + err.Error()} + } + return constants.HTTP_STATUS_OK, gin.H{"supply": supply.String()} +} + +func (rpcProxy *RpcProxy) GetSessions(ctx *gin.Context, offset *big.Int, limit uint8) (int, gin.H) { + if ctx.Query("user") != "" { + sessions, err := rpcProxy.sessionRouter.GetSessionsByUser(ctx, common.HexToAddress(ctx.Query("user")), offset, limit) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + return constants.HTTP_STATUS_OK, gin.H{"sessions": rpcProxy.mapSessions(sessions)} + } else if ctx.Query("provider") != "" { + sessions, err := rpcProxy.sessionRouter.GetSessionsByProvider(ctx, common.HexToAddress(ctx.Query("provider")), offset, limit) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + return constants.HTTP_STATUS_OK, gin.H{"sessions": rpcProxy.mapSessions(sessions)} + } else { + return constants.HTTP_STATUS_BAD_REQUEST, gin.H{"error": "user or provider is required"} + } +} + +func (rpcProxy *RpcProxy) mapSessions(sessions []sessionrouter.Session) []*structs.Session { + result := make([]*structs.Session, len(sessions)) + for i, value := range sessions { + result[i] = &structs.Session{ + Id: lib.BytesToString(value.Id[:]), + Provider: value.Provider, + User: value.User, + ModelAgentId: lib.BytesToString(value.ModelAgentId[:]), + BidID: lib.BytesToString(value.BidID[:]), + Stake: value.Stake, + PricePerSecond: value.PricePerSecond, + CloseoutReceipt: hex.EncodeToString(value.CloseoutReceipt), + CloseoutType: value.CloseoutType, + ProviderWithdrawnAmount: value.ProviderWithdrawnAmount, + OpenedAt: value.OpenedAt, + EndsAt: value.EndsAt, + ClosedAt: value.ClosedAt, + } + } + return result +} + +func (rpcProxy *RpcProxy) GetTransactions(ctx *gin.Context) (int, gin.H) { + page := ctx.Query("page") + limit := ctx.Query("limit") + if page == "" { + page = "1" + } + + if limit == "" { + limit = "10" + } + + transactOpt, err := rpcProxy.getTransactOpts(ctx, rpcProxy.privateKey) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + address := transactOpt.From + + ethTrxs, err := rpcProxy.explorerClient.GetEthTransactions(address.String(), page, limit) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + morTrxs, err := rpcProxy.explorerClient.GetTokenTransactions(address.String(), page, limit) + if err != nil { + return constants.HTTP_INTERNAL_SERVER_ERROR, gin.H{"error": err.Error()} + } + + allTrxs := append(ethTrxs, morTrxs...) + sort.Slice(allTrxs, func(i, j int) bool { + blockNumber1, err := strconv.ParseInt(allTrxs[i].BlockNumber, 10, 0) + if err != nil { + return false + } + blockNumber2, err := strconv.ParseInt(allTrxs[j].BlockNumber, 10, 0) + if err != nil { + return false + } + + return blockNumber1 > blockNumber2 + }) + + return constants.HTTP_STATUS_OK, gin.H{"transactions": allTrxs} +} + +func (rpcProxy *RpcProxy) getTransactOpts(ctx context.Context, privKey string) (*bind.TransactOpts, error) { + privateKey, err := crypto.HexToECDSA(privKey) + if err != nil { + return nil, err + } + + chainId, err := rpcProxy.rpcClient.ChainID(ctx) + if err != nil { + return nil, err + } + + transactOpts, err := bind.NewKeyedTransactorWithChainID(privateKey, chainId) + if err != nil { + return nil, err + } + + // TODO: deal with likely gasPrice issue so our transaction processes before another pending nonce. + if rpcProxy.legacyTx { + gasPrice, err := rpcProxy.rpcClient.SuggestGasPrice(ctx) + if err != nil { + return nil, err + } + transactOpts.GasPrice = gasPrice + } + + transactOpts.Value = big.NewInt(0) + transactOpts.Context = ctx + + return transactOpts, nil +} + +func (rpcProxy *RpcProxy) signTx(ctx context.Context, tx *types.Transaction, privKey string) (*types.Transaction, error) { + privateKey, err := crypto.HexToECDSA(privKey) + if err != nil { + return nil, err + } + + chainId, err := rpcProxy.rpcClient.ChainID(ctx) + if err != nil { + return nil, err + } + + return types.SignTx(tx, types.NewEIP155Signer(chainId), privateKey) +} + +func (rpcProxy *RpcProxy) getSendParams(ctx *gin.Context) (string, *big.Int, error) { + var reqPayload map[string]interface{} + if err := ctx.ShouldBindJSON(&reqPayload); err != nil { + return "", &big.Int{}, err + } + + to := reqPayload["to"].(string) + amountStr := reqPayload["amount"].(string) + + if to == "0" { + return "", &big.Int{}, errors.New("to is required") + } + + if amountStr == "" { + return "", &big.Int{}, errors.New("amount is required") + } + + amount, ok := new(big.Int).SetString(amountStr, 10) + if !ok { + return "", &big.Int{}, errors.New("invalid amount" + amountStr) + } + + return to, amount, nil } diff --git a/proxy-router/internal/rpcproxy/structs/bid.go b/proxy-router/internal/rpcproxy/structs/bid.go new file mode 100644 index 00000000..89e3ea66 --- /dev/null +++ b/proxy-router/internal/rpcproxy/structs/bid.go @@ -0,0 +1,17 @@ +package structs + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" +) + +type Bid struct { + Id string + Provider common.Address + ModelAgentId string + PricePerSecond *big.Int + Nonce *big.Int + CreatedAt *big.Int + DeletedAt *big.Int +} diff --git a/proxy-router/internal/rpcproxy/structs/model.go b/proxy-router/internal/rpcproxy/structs/model.go new file mode 100644 index 00000000..0a90dc25 --- /dev/null +++ b/proxy-router/internal/rpcproxy/structs/model.go @@ -0,0 +1,19 @@ +package structs + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" +) + +type Model struct { + Id string + IpfsCID string + Fee *big.Int + Stake *big.Int + Owner common.Address + Name string + Tags []string + CreatedAt *big.Int + IsDeleted bool +} diff --git a/proxy-router/internal/rpcproxy/structs/provider.go b/proxy-router/internal/rpcproxy/structs/provider.go new file mode 100644 index 00000000..afa390f8 --- /dev/null +++ b/proxy-router/internal/rpcproxy/structs/provider.go @@ -0,0 +1,13 @@ +package structs + +import ( + "math/big" +) + +type Provider struct { + Address string + Endpoint string + Stake *big.Int + CreatedAt *big.Int + IsDeleted bool +} diff --git a/proxy-router/internal/rpcproxy/structs/session.go b/proxy-router/internal/rpcproxy/structs/session.go new file mode 100644 index 00000000..1c25a0d4 --- /dev/null +++ b/proxy-router/internal/rpcproxy/structs/session.go @@ -0,0 +1,23 @@ +package structs + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" +) + +type Session struct { + Id string + User common.Address + Provider common.Address + ModelAgentId string + BidID string + Stake *big.Int + PricePerSecond *big.Int + CloseoutReceipt string + CloseoutType *big.Int + ProviderWithdrawnAmount *big.Int + OpenedAt *big.Int + EndsAt *big.Int + ClosedAt *big.Int +} diff --git a/proxy-router/internal/rpcproxy/structs/transaction.go b/proxy-router/internal/rpcproxy/structs/transaction.go new file mode 100644 index 00000000..db1aefaf --- /dev/null +++ b/proxy-router/internal/rpcproxy/structs/transaction.go @@ -0,0 +1,32 @@ +package structs + +type RawEthTransactionResponse struct { + Status string `json:"status"` + Message string `json:"message"` + Result []RawTransaction `json:"result"` +} + +type RawTransaction struct { + BlockHash string `json:"blockHash"` + BlockNumber string `json:"blockNumber"` + Confirmations string `json:"confirmations"` + ContractAddress string `json:"contractAddress"` + CumulativeGasUsed string `json:"cumulativeGasUsed"` + + From string `json:"from"` + FunctionName string `json:"functionName"` + Gas string `json:"gas"` + GasPrice string `json:"gasPrice"` + GasPriceBid string `json:"gasPriceBid"` + GasUsed string `json:"gasUsed"` + Hash string `json:"hash"` + Input string `json:"input"` + IsError string `json:"isError"` + MethodId string `json:"methodId"` + Nonce string `json:"nonce"` + TimeStamp string `json:"timeStamp"` + To string `json:"to"` + TransactionIndex string `json:"transactionIndex"` + TxReceiptStatus string `json:"txreceipt_status"` + Value string `json:"value"` +} diff --git a/proxy-router/internal/storages/session_storage.go b/proxy-router/internal/storages/session_storage.go new file mode 100644 index 00000000..71aef487 --- /dev/null +++ b/proxy-router/internal/storages/session_storage.go @@ -0,0 +1,46 @@ +package storages + +type Session struct { + Id string + UserAddr string + ProviderAddr string +} + +type User struct { + Addr string + PubKey string +} + +type SessionStorage struct { + storage map[string]*Session + users map[string]*User +} + +func NewSessionStorage() *SessionStorage { + return &SessionStorage{ + storage: make(map[string]*Session), + users: make(map[string]*User), + } +} + +func (s *SessionStorage) GetSession(id string) (*Session, bool) { + session, ok := s.storage[id] + return session, ok +} + +func (s *SessionStorage) GetUser(addr string) (*User, bool) { + user, ok := s.users[addr] + return user, ok +} + +func (s *SessionStorage) AddSession(session *Session) { + s.storage[session.Id] = session +} + +func (s *SessionStorage) AddUser(user *User) { + s.users[user.Addr] = user +} + +func (s *SessionStorage) RemoveSession(id string) { + delete(s.storage, id) +} diff --git a/smart-contracts/.env.example b/smart-contracts/.env.example index 266911af..54ead7ba 100644 --- a/smart-contracts/.env.example +++ b/smart-contracts/.env.example @@ -1,2 +1,5 @@ -ARBISCAN_API_KEY= # for coverage report to estimate deployment and calls price -COINMARKETCAP_API_KEY= # for coverage report to estimate deployment and calls price \ No newline at end of file +COINMARKETCAP_API_KEY= # for coverage report to estimate deployment and calls price +ETH_NODE_ADDRESS=https://arb-sepolia.g.alchemy.com/v2/SOME_API_KEY +ETHERSCAN_API_KEY= # for coverage report to estimate deployment and calls price +MOR_TOKEN_ADDRESS= # MOR token address +OWNER_PRIVATE_KEY= # contract owner private key \ No newline at end of file diff --git a/smart-contracts/.gitignore b/smart-contracts/.gitignore index 986344c5..4d59eb16 100644 --- a/smart-contracts/.gitignore +++ b/smart-contracts/.gitignore @@ -15,4 +15,7 @@ node_modules /gas.json # generated bindings -/bindings \ No newline at end of file +/bindings + +# editor files +.vscode \ No newline at end of file diff --git a/smart-contracts/.prettierrc b/smart-contracts/.prettierrc index 016b8657..ea167815 100644 --- a/smart-contracts/.prettierrc +++ b/smart-contracts/.prettierrc @@ -5,7 +5,7 @@ "files": "*.sol", "options": { "parser": "solidity-parse", - "printWidth": 80, + "printWidth": 120, "tabWidth": 2, "useTabs": false, "singleQuote": false, diff --git a/smart-contracts/.solhint.json b/smart-contracts/.solhint.json new file mode 100644 index 00000000..37979a87 --- /dev/null +++ b/smart-contracts/.solhint.json @@ -0,0 +1,8 @@ +{ + "extends": "solhint:recommended", + "rules": { + "explicit-types": "off", + "no-inline-assembly": "off", + "avoid-low-level-calls": "off" + } +} \ No newline at end of file diff --git a/smart-contracts/bindings/go/contracts/agentregistry/AgentRegistry.go b/smart-contracts/bindings/go/contracts/agentregistry/AgentRegistry.go deleted file mode 100644 index 9f252d89..00000000 --- a/smart-contracts/bindings/go/contracts/agentregistry/AgentRegistry.go +++ /dev/null @@ -1,1296 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package agentregistry - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// AgentRegistryAgent is an auto generated low-level Go binding around an user-defined struct. -type AgentRegistryAgent struct { - AgentId [32]byte - Fee *big.Int - Stake *big.Int - Timestamp *big.Int - Owner common.Address - Name string - Tags []string -} - -// AgentRegistryMetaData contains all meta data concerning the AgentRegistry contract. -var AgentRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"}],\"name\":\"Deregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"MinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"}],\"name\":\"RegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"deregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAll\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"internalType\":\"structAgentRegistry.Agent[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getIds\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"agentId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"setMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - -// AgentRegistryABI is the input ABI used to generate the binding from. -// Deprecated: Use AgentRegistryMetaData.ABI instead. -var AgentRegistryABI = AgentRegistryMetaData.ABI - -// AgentRegistry is an auto generated Go binding around an Ethereum contract. -type AgentRegistry struct { - AgentRegistryCaller // Read-only binding to the contract - AgentRegistryTransactor // Write-only binding to the contract - AgentRegistryFilterer // Log filterer for contract events -} - -// AgentRegistryCaller is an auto generated read-only Go binding around an Ethereum contract. -type AgentRegistryCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// AgentRegistryTransactor is an auto generated write-only Go binding around an Ethereum contract. -type AgentRegistryTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// AgentRegistryFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type AgentRegistryFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// AgentRegistrySession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type AgentRegistrySession struct { - Contract *AgentRegistry // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// AgentRegistryCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type AgentRegistryCallerSession struct { - Contract *AgentRegistryCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// AgentRegistryTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type AgentRegistryTransactorSession struct { - Contract *AgentRegistryTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// AgentRegistryRaw is an auto generated low-level Go binding around an Ethereum contract. -type AgentRegistryRaw struct { - Contract *AgentRegistry // Generic contract binding to access the raw methods on -} - -// AgentRegistryCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type AgentRegistryCallerRaw struct { - Contract *AgentRegistryCaller // Generic read-only contract binding to access the raw methods on -} - -// AgentRegistryTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type AgentRegistryTransactorRaw struct { - Contract *AgentRegistryTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewAgentRegistry creates a new instance of AgentRegistry, bound to a specific deployed contract. -func NewAgentRegistry(address common.Address, backend bind.ContractBackend) (*AgentRegistry, error) { - contract, err := bindAgentRegistry(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &AgentRegistry{AgentRegistryCaller: AgentRegistryCaller{contract: contract}, AgentRegistryTransactor: AgentRegistryTransactor{contract: contract}, AgentRegistryFilterer: AgentRegistryFilterer{contract: contract}}, nil -} - -// NewAgentRegistryCaller creates a new read-only instance of AgentRegistry, bound to a specific deployed contract. -func NewAgentRegistryCaller(address common.Address, caller bind.ContractCaller) (*AgentRegistryCaller, error) { - contract, err := bindAgentRegistry(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &AgentRegistryCaller{contract: contract}, nil -} - -// NewAgentRegistryTransactor creates a new write-only instance of AgentRegistry, bound to a specific deployed contract. -func NewAgentRegistryTransactor(address common.Address, transactor bind.ContractTransactor) (*AgentRegistryTransactor, error) { - contract, err := bindAgentRegistry(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &AgentRegistryTransactor{contract: contract}, nil -} - -// NewAgentRegistryFilterer creates a new log filterer instance of AgentRegistry, bound to a specific deployed contract. -func NewAgentRegistryFilterer(address common.Address, filterer bind.ContractFilterer) (*AgentRegistryFilterer, error) { - contract, err := bindAgentRegistry(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &AgentRegistryFilterer{contract: contract}, nil -} - -// bindAgentRegistry binds a generic wrapper to an already deployed contract. -func bindAgentRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := AgentRegistryMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_AgentRegistry *AgentRegistryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _AgentRegistry.Contract.AgentRegistryCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_AgentRegistry *AgentRegistryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _AgentRegistry.Contract.AgentRegistryTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_AgentRegistry *AgentRegistryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _AgentRegistry.Contract.AgentRegistryTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_AgentRegistry *AgentRegistryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _AgentRegistry.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_AgentRegistry *AgentRegistryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _AgentRegistry.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_AgentRegistry *AgentRegistryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _AgentRegistry.Contract.contract.Transact(opts, method, params...) -} - -// Exists is a free data retrieval call binding the contract method 0x38a699a4. -// -// Solidity: function exists(bytes32 id) view returns(bool) -func (_AgentRegistry *AgentRegistryCaller) Exists(opts *bind.CallOpts, id [32]byte) (bool, error) { - var out []interface{} - err := _AgentRegistry.contract.Call(opts, &out, "exists", id) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// Exists is a free data retrieval call binding the contract method 0x38a699a4. -// -// Solidity: function exists(bytes32 id) view returns(bool) -func (_AgentRegistry *AgentRegistrySession) Exists(id [32]byte) (bool, error) { - return _AgentRegistry.Contract.Exists(&_AgentRegistry.CallOpts, id) -} - -// Exists is a free data retrieval call binding the contract method 0x38a699a4. -// -// Solidity: function exists(bytes32 id) view returns(bool) -func (_AgentRegistry *AgentRegistryCallerSession) Exists(id [32]byte) (bool, error) { - return _AgentRegistry.Contract.Exists(&_AgentRegistry.CallOpts, id) -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint256,address,string,string[])[]) -func (_AgentRegistry *AgentRegistryCaller) GetAll(opts *bind.CallOpts) ([]AgentRegistryAgent, error) { - var out []interface{} - err := _AgentRegistry.contract.Call(opts, &out, "getAll") - - if err != nil { - return *new([]AgentRegistryAgent), err - } - - out0 := *abi.ConvertType(out[0], new([]AgentRegistryAgent)).(*[]AgentRegistryAgent) - - return out0, err - -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint256,address,string,string[])[]) -func (_AgentRegistry *AgentRegistrySession) GetAll() ([]AgentRegistryAgent, error) { - return _AgentRegistry.Contract.GetAll(&_AgentRegistry.CallOpts) -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns((bytes32,uint256,uint256,uint256,address,string,string[])[]) -func (_AgentRegistry *AgentRegistryCallerSession) GetAll() ([]AgentRegistryAgent, error) { - return _AgentRegistry.Contract.GetAll(&_AgentRegistry.CallOpts) -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(bytes32[]) -func (_AgentRegistry *AgentRegistryCaller) GetIds(opts *bind.CallOpts) ([][32]byte, error) { - var out []interface{} - err := _AgentRegistry.contract.Call(opts, &out, "getIds") - - if err != nil { - return *new([][32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([][32]byte)).(*[][32]byte) - - return out0, err - -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(bytes32[]) -func (_AgentRegistry *AgentRegistrySession) GetIds() ([][32]byte, error) { - return _AgentRegistry.Contract.GetIds(&_AgentRegistry.CallOpts) -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(bytes32[]) -func (_AgentRegistry *AgentRegistryCallerSession) GetIds() ([][32]byte, error) { - return _AgentRegistry.Contract.GetIds(&_AgentRegistry.CallOpts) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint256 timestamp, address owner, string name) -func (_AgentRegistry *AgentRegistryCaller) Map(opts *bind.CallOpts, arg0 [32]byte) (struct { - AgentId [32]byte - Fee *big.Int - Stake *big.Int - Timestamp *big.Int - Owner common.Address - Name string -}, error) { - var out []interface{} - err := _AgentRegistry.contract.Call(opts, &out, "map", arg0) - - outstruct := new(struct { - AgentId [32]byte - Fee *big.Int - Stake *big.Int - Timestamp *big.Int - Owner common.Address - Name string - }) - if err != nil { - return *outstruct, err - } - - outstruct.AgentId = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.Fee = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.Stake = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.Timestamp = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) - outstruct.Owner = *abi.ConvertType(out[4], new(common.Address)).(*common.Address) - outstruct.Name = *abi.ConvertType(out[5], new(string)).(*string) - - return *outstruct, err - -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint256 timestamp, address owner, string name) -func (_AgentRegistry *AgentRegistrySession) Map(arg0 [32]byte) (struct { - AgentId [32]byte - Fee *big.Int - Stake *big.Int - Timestamp *big.Int - Owner common.Address - Name string -}, error) { - return _AgentRegistry.Contract.Map(&_AgentRegistry.CallOpts, arg0) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(bytes32 agentId, uint256 fee, uint256 stake, uint256 timestamp, address owner, string name) -func (_AgentRegistry *AgentRegistryCallerSession) Map(arg0 [32]byte) (struct { - AgentId [32]byte - Fee *big.Int - Stake *big.Int - Timestamp *big.Int - Owner common.Address - Name string -}, error) { - return _AgentRegistry.Contract.Map(&_AgentRegistry.CallOpts, arg0) -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_AgentRegistry *AgentRegistryCaller) MinStake(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _AgentRegistry.contract.Call(opts, &out, "minStake") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_AgentRegistry *AgentRegistrySession) MinStake() (*big.Int, error) { - return _AgentRegistry.Contract.MinStake(&_AgentRegistry.CallOpts) -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_AgentRegistry *AgentRegistryCallerSession) MinStake() (*big.Int, error) { - return _AgentRegistry.Contract.MinStake(&_AgentRegistry.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_AgentRegistry *AgentRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _AgentRegistry.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_AgentRegistry *AgentRegistrySession) Owner() (common.Address, error) { - return _AgentRegistry.Contract.Owner(&_AgentRegistry.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_AgentRegistry *AgentRegistryCallerSession) Owner() (common.Address, error) { - return _AgentRegistry.Contract.Owner(&_AgentRegistry.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_AgentRegistry *AgentRegistryCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _AgentRegistry.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_AgentRegistry *AgentRegistrySession) Token() (common.Address, error) { - return _AgentRegistry.Contract.Token(&_AgentRegistry.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_AgentRegistry *AgentRegistryCallerSession) Token() (common.Address, error) { - return _AgentRegistry.Contract.Token(&_AgentRegistry.CallOpts) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_AgentRegistry *AgentRegistryTransactor) Deregister(opts *bind.TransactOpts, id [32]byte) (*types.Transaction, error) { - return _AgentRegistry.contract.Transact(opts, "deregister", id) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_AgentRegistry *AgentRegistrySession) Deregister(id [32]byte) (*types.Transaction, error) { - return _AgentRegistry.Contract.Deregister(&_AgentRegistry.TransactOpts, id) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_AgentRegistry *AgentRegistryTransactorSession) Deregister(id [32]byte) (*types.Transaction, error) { - return _AgentRegistry.Contract.Deregister(&_AgentRegistry.TransactOpts, id) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_AgentRegistry *AgentRegistryTransactor) Initialize(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { - return _AgentRegistry.contract.Transact(opts, "initialize", _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_AgentRegistry *AgentRegistrySession) Initialize(_token common.Address) (*types.Transaction, error) { - return _AgentRegistry.Contract.Initialize(&_AgentRegistry.TransactOpts, _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_AgentRegistry *AgentRegistryTransactorSession) Initialize(_token common.Address) (*types.Transaction, error) { - return _AgentRegistry.Contract.Initialize(&_AgentRegistry.TransactOpts, _token) -} - -// Register is a paid mutator transaction binding the contract method 0xcca4cb64. -// -// Solidity: function register(uint256 addStake, uint256 fee, address owner, bytes32 agentId, string name, string[] tags) returns() -func (_AgentRegistry *AgentRegistryTransactor) Register(opts *bind.TransactOpts, addStake *big.Int, fee *big.Int, owner common.Address, agentId [32]byte, name string, tags []string) (*types.Transaction, error) { - return _AgentRegistry.contract.Transact(opts, "register", addStake, fee, owner, agentId, name, tags) -} - -// Register is a paid mutator transaction binding the contract method 0xcca4cb64. -// -// Solidity: function register(uint256 addStake, uint256 fee, address owner, bytes32 agentId, string name, string[] tags) returns() -func (_AgentRegistry *AgentRegistrySession) Register(addStake *big.Int, fee *big.Int, owner common.Address, agentId [32]byte, name string, tags []string) (*types.Transaction, error) { - return _AgentRegistry.Contract.Register(&_AgentRegistry.TransactOpts, addStake, fee, owner, agentId, name, tags) -} - -// Register is a paid mutator transaction binding the contract method 0xcca4cb64. -// -// Solidity: function register(uint256 addStake, uint256 fee, address owner, bytes32 agentId, string name, string[] tags) returns() -func (_AgentRegistry *AgentRegistryTransactorSession) Register(addStake *big.Int, fee *big.Int, owner common.Address, agentId [32]byte, name string, tags []string) (*types.Transaction, error) { - return _AgentRegistry.Contract.Register(&_AgentRegistry.TransactOpts, addStake, fee, owner, agentId, name, tags) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_AgentRegistry *AgentRegistryTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _AgentRegistry.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_AgentRegistry *AgentRegistrySession) RenounceOwnership() (*types.Transaction, error) { - return _AgentRegistry.Contract.RenounceOwnership(&_AgentRegistry.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_AgentRegistry *AgentRegistryTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _AgentRegistry.Contract.RenounceOwnership(&_AgentRegistry.TransactOpts) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_AgentRegistry *AgentRegistryTransactor) SetMinStake(opts *bind.TransactOpts, _minStake *big.Int) (*types.Transaction, error) { - return _AgentRegistry.contract.Transact(opts, "setMinStake", _minStake) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_AgentRegistry *AgentRegistrySession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _AgentRegistry.Contract.SetMinStake(&_AgentRegistry.TransactOpts, _minStake) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_AgentRegistry *AgentRegistryTransactorSession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _AgentRegistry.Contract.SetMinStake(&_AgentRegistry.TransactOpts, _minStake) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_AgentRegistry *AgentRegistryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _AgentRegistry.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_AgentRegistry *AgentRegistrySession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _AgentRegistry.Contract.TransferOwnership(&_AgentRegistry.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_AgentRegistry *AgentRegistryTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _AgentRegistry.Contract.TransferOwnership(&_AgentRegistry.TransactOpts, newOwner) -} - -// AgentRegistryDeregisteredIterator is returned from FilterDeregistered and is used to iterate over the raw logs and unpacked data for Deregistered events raised by the AgentRegistry contract. -type AgentRegistryDeregisteredIterator struct { - Event *AgentRegistryDeregistered // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *AgentRegistryDeregisteredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(AgentRegistryDeregistered) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(AgentRegistryDeregistered) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *AgentRegistryDeregisteredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *AgentRegistryDeregisteredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// AgentRegistryDeregistered represents a Deregistered event raised by the AgentRegistry contract. -type AgentRegistryDeregistered struct { - Owner common.Address - AgentId [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterDeregistered is a free log retrieval operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. -// -// Solidity: event Deregistered(address indexed owner, bytes32 indexed agentId) -func (_AgentRegistry *AgentRegistryFilterer) FilterDeregistered(opts *bind.FilterOpts, owner []common.Address, agentId [][32]byte) (*AgentRegistryDeregisteredIterator, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var agentIdRule []interface{} - for _, agentIdItem := range agentId { - agentIdRule = append(agentIdRule, agentIdItem) - } - - logs, sub, err := _AgentRegistry.contract.FilterLogs(opts, "Deregistered", ownerRule, agentIdRule) - if err != nil { - return nil, err - } - return &AgentRegistryDeregisteredIterator{contract: _AgentRegistry.contract, event: "Deregistered", logs: logs, sub: sub}, nil -} - -// WatchDeregistered is a free log subscription operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. -// -// Solidity: event Deregistered(address indexed owner, bytes32 indexed agentId) -func (_AgentRegistry *AgentRegistryFilterer) WatchDeregistered(opts *bind.WatchOpts, sink chan<- *AgentRegistryDeregistered, owner []common.Address, agentId [][32]byte) (event.Subscription, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var agentIdRule []interface{} - for _, agentIdItem := range agentId { - agentIdRule = append(agentIdRule, agentIdItem) - } - - logs, sub, err := _AgentRegistry.contract.WatchLogs(opts, "Deregistered", ownerRule, agentIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(AgentRegistryDeregistered) - if err := _AgentRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseDeregistered is a log parse operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. -// -// Solidity: event Deregistered(address indexed owner, bytes32 indexed agentId) -func (_AgentRegistry *AgentRegistryFilterer) ParseDeregistered(log types.Log) (*AgentRegistryDeregistered, error) { - event := new(AgentRegistryDeregistered) - if err := _AgentRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// AgentRegistryInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the AgentRegistry contract. -type AgentRegistryInitializedIterator struct { - Event *AgentRegistryInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *AgentRegistryInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(AgentRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(AgentRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *AgentRegistryInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *AgentRegistryInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// AgentRegistryInitialized represents a Initialized event raised by the AgentRegistry contract. -type AgentRegistryInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_AgentRegistry *AgentRegistryFilterer) FilterInitialized(opts *bind.FilterOpts) (*AgentRegistryInitializedIterator, error) { - - logs, sub, err := _AgentRegistry.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &AgentRegistryInitializedIterator{contract: _AgentRegistry.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_AgentRegistry *AgentRegistryFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *AgentRegistryInitialized) (event.Subscription, error) { - - logs, sub, err := _AgentRegistry.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(AgentRegistryInitialized) - if err := _AgentRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_AgentRegistry *AgentRegistryFilterer) ParseInitialized(log types.Log) (*AgentRegistryInitialized, error) { - event := new(AgentRegistryInitialized) - if err := _AgentRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// AgentRegistryMinStakeUpdatedIterator is returned from FilterMinStakeUpdated and is used to iterate over the raw logs and unpacked data for MinStakeUpdated events raised by the AgentRegistry contract. -type AgentRegistryMinStakeUpdatedIterator struct { - Event *AgentRegistryMinStakeUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *AgentRegistryMinStakeUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(AgentRegistryMinStakeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(AgentRegistryMinStakeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *AgentRegistryMinStakeUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *AgentRegistryMinStakeUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// AgentRegistryMinStakeUpdated represents a MinStakeUpdated event raised by the AgentRegistry contract. -type AgentRegistryMinStakeUpdated struct { - NewStake *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMinStakeUpdated is a free log retrieval operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_AgentRegistry *AgentRegistryFilterer) FilterMinStakeUpdated(opts *bind.FilterOpts) (*AgentRegistryMinStakeUpdatedIterator, error) { - - logs, sub, err := _AgentRegistry.contract.FilterLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return &AgentRegistryMinStakeUpdatedIterator{contract: _AgentRegistry.contract, event: "MinStakeUpdated", logs: logs, sub: sub}, nil -} - -// WatchMinStakeUpdated is a free log subscription operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_AgentRegistry *AgentRegistryFilterer) WatchMinStakeUpdated(opts *bind.WatchOpts, sink chan<- *AgentRegistryMinStakeUpdated) (event.Subscription, error) { - - logs, sub, err := _AgentRegistry.contract.WatchLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(AgentRegistryMinStakeUpdated) - if err := _AgentRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMinStakeUpdated is a log parse operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_AgentRegistry *AgentRegistryFilterer) ParseMinStakeUpdated(log types.Log) (*AgentRegistryMinStakeUpdated, error) { - event := new(AgentRegistryMinStakeUpdated) - if err := _AgentRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// AgentRegistryOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the AgentRegistry contract. -type AgentRegistryOwnershipTransferredIterator struct { - Event *AgentRegistryOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *AgentRegistryOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(AgentRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(AgentRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *AgentRegistryOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *AgentRegistryOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// AgentRegistryOwnershipTransferred represents a OwnershipTransferred event raised by the AgentRegistry contract. -type AgentRegistryOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_AgentRegistry *AgentRegistryFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*AgentRegistryOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _AgentRegistry.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &AgentRegistryOwnershipTransferredIterator{contract: _AgentRegistry.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_AgentRegistry *AgentRegistryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *AgentRegistryOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _AgentRegistry.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(AgentRegistryOwnershipTransferred) - if err := _AgentRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_AgentRegistry *AgentRegistryFilterer) ParseOwnershipTransferred(log types.Log) (*AgentRegistryOwnershipTransferred, error) { - event := new(AgentRegistryOwnershipTransferred) - if err := _AgentRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// AgentRegistryRegisteredUpdatedIterator is returned from FilterRegisteredUpdated and is used to iterate over the raw logs and unpacked data for RegisteredUpdated events raised by the AgentRegistry contract. -type AgentRegistryRegisteredUpdatedIterator struct { - Event *AgentRegistryRegisteredUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *AgentRegistryRegisteredUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(AgentRegistryRegisteredUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(AgentRegistryRegisteredUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *AgentRegistryRegisteredUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *AgentRegistryRegisteredUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// AgentRegistryRegisteredUpdated represents a RegisteredUpdated event raised by the AgentRegistry contract. -type AgentRegistryRegisteredUpdated struct { - Owner common.Address - AgentId [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterRegisteredUpdated is a free log retrieval operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. -// -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed agentId) -func (_AgentRegistry *AgentRegistryFilterer) FilterRegisteredUpdated(opts *bind.FilterOpts, owner []common.Address, agentId [][32]byte) (*AgentRegistryRegisteredUpdatedIterator, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var agentIdRule []interface{} - for _, agentIdItem := range agentId { - agentIdRule = append(agentIdRule, agentIdItem) - } - - logs, sub, err := _AgentRegistry.contract.FilterLogs(opts, "RegisteredUpdated", ownerRule, agentIdRule) - if err != nil { - return nil, err - } - return &AgentRegistryRegisteredUpdatedIterator{contract: _AgentRegistry.contract, event: "RegisteredUpdated", logs: logs, sub: sub}, nil -} - -// WatchRegisteredUpdated is a free log subscription operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. -// -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed agentId) -func (_AgentRegistry *AgentRegistryFilterer) WatchRegisteredUpdated(opts *bind.WatchOpts, sink chan<- *AgentRegistryRegisteredUpdated, owner []common.Address, agentId [][32]byte) (event.Subscription, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var agentIdRule []interface{} - for _, agentIdItem := range agentId { - agentIdRule = append(agentIdRule, agentIdItem) - } - - logs, sub, err := _AgentRegistry.contract.WatchLogs(opts, "RegisteredUpdated", ownerRule, agentIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(AgentRegistryRegisteredUpdated) - if err := _AgentRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseRegisteredUpdated is a log parse operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. -// -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed agentId) -func (_AgentRegistry *AgentRegistryFilterer) ParseRegisteredUpdated(log types.Log) (*AgentRegistryRegisteredUpdated, error) { - event := new(AgentRegistryRegisteredUpdated) - if err := _AgentRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/smart-contracts/bindings/go/contracts/marketplace/Marketplace.go b/smart-contracts/bindings/go/contracts/marketplace/Marketplace.go deleted file mode 100644 index 28c8ad3b..00000000 --- a/smart-contracts/bindings/go/contracts/marketplace/Marketplace.go +++ /dev/null @@ -1,1474 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package marketplace - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// MarketplaceBid is an auto generated low-level Go binding around an user-defined struct. -type MarketplaceBid struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int -} - -// MarketplaceMetaData contains all meta data concerning the Marketplace contract. -var MarketplaceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"ActiveBidNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelOrAgentNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughWithdrawableBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"BidDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"BidPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"modelFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"agentFee\",\"type\":\"uint256\"}],\"name\":\"FeeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"agentBidFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"}],\"name\":\"deleteModelAgentBid\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"}],\"name\":\"getActiveBidsByModelAgent\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"internalType\":\"structMarketplace.Bid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"getActiveBidsByProvider\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"internalType\":\"structMarketplace.Bid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getBidsByModelAgent\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"internalType\":\"structMarketplace.Bid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"limit\",\"type\":\"uint8\"}],\"name\":\"getBidsByProvider\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"internalType\":\"structMarketplace.Bid[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"modelRegistryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"providerRegistryAddr\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deletedAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"modelBidFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"modelRegistry\",\"outputs\":[{\"internalType\":\"contractModelRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"providerAddr\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"postModelBid\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"providerModelAgentNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"providerRegistry\",\"outputs\":[{\"internalType\":\"contractProviderRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"modelFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"agentFee\",\"type\":\"uint256\"}],\"name\":\"setBidFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - -// MarketplaceABI is the input ABI used to generate the binding from. -// Deprecated: Use MarketplaceMetaData.ABI instead. -var MarketplaceABI = MarketplaceMetaData.ABI - -// Marketplace is an auto generated Go binding around an Ethereum contract. -type Marketplace struct { - MarketplaceCaller // Read-only binding to the contract - MarketplaceTransactor // Write-only binding to the contract - MarketplaceFilterer // Log filterer for contract events -} - -// MarketplaceCaller is an auto generated read-only Go binding around an Ethereum contract. -type MarketplaceCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// MarketplaceTransactor is an auto generated write-only Go binding around an Ethereum contract. -type MarketplaceTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// MarketplaceFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type MarketplaceFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// MarketplaceSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type MarketplaceSession struct { - Contract *Marketplace // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// MarketplaceCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type MarketplaceCallerSession struct { - Contract *MarketplaceCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// MarketplaceTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type MarketplaceTransactorSession struct { - Contract *MarketplaceTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// MarketplaceRaw is an auto generated low-level Go binding around an Ethereum contract. -type MarketplaceRaw struct { - Contract *Marketplace // Generic contract binding to access the raw methods on -} - -// MarketplaceCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type MarketplaceCallerRaw struct { - Contract *MarketplaceCaller // Generic read-only contract binding to access the raw methods on -} - -// MarketplaceTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type MarketplaceTransactorRaw struct { - Contract *MarketplaceTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewMarketplace creates a new instance of Marketplace, bound to a specific deployed contract. -func NewMarketplace(address common.Address, backend bind.ContractBackend) (*Marketplace, error) { - contract, err := bindMarketplace(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Marketplace{MarketplaceCaller: MarketplaceCaller{contract: contract}, MarketplaceTransactor: MarketplaceTransactor{contract: contract}, MarketplaceFilterer: MarketplaceFilterer{contract: contract}}, nil -} - -// NewMarketplaceCaller creates a new read-only instance of Marketplace, bound to a specific deployed contract. -func NewMarketplaceCaller(address common.Address, caller bind.ContractCaller) (*MarketplaceCaller, error) { - contract, err := bindMarketplace(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &MarketplaceCaller{contract: contract}, nil -} - -// NewMarketplaceTransactor creates a new write-only instance of Marketplace, bound to a specific deployed contract. -func NewMarketplaceTransactor(address common.Address, transactor bind.ContractTransactor) (*MarketplaceTransactor, error) { - contract, err := bindMarketplace(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &MarketplaceTransactor{contract: contract}, nil -} - -// NewMarketplaceFilterer creates a new log filterer instance of Marketplace, bound to a specific deployed contract. -func NewMarketplaceFilterer(address common.Address, filterer bind.ContractFilterer) (*MarketplaceFilterer, error) { - contract, err := bindMarketplace(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &MarketplaceFilterer{contract: contract}, nil -} - -// bindMarketplace binds a generic wrapper to an already deployed contract. -func bindMarketplace(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := MarketplaceMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Marketplace *MarketplaceRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Marketplace.Contract.MarketplaceCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Marketplace *MarketplaceRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Marketplace.Contract.MarketplaceTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Marketplace *MarketplaceRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Marketplace.Contract.MarketplaceTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Marketplace *MarketplaceCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Marketplace.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Marketplace *MarketplaceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Marketplace.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Marketplace *MarketplaceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Marketplace.Contract.contract.Transact(opts, method, params...) -} - -// AgentBidFee is a free data retrieval call binding the contract method 0x113d91c9. -// -// Solidity: function agentBidFee() view returns(uint256) -func (_Marketplace *MarketplaceCaller) AgentBidFee(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "agentBidFee") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// AgentBidFee is a free data retrieval call binding the contract method 0x113d91c9. -// -// Solidity: function agentBidFee() view returns(uint256) -func (_Marketplace *MarketplaceSession) AgentBidFee() (*big.Int, error) { - return _Marketplace.Contract.AgentBidFee(&_Marketplace.CallOpts) -} - -// AgentBidFee is a free data retrieval call binding the contract method 0x113d91c9. -// -// Solidity: function agentBidFee() view returns(uint256) -func (_Marketplace *MarketplaceCallerSession) AgentBidFee() (*big.Int, error) { - return _Marketplace.Contract.AgentBidFee(&_Marketplace.CallOpts) -} - -// GetActiveBidsByModelAgent is a free data retrieval call binding the contract method 0x873d94d5. -// -// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCaller) GetActiveBidsByModelAgent(opts *bind.CallOpts, modelAgentId [32]byte) ([]MarketplaceBid, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "getActiveBidsByModelAgent", modelAgentId) - - if err != nil { - return *new([]MarketplaceBid), err - } - - out0 := *abi.ConvertType(out[0], new([]MarketplaceBid)).(*[]MarketplaceBid) - - return out0, err - -} - -// GetActiveBidsByModelAgent is a free data retrieval call binding the contract method 0x873d94d5. -// -// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceSession) GetActiveBidsByModelAgent(modelAgentId [32]byte) ([]MarketplaceBid, error) { - return _Marketplace.Contract.GetActiveBidsByModelAgent(&_Marketplace.CallOpts, modelAgentId) -} - -// GetActiveBidsByModelAgent is a free data retrieval call binding the contract method 0x873d94d5. -// -// Solidity: function getActiveBidsByModelAgent(bytes32 modelAgentId) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCallerSession) GetActiveBidsByModelAgent(modelAgentId [32]byte) ([]MarketplaceBid, error) { - return _Marketplace.Contract.GetActiveBidsByModelAgent(&_Marketplace.CallOpts, modelAgentId) -} - -// GetActiveBidsByProvider is a free data retrieval call binding the contract method 0x9fdaffd0. -// -// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCaller) GetActiveBidsByProvider(opts *bind.CallOpts, provider common.Address) ([]MarketplaceBid, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "getActiveBidsByProvider", provider) - - if err != nil { - return *new([]MarketplaceBid), err - } - - out0 := *abi.ConvertType(out[0], new([]MarketplaceBid)).(*[]MarketplaceBid) - - return out0, err - -} - -// GetActiveBidsByProvider is a free data retrieval call binding the contract method 0x9fdaffd0. -// -// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceSession) GetActiveBidsByProvider(provider common.Address) ([]MarketplaceBid, error) { - return _Marketplace.Contract.GetActiveBidsByProvider(&_Marketplace.CallOpts, provider) -} - -// GetActiveBidsByProvider is a free data retrieval call binding the contract method 0x9fdaffd0. -// -// Solidity: function getActiveBidsByProvider(address provider) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCallerSession) GetActiveBidsByProvider(provider common.Address) ([]MarketplaceBid, error) { - return _Marketplace.Contract.GetActiveBidsByProvider(&_Marketplace.CallOpts, provider) -} - -// GetBidsByModelAgent is a free data retrieval call binding the contract method 0xa87665ec. -// -// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCaller) GetBidsByModelAgent(opts *bind.CallOpts, modelAgentId [32]byte, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "getBidsByModelAgent", modelAgentId, offset, limit) - - if err != nil { - return *new([]MarketplaceBid), err - } - - out0 := *abi.ConvertType(out[0], new([]MarketplaceBid)).(*[]MarketplaceBid) - - return out0, err - -} - -// GetBidsByModelAgent is a free data retrieval call binding the contract method 0xa87665ec. -// -// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceSession) GetBidsByModelAgent(modelAgentId [32]byte, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { - return _Marketplace.Contract.GetBidsByModelAgent(&_Marketplace.CallOpts, modelAgentId, offset, limit) -} - -// GetBidsByModelAgent is a free data retrieval call binding the contract method 0xa87665ec. -// -// Solidity: function getBidsByModelAgent(bytes32 modelAgentId, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCallerSession) GetBidsByModelAgent(modelAgentId [32]byte, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { - return _Marketplace.Contract.GetBidsByModelAgent(&_Marketplace.CallOpts, modelAgentId, offset, limit) -} - -// GetBidsByProvider is a free data retrieval call binding the contract method 0x2f817685. -// -// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCaller) GetBidsByProvider(opts *bind.CallOpts, provider common.Address, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "getBidsByProvider", provider, offset, limit) - - if err != nil { - return *new([]MarketplaceBid), err - } - - out0 := *abi.ConvertType(out[0], new([]MarketplaceBid)).(*[]MarketplaceBid) - - return out0, err - -} - -// GetBidsByProvider is a free data retrieval call binding the contract method 0x2f817685. -// -// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceSession) GetBidsByProvider(provider common.Address, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { - return _Marketplace.Contract.GetBidsByProvider(&_Marketplace.CallOpts, provider, offset, limit) -} - -// GetBidsByProvider is a free data retrieval call binding the contract method 0x2f817685. -// -// Solidity: function getBidsByProvider(address provider, uint256 offset, uint8 limit) view returns((address,bytes32,uint256,uint256,uint256,uint256)[]) -func (_Marketplace *MarketplaceCallerSession) GetBidsByProvider(provider common.Address, offset *big.Int, limit uint8) ([]MarketplaceBid, error) { - return _Marketplace.Contract.GetBidsByProvider(&_Marketplace.CallOpts, provider, offset, limit) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(address provider, bytes32 modelAgentId, uint256 amount, uint256 nonce, uint256 createdAt, uint256 deletedAt) -func (_Marketplace *MarketplaceCaller) Map(opts *bind.CallOpts, arg0 [32]byte) (struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int -}, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "map", arg0) - - outstruct := new(struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Provider = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - outstruct.ModelAgentId = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) - outstruct.Amount = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.Nonce = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) - outstruct.CreatedAt = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) - outstruct.DeletedAt = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(address provider, bytes32 modelAgentId, uint256 amount, uint256 nonce, uint256 createdAt, uint256 deletedAt) -func (_Marketplace *MarketplaceSession) Map(arg0 [32]byte) (struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int -}, error) { - return _Marketplace.Contract.Map(&_Marketplace.CallOpts, arg0) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(address provider, bytes32 modelAgentId, uint256 amount, uint256 nonce, uint256 createdAt, uint256 deletedAt) -func (_Marketplace *MarketplaceCallerSession) Map(arg0 [32]byte) (struct { - Provider common.Address - ModelAgentId [32]byte - Amount *big.Int - Nonce *big.Int - CreatedAt *big.Int - DeletedAt *big.Int -}, error) { - return _Marketplace.Contract.Map(&_Marketplace.CallOpts, arg0) -} - -// ModelBidFee is a free data retrieval call binding the contract method 0x7c785e73. -// -// Solidity: function modelBidFee() view returns(uint256) -func (_Marketplace *MarketplaceCaller) ModelBidFee(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "modelBidFee") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// ModelBidFee is a free data retrieval call binding the contract method 0x7c785e73. -// -// Solidity: function modelBidFee() view returns(uint256) -func (_Marketplace *MarketplaceSession) ModelBidFee() (*big.Int, error) { - return _Marketplace.Contract.ModelBidFee(&_Marketplace.CallOpts) -} - -// ModelBidFee is a free data retrieval call binding the contract method 0x7c785e73. -// -// Solidity: function modelBidFee() view returns(uint256) -func (_Marketplace *MarketplaceCallerSession) ModelBidFee() (*big.Int, error) { - return _Marketplace.Contract.ModelBidFee(&_Marketplace.CallOpts) -} - -// ModelRegistry is a free data retrieval call binding the contract method 0x2ba36f78. -// -// Solidity: function modelRegistry() view returns(address) -func (_Marketplace *MarketplaceCaller) ModelRegistry(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "modelRegistry") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// ModelRegistry is a free data retrieval call binding the contract method 0x2ba36f78. -// -// Solidity: function modelRegistry() view returns(address) -func (_Marketplace *MarketplaceSession) ModelRegistry() (common.Address, error) { - return _Marketplace.Contract.ModelRegistry(&_Marketplace.CallOpts) -} - -// ModelRegistry is a free data retrieval call binding the contract method 0x2ba36f78. -// -// Solidity: function modelRegistry() view returns(address) -func (_Marketplace *MarketplaceCallerSession) ModelRegistry() (common.Address, error) { - return _Marketplace.Contract.ModelRegistry(&_Marketplace.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Marketplace *MarketplaceCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Marketplace *MarketplaceSession) Owner() (common.Address, error) { - return _Marketplace.Contract.Owner(&_Marketplace.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Marketplace *MarketplaceCallerSession) Owner() (common.Address, error) { - return _Marketplace.Contract.Owner(&_Marketplace.CallOpts) -} - -// ProviderModelAgentNonce is a free data retrieval call binding the contract method 0x93ec6bc5. -// -// Solidity: function providerModelAgentNonce(bytes32 ) view returns(uint256) -func (_Marketplace *MarketplaceCaller) ProviderModelAgentNonce(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "providerModelAgentNonce", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// ProviderModelAgentNonce is a free data retrieval call binding the contract method 0x93ec6bc5. -// -// Solidity: function providerModelAgentNonce(bytes32 ) view returns(uint256) -func (_Marketplace *MarketplaceSession) ProviderModelAgentNonce(arg0 [32]byte) (*big.Int, error) { - return _Marketplace.Contract.ProviderModelAgentNonce(&_Marketplace.CallOpts, arg0) -} - -// ProviderModelAgentNonce is a free data retrieval call binding the contract method 0x93ec6bc5. -// -// Solidity: function providerModelAgentNonce(bytes32 ) view returns(uint256) -func (_Marketplace *MarketplaceCallerSession) ProviderModelAgentNonce(arg0 [32]byte) (*big.Int, error) { - return _Marketplace.Contract.ProviderModelAgentNonce(&_Marketplace.CallOpts, arg0) -} - -// ProviderRegistry is a free data retrieval call binding the contract method 0x545921d9. -// -// Solidity: function providerRegistry() view returns(address) -func (_Marketplace *MarketplaceCaller) ProviderRegistry(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "providerRegistry") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// ProviderRegistry is a free data retrieval call binding the contract method 0x545921d9. -// -// Solidity: function providerRegistry() view returns(address) -func (_Marketplace *MarketplaceSession) ProviderRegistry() (common.Address, error) { - return _Marketplace.Contract.ProviderRegistry(&_Marketplace.CallOpts) -} - -// ProviderRegistry is a free data retrieval call binding the contract method 0x545921d9. -// -// Solidity: function providerRegistry() view returns(address) -func (_Marketplace *MarketplaceCallerSession) ProviderRegistry() (common.Address, error) { - return _Marketplace.Contract.ProviderRegistry(&_Marketplace.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_Marketplace *MarketplaceCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Marketplace.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_Marketplace *MarketplaceSession) Token() (common.Address, error) { - return _Marketplace.Contract.Token(&_Marketplace.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_Marketplace *MarketplaceCallerSession) Token() (common.Address, error) { - return _Marketplace.Contract.Token(&_Marketplace.CallOpts) -} - -// DeleteModelAgentBid is a paid mutator transaction binding the contract method 0x42856b75. -// -// Solidity: function deleteModelAgentBid(bytes32 bidId) returns() -func (_Marketplace *MarketplaceTransactor) DeleteModelAgentBid(opts *bind.TransactOpts, bidId [32]byte) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "deleteModelAgentBid", bidId) -} - -// DeleteModelAgentBid is a paid mutator transaction binding the contract method 0x42856b75. -// -// Solidity: function deleteModelAgentBid(bytes32 bidId) returns() -func (_Marketplace *MarketplaceSession) DeleteModelAgentBid(bidId [32]byte) (*types.Transaction, error) { - return _Marketplace.Contract.DeleteModelAgentBid(&_Marketplace.TransactOpts, bidId) -} - -// DeleteModelAgentBid is a paid mutator transaction binding the contract method 0x42856b75. -// -// Solidity: function deleteModelAgentBid(bytes32 bidId) returns() -func (_Marketplace *MarketplaceTransactorSession) DeleteModelAgentBid(bidId [32]byte) (*types.Transaction, error) { - return _Marketplace.Contract.DeleteModelAgentBid(&_Marketplace.TransactOpts, bidId) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address modelRegistryAddr, address providerRegistryAddr) returns() -func (_Marketplace *MarketplaceTransactor) Initialize(opts *bind.TransactOpts, _token common.Address, modelRegistryAddr common.Address, providerRegistryAddr common.Address) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "initialize", _token, modelRegistryAddr, providerRegistryAddr) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address modelRegistryAddr, address providerRegistryAddr) returns() -func (_Marketplace *MarketplaceSession) Initialize(_token common.Address, modelRegistryAddr common.Address, providerRegistryAddr common.Address) (*types.Transaction, error) { - return _Marketplace.Contract.Initialize(&_Marketplace.TransactOpts, _token, modelRegistryAddr, providerRegistryAddr) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address modelRegistryAddr, address providerRegistryAddr) returns() -func (_Marketplace *MarketplaceTransactorSession) Initialize(_token common.Address, modelRegistryAddr common.Address, providerRegistryAddr common.Address) (*types.Transaction, error) { - return _Marketplace.Contract.Initialize(&_Marketplace.TransactOpts, _token, modelRegistryAddr, providerRegistryAddr) -} - -// PostModelBid is a paid mutator transaction binding the contract method 0xede96bb1. -// -// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 amount) returns(bytes32 bidId) -func (_Marketplace *MarketplaceTransactor) PostModelBid(opts *bind.TransactOpts, providerAddr common.Address, modelId [32]byte, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "postModelBid", providerAddr, modelId, amount) -} - -// PostModelBid is a paid mutator transaction binding the contract method 0xede96bb1. -// -// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 amount) returns(bytes32 bidId) -func (_Marketplace *MarketplaceSession) PostModelBid(providerAddr common.Address, modelId [32]byte, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.PostModelBid(&_Marketplace.TransactOpts, providerAddr, modelId, amount) -} - -// PostModelBid is a paid mutator transaction binding the contract method 0xede96bb1. -// -// Solidity: function postModelBid(address providerAddr, bytes32 modelId, uint256 amount) returns(bytes32 bidId) -func (_Marketplace *MarketplaceTransactorSession) PostModelBid(providerAddr common.Address, modelId [32]byte, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.PostModelBid(&_Marketplace.TransactOpts, providerAddr, modelId, amount) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_Marketplace *MarketplaceTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_Marketplace *MarketplaceSession) RenounceOwnership() (*types.Transaction, error) { - return _Marketplace.Contract.RenounceOwnership(&_Marketplace.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_Marketplace *MarketplaceTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _Marketplace.Contract.RenounceOwnership(&_Marketplace.TransactOpts) -} - -// SetBidFee is a paid mutator transaction binding the contract method 0xcef0b7f4. -// -// Solidity: function setBidFee(uint256 modelFee, uint256 agentFee) returns() -func (_Marketplace *MarketplaceTransactor) SetBidFee(opts *bind.TransactOpts, modelFee *big.Int, agentFee *big.Int) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "setBidFee", modelFee, agentFee) -} - -// SetBidFee is a paid mutator transaction binding the contract method 0xcef0b7f4. -// -// Solidity: function setBidFee(uint256 modelFee, uint256 agentFee) returns() -func (_Marketplace *MarketplaceSession) SetBidFee(modelFee *big.Int, agentFee *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.SetBidFee(&_Marketplace.TransactOpts, modelFee, agentFee) -} - -// SetBidFee is a paid mutator transaction binding the contract method 0xcef0b7f4. -// -// Solidity: function setBidFee(uint256 modelFee, uint256 agentFee) returns() -func (_Marketplace *MarketplaceTransactorSession) SetBidFee(modelFee *big.Int, agentFee *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.SetBidFee(&_Marketplace.TransactOpts, modelFee, agentFee) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_Marketplace *MarketplaceTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_Marketplace *MarketplaceSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _Marketplace.Contract.TransferOwnership(&_Marketplace.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_Marketplace *MarketplaceTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _Marketplace.Contract.TransferOwnership(&_Marketplace.TransactOpts, newOwner) -} - -// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. -// -// Solidity: function withdraw(address addr, uint256 amount) returns() -func (_Marketplace *MarketplaceTransactor) Withdraw(opts *bind.TransactOpts, addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.contract.Transact(opts, "withdraw", addr, amount) -} - -// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. -// -// Solidity: function withdraw(address addr, uint256 amount) returns() -func (_Marketplace *MarketplaceSession) Withdraw(addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.Withdraw(&_Marketplace.TransactOpts, addr, amount) -} - -// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. -// -// Solidity: function withdraw(address addr, uint256 amount) returns() -func (_Marketplace *MarketplaceTransactorSession) Withdraw(addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Marketplace.Contract.Withdraw(&_Marketplace.TransactOpts, addr, amount) -} - -// MarketplaceBidDeletedIterator is returned from FilterBidDeleted and is used to iterate over the raw logs and unpacked data for BidDeleted events raised by the Marketplace contract. -type MarketplaceBidDeletedIterator struct { - Event *MarketplaceBidDeleted // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *MarketplaceBidDeletedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(MarketplaceBidDeleted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(MarketplaceBidDeleted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *MarketplaceBidDeletedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *MarketplaceBidDeletedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// MarketplaceBidDeleted represents a BidDeleted event raised by the Marketplace contract. -type MarketplaceBidDeleted struct { - Provider common.Address - ModelAgentId [32]byte - Nonce *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBidDeleted is a free log retrieval operation binding the contract event 0x096f970f504563bca8ac4419b4299946965221e396c34aea149ac84947b9242f. -// -// Solidity: event BidDeleted(address indexed provider, bytes32 indexed modelAgentId, uint256 nonce) -func (_Marketplace *MarketplaceFilterer) FilterBidDeleted(opts *bind.FilterOpts, provider []common.Address, modelAgentId [][32]byte) (*MarketplaceBidDeletedIterator, error) { - - var providerRule []interface{} - for _, providerItem := range provider { - providerRule = append(providerRule, providerItem) - } - var modelAgentIdRule []interface{} - for _, modelAgentIdItem := range modelAgentId { - modelAgentIdRule = append(modelAgentIdRule, modelAgentIdItem) - } - - logs, sub, err := _Marketplace.contract.FilterLogs(opts, "BidDeleted", providerRule, modelAgentIdRule) - if err != nil { - return nil, err - } - return &MarketplaceBidDeletedIterator{contract: _Marketplace.contract, event: "BidDeleted", logs: logs, sub: sub}, nil -} - -// WatchBidDeleted is a free log subscription operation binding the contract event 0x096f970f504563bca8ac4419b4299946965221e396c34aea149ac84947b9242f. -// -// Solidity: event BidDeleted(address indexed provider, bytes32 indexed modelAgentId, uint256 nonce) -func (_Marketplace *MarketplaceFilterer) WatchBidDeleted(opts *bind.WatchOpts, sink chan<- *MarketplaceBidDeleted, provider []common.Address, modelAgentId [][32]byte) (event.Subscription, error) { - - var providerRule []interface{} - for _, providerItem := range provider { - providerRule = append(providerRule, providerItem) - } - var modelAgentIdRule []interface{} - for _, modelAgentIdItem := range modelAgentId { - modelAgentIdRule = append(modelAgentIdRule, modelAgentIdItem) - } - - logs, sub, err := _Marketplace.contract.WatchLogs(opts, "BidDeleted", providerRule, modelAgentIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(MarketplaceBidDeleted) - if err := _Marketplace.contract.UnpackLog(event, "BidDeleted", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBidDeleted is a log parse operation binding the contract event 0x096f970f504563bca8ac4419b4299946965221e396c34aea149ac84947b9242f. -// -// Solidity: event BidDeleted(address indexed provider, bytes32 indexed modelAgentId, uint256 nonce) -func (_Marketplace *MarketplaceFilterer) ParseBidDeleted(log types.Log) (*MarketplaceBidDeleted, error) { - event := new(MarketplaceBidDeleted) - if err := _Marketplace.contract.UnpackLog(event, "BidDeleted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// MarketplaceBidPostedIterator is returned from FilterBidPosted and is used to iterate over the raw logs and unpacked data for BidPosted events raised by the Marketplace contract. -type MarketplaceBidPostedIterator struct { - Event *MarketplaceBidPosted // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *MarketplaceBidPostedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(MarketplaceBidPosted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(MarketplaceBidPosted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *MarketplaceBidPostedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *MarketplaceBidPostedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// MarketplaceBidPosted represents a BidPosted event raised by the Marketplace contract. -type MarketplaceBidPosted struct { - Provider common.Address - ModelAgentId [32]byte - Nonce *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBidPosted is a free log retrieval operation binding the contract event 0xd138adff73af2621d26114cd9ee4f20dcd39ed78f9e0004215ed49aa22753ebe. -// -// Solidity: event BidPosted(address indexed provider, bytes32 indexed modelAgentId, uint256 nonce) -func (_Marketplace *MarketplaceFilterer) FilterBidPosted(opts *bind.FilterOpts, provider []common.Address, modelAgentId [][32]byte) (*MarketplaceBidPostedIterator, error) { - - var providerRule []interface{} - for _, providerItem := range provider { - providerRule = append(providerRule, providerItem) - } - var modelAgentIdRule []interface{} - for _, modelAgentIdItem := range modelAgentId { - modelAgentIdRule = append(modelAgentIdRule, modelAgentIdItem) - } - - logs, sub, err := _Marketplace.contract.FilterLogs(opts, "BidPosted", providerRule, modelAgentIdRule) - if err != nil { - return nil, err - } - return &MarketplaceBidPostedIterator{contract: _Marketplace.contract, event: "BidPosted", logs: logs, sub: sub}, nil -} - -// WatchBidPosted is a free log subscription operation binding the contract event 0xd138adff73af2621d26114cd9ee4f20dcd39ed78f9e0004215ed49aa22753ebe. -// -// Solidity: event BidPosted(address indexed provider, bytes32 indexed modelAgentId, uint256 nonce) -func (_Marketplace *MarketplaceFilterer) WatchBidPosted(opts *bind.WatchOpts, sink chan<- *MarketplaceBidPosted, provider []common.Address, modelAgentId [][32]byte) (event.Subscription, error) { - - var providerRule []interface{} - for _, providerItem := range provider { - providerRule = append(providerRule, providerItem) - } - var modelAgentIdRule []interface{} - for _, modelAgentIdItem := range modelAgentId { - modelAgentIdRule = append(modelAgentIdRule, modelAgentIdItem) - } - - logs, sub, err := _Marketplace.contract.WatchLogs(opts, "BidPosted", providerRule, modelAgentIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(MarketplaceBidPosted) - if err := _Marketplace.contract.UnpackLog(event, "BidPosted", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBidPosted is a log parse operation binding the contract event 0xd138adff73af2621d26114cd9ee4f20dcd39ed78f9e0004215ed49aa22753ebe. -// -// Solidity: event BidPosted(address indexed provider, bytes32 indexed modelAgentId, uint256 nonce) -func (_Marketplace *MarketplaceFilterer) ParseBidPosted(log types.Log) (*MarketplaceBidPosted, error) { - event := new(MarketplaceBidPosted) - if err := _Marketplace.contract.UnpackLog(event, "BidPosted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// MarketplaceFeeUpdatedIterator is returned from FilterFeeUpdated and is used to iterate over the raw logs and unpacked data for FeeUpdated events raised by the Marketplace contract. -type MarketplaceFeeUpdatedIterator struct { - Event *MarketplaceFeeUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *MarketplaceFeeUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(MarketplaceFeeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(MarketplaceFeeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *MarketplaceFeeUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *MarketplaceFeeUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// MarketplaceFeeUpdated represents a FeeUpdated event raised by the Marketplace contract. -type MarketplaceFeeUpdated struct { - ModelFee *big.Int - AgentFee *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterFeeUpdated is a free log retrieval operation binding the contract event 0x528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302. -// -// Solidity: event FeeUpdated(uint256 modelFee, uint256 agentFee) -func (_Marketplace *MarketplaceFilterer) FilterFeeUpdated(opts *bind.FilterOpts) (*MarketplaceFeeUpdatedIterator, error) { - - logs, sub, err := _Marketplace.contract.FilterLogs(opts, "FeeUpdated") - if err != nil { - return nil, err - } - return &MarketplaceFeeUpdatedIterator{contract: _Marketplace.contract, event: "FeeUpdated", logs: logs, sub: sub}, nil -} - -// WatchFeeUpdated is a free log subscription operation binding the contract event 0x528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302. -// -// Solidity: event FeeUpdated(uint256 modelFee, uint256 agentFee) -func (_Marketplace *MarketplaceFilterer) WatchFeeUpdated(opts *bind.WatchOpts, sink chan<- *MarketplaceFeeUpdated) (event.Subscription, error) { - - logs, sub, err := _Marketplace.contract.WatchLogs(opts, "FeeUpdated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(MarketplaceFeeUpdated) - if err := _Marketplace.contract.UnpackLog(event, "FeeUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseFeeUpdated is a log parse operation binding the contract event 0x528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302. -// -// Solidity: event FeeUpdated(uint256 modelFee, uint256 agentFee) -func (_Marketplace *MarketplaceFilterer) ParseFeeUpdated(log types.Log) (*MarketplaceFeeUpdated, error) { - event := new(MarketplaceFeeUpdated) - if err := _Marketplace.contract.UnpackLog(event, "FeeUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// MarketplaceInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the Marketplace contract. -type MarketplaceInitializedIterator struct { - Event *MarketplaceInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *MarketplaceInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(MarketplaceInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(MarketplaceInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *MarketplaceInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *MarketplaceInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// MarketplaceInitialized represents a Initialized event raised by the Marketplace contract. -type MarketplaceInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_Marketplace *MarketplaceFilterer) FilterInitialized(opts *bind.FilterOpts) (*MarketplaceInitializedIterator, error) { - - logs, sub, err := _Marketplace.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &MarketplaceInitializedIterator{contract: _Marketplace.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_Marketplace *MarketplaceFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *MarketplaceInitialized) (event.Subscription, error) { - - logs, sub, err := _Marketplace.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(MarketplaceInitialized) - if err := _Marketplace.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_Marketplace *MarketplaceFilterer) ParseInitialized(log types.Log) (*MarketplaceInitialized, error) { - event := new(MarketplaceInitialized) - if err := _Marketplace.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// MarketplaceOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Marketplace contract. -type MarketplaceOwnershipTransferredIterator struct { - Event *MarketplaceOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *MarketplaceOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(MarketplaceOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(MarketplaceOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *MarketplaceOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *MarketplaceOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// MarketplaceOwnershipTransferred represents a OwnershipTransferred event raised by the Marketplace contract. -type MarketplaceOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_Marketplace *MarketplaceFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*MarketplaceOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _Marketplace.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &MarketplaceOwnershipTransferredIterator{contract: _Marketplace.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_Marketplace *MarketplaceFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *MarketplaceOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _Marketplace.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(MarketplaceOwnershipTransferred) - if err := _Marketplace.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_Marketplace *MarketplaceFilterer) ParseOwnershipTransferred(log types.Log) (*MarketplaceOwnershipTransferred, error) { - event := new(MarketplaceOwnershipTransferred) - if err := _Marketplace.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/smart-contracts/bindings/go/contracts/modelregistry/ModelRegistry.go b/smart-contracts/bindings/go/contracts/modelregistry/ModelRegistry.go deleted file mode 100644 index 50b23bed..00000000 --- a/smart-contracts/bindings/go/contracts/modelregistry/ModelRegistry.go +++ /dev/null @@ -1,1409 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package modelregistry - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// ModelRegistryModel is an auto generated low-level Go binding around an user-defined struct. -type ModelRegistryModel struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Tags []string - Timestamp *big.Int - IsDeleted bool -} - -// ModelRegistryMetaData contains all meta data concerning the ModelRegistry contract. -var ModelRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ModelNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"}],\"name\":\"Deregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"MinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"}],\"name\":\"RegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"deregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAll\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structModelRegistry.Model[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getByIndex\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structModelRegistry.Model\",\"name\":\"model\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getIds\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"models\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"modelId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsCID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"tags\",\"type\":\"string[]\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"setMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - -// ModelRegistryABI is the input ABI used to generate the binding from. -// Deprecated: Use ModelRegistryMetaData.ABI instead. -var ModelRegistryABI = ModelRegistryMetaData.ABI - -// ModelRegistry is an auto generated Go binding around an Ethereum contract. -type ModelRegistry struct { - ModelRegistryCaller // Read-only binding to the contract - ModelRegistryTransactor // Write-only binding to the contract - ModelRegistryFilterer // Log filterer for contract events -} - -// ModelRegistryCaller is an auto generated read-only Go binding around an Ethereum contract. -type ModelRegistryCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ModelRegistryTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ModelRegistryTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ModelRegistryFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ModelRegistryFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ModelRegistrySession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ModelRegistrySession struct { - Contract *ModelRegistry // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ModelRegistryCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ModelRegistryCallerSession struct { - Contract *ModelRegistryCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ModelRegistryTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ModelRegistryTransactorSession struct { - Contract *ModelRegistryTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ModelRegistryRaw is an auto generated low-level Go binding around an Ethereum contract. -type ModelRegistryRaw struct { - Contract *ModelRegistry // Generic contract binding to access the raw methods on -} - -// ModelRegistryCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ModelRegistryCallerRaw struct { - Contract *ModelRegistryCaller // Generic read-only contract binding to access the raw methods on -} - -// ModelRegistryTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ModelRegistryTransactorRaw struct { - Contract *ModelRegistryTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewModelRegistry creates a new instance of ModelRegistry, bound to a specific deployed contract. -func NewModelRegistry(address common.Address, backend bind.ContractBackend) (*ModelRegistry, error) { - contract, err := bindModelRegistry(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &ModelRegistry{ModelRegistryCaller: ModelRegistryCaller{contract: contract}, ModelRegistryTransactor: ModelRegistryTransactor{contract: contract}, ModelRegistryFilterer: ModelRegistryFilterer{contract: contract}}, nil -} - -// NewModelRegistryCaller creates a new read-only instance of ModelRegistry, bound to a specific deployed contract. -func NewModelRegistryCaller(address common.Address, caller bind.ContractCaller) (*ModelRegistryCaller, error) { - contract, err := bindModelRegistry(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &ModelRegistryCaller{contract: contract}, nil -} - -// NewModelRegistryTransactor creates a new write-only instance of ModelRegistry, bound to a specific deployed contract. -func NewModelRegistryTransactor(address common.Address, transactor bind.ContractTransactor) (*ModelRegistryTransactor, error) { - contract, err := bindModelRegistry(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &ModelRegistryTransactor{contract: contract}, nil -} - -// NewModelRegistryFilterer creates a new log filterer instance of ModelRegistry, bound to a specific deployed contract. -func NewModelRegistryFilterer(address common.Address, filterer bind.ContractFilterer) (*ModelRegistryFilterer, error) { - contract, err := bindModelRegistry(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &ModelRegistryFilterer{contract: contract}, nil -} - -// bindModelRegistry binds a generic wrapper to an already deployed contract. -func bindModelRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ModelRegistryMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ModelRegistry *ModelRegistryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ModelRegistry.Contract.ModelRegistryCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ModelRegistry *ModelRegistryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ModelRegistry.Contract.ModelRegistryTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ModelRegistry *ModelRegistryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ModelRegistry.Contract.ModelRegistryTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ModelRegistry *ModelRegistryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ModelRegistry.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ModelRegistry *ModelRegistryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ModelRegistry.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ModelRegistry *ModelRegistryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ModelRegistry.Contract.contract.Transact(opts, method, params...) -} - -// Exists is a free data retrieval call binding the contract method 0x38a699a4. -// -// Solidity: function exists(bytes32 id) view returns(bool) -func (_ModelRegistry *ModelRegistryCaller) Exists(opts *bind.CallOpts, id [32]byte) (bool, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "exists", id) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// Exists is a free data retrieval call binding the contract method 0x38a699a4. -// -// Solidity: function exists(bytes32 id) view returns(bool) -func (_ModelRegistry *ModelRegistrySession) Exists(id [32]byte) (bool, error) { - return _ModelRegistry.Contract.Exists(&_ModelRegistry.CallOpts, id) -} - -// Exists is a free data retrieval call binding the contract method 0x38a699a4. -// -// Solidity: function exists(bytes32 id) view returns(bool) -func (_ModelRegistry *ModelRegistryCallerSession) Exists(id [32]byte) (bool, error) { - return _ModelRegistry.Contract.Exists(&_ModelRegistry.CallOpts, id) -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) -func (_ModelRegistry *ModelRegistryCaller) GetAll(opts *bind.CallOpts) ([]ModelRegistryModel, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "getAll") - - if err != nil { - return *new([]ModelRegistryModel), err - } - - out0 := *abi.ConvertType(out[0], new([]ModelRegistryModel)).(*[]ModelRegistryModel) - - return out0, err - -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) -func (_ModelRegistry *ModelRegistrySession) GetAll() ([]ModelRegistryModel, error) { - return _ModelRegistry.Contract.GetAll(&_ModelRegistry.CallOpts) -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns((bytes32,uint256,uint256,address,string,string[],uint128,bool)[]) -func (_ModelRegistry *ModelRegistryCallerSession) GetAll() ([]ModelRegistryModel, error) { - return _ModelRegistry.Contract.GetAll(&_ModelRegistry.CallOpts) -} - -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. -// -// Solidity: function getByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) -func (_ModelRegistry *ModelRegistryCaller) GetByIndex(opts *bind.CallOpts, index *big.Int) (struct { - ModelId [32]byte - Model ModelRegistryModel -}, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "getByIndex", index) - - outstruct := new(struct { - ModelId [32]byte - Model ModelRegistryModel - }) - if err != nil { - return *outstruct, err - } - - outstruct.ModelId = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.Model = *abi.ConvertType(out[1], new(ModelRegistryModel)).(*ModelRegistryModel) - - return *outstruct, err - -} - -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. -// -// Solidity: function getByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) -func (_ModelRegistry *ModelRegistrySession) GetByIndex(index *big.Int) (struct { - ModelId [32]byte - Model ModelRegistryModel -}, error) { - return _ModelRegistry.Contract.GetByIndex(&_ModelRegistry.CallOpts, index) -} - -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. -// -// Solidity: function getByIndex(uint256 index) view returns(bytes32 modelId, (bytes32,uint256,uint256,address,string,string[],uint128,bool) model) -func (_ModelRegistry *ModelRegistryCallerSession) GetByIndex(index *big.Int) (struct { - ModelId [32]byte - Model ModelRegistryModel -}, error) { - return _ModelRegistry.Contract.GetByIndex(&_ModelRegistry.CallOpts, index) -} - -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. -// -// Solidity: function getCount() view returns(uint256 count) -func (_ModelRegistry *ModelRegistryCaller) GetCount(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "getCount") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. -// -// Solidity: function getCount() view returns(uint256 count) -func (_ModelRegistry *ModelRegistrySession) GetCount() (*big.Int, error) { - return _ModelRegistry.Contract.GetCount(&_ModelRegistry.CallOpts) -} - -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. -// -// Solidity: function getCount() view returns(uint256 count) -func (_ModelRegistry *ModelRegistryCallerSession) GetCount() (*big.Int, error) { - return _ModelRegistry.Contract.GetCount(&_ModelRegistry.CallOpts) -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(bytes32[]) -func (_ModelRegistry *ModelRegistryCaller) GetIds(opts *bind.CallOpts) ([][32]byte, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "getIds") - - if err != nil { - return *new([][32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([][32]byte)).(*[][32]byte) - - return out0, err - -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(bytes32[]) -func (_ModelRegistry *ModelRegistrySession) GetIds() ([][32]byte, error) { - return _ModelRegistry.Contract.GetIds(&_ModelRegistry.CallOpts) -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(bytes32[]) -func (_ModelRegistry *ModelRegistryCallerSession) GetIds() ([][32]byte, error) { - return _ModelRegistry.Contract.GetIds(&_ModelRegistry.CallOpts) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(bytes32 ipfsCID, uint256 fee, uint256 stake, address owner, string name, uint128 timestamp, bool isDeleted) -func (_ModelRegistry *ModelRegistryCaller) Map(opts *bind.CallOpts, arg0 [32]byte) (struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Timestamp *big.Int - IsDeleted bool -}, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "map", arg0) - - outstruct := new(struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Timestamp *big.Int - IsDeleted bool - }) - if err != nil { - return *outstruct, err - } - - outstruct.IpfsCID = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.Fee = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.Stake = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.Owner = *abi.ConvertType(out[3], new(common.Address)).(*common.Address) - outstruct.Name = *abi.ConvertType(out[4], new(string)).(*string) - outstruct.Timestamp = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) - outstruct.IsDeleted = *abi.ConvertType(out[6], new(bool)).(*bool) - - return *outstruct, err - -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(bytes32 ipfsCID, uint256 fee, uint256 stake, address owner, string name, uint128 timestamp, bool isDeleted) -func (_ModelRegistry *ModelRegistrySession) Map(arg0 [32]byte) (struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Timestamp *big.Int - IsDeleted bool -}, error) { - return _ModelRegistry.Contract.Map(&_ModelRegistry.CallOpts, arg0) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(bytes32 ipfsCID, uint256 fee, uint256 stake, address owner, string name, uint128 timestamp, bool isDeleted) -func (_ModelRegistry *ModelRegistryCallerSession) Map(arg0 [32]byte) (struct { - IpfsCID [32]byte - Fee *big.Int - Stake *big.Int - Owner common.Address - Name string - Timestamp *big.Int - IsDeleted bool -}, error) { - return _ModelRegistry.Contract.Map(&_ModelRegistry.CallOpts, arg0) -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_ModelRegistry *ModelRegistryCaller) MinStake(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "minStake") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_ModelRegistry *ModelRegistrySession) MinStake() (*big.Int, error) { - return _ModelRegistry.Contract.MinStake(&_ModelRegistry.CallOpts) -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_ModelRegistry *ModelRegistryCallerSession) MinStake() (*big.Int, error) { - return _ModelRegistry.Contract.MinStake(&_ModelRegistry.CallOpts) -} - -// Models is a free data retrieval call binding the contract method 0x6a030ca9. -// -// Solidity: function models(uint256 ) view returns(bytes32) -func (_ModelRegistry *ModelRegistryCaller) Models(opts *bind.CallOpts, arg0 *big.Int) ([32]byte, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "models", arg0) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// Models is a free data retrieval call binding the contract method 0x6a030ca9. -// -// Solidity: function models(uint256 ) view returns(bytes32) -func (_ModelRegistry *ModelRegistrySession) Models(arg0 *big.Int) ([32]byte, error) { - return _ModelRegistry.Contract.Models(&_ModelRegistry.CallOpts, arg0) -} - -// Models is a free data retrieval call binding the contract method 0x6a030ca9. -// -// Solidity: function models(uint256 ) view returns(bytes32) -func (_ModelRegistry *ModelRegistryCallerSession) Models(arg0 *big.Int) ([32]byte, error) { - return _ModelRegistry.Contract.Models(&_ModelRegistry.CallOpts, arg0) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ModelRegistry *ModelRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ModelRegistry *ModelRegistrySession) Owner() (common.Address, error) { - return _ModelRegistry.Contract.Owner(&_ModelRegistry.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ModelRegistry *ModelRegistryCallerSession) Owner() (common.Address, error) { - return _ModelRegistry.Contract.Owner(&_ModelRegistry.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ModelRegistry *ModelRegistryCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ModelRegistry.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ModelRegistry *ModelRegistrySession) Token() (common.Address, error) { - return _ModelRegistry.Contract.Token(&_ModelRegistry.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ModelRegistry *ModelRegistryCallerSession) Token() (common.Address, error) { - return _ModelRegistry.Contract.Token(&_ModelRegistry.CallOpts) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_ModelRegistry *ModelRegistryTransactor) Deregister(opts *bind.TransactOpts, id [32]byte) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "deregister", id) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_ModelRegistry *ModelRegistrySession) Deregister(id [32]byte) (*types.Transaction, error) { - return _ModelRegistry.Contract.Deregister(&_ModelRegistry.TransactOpts, id) -} - -// Deregister is a paid mutator transaction binding the contract method 0x20813154. -// -// Solidity: function deregister(bytes32 id) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) Deregister(id [32]byte) (*types.Transaction, error) { - return _ModelRegistry.Contract.Deregister(&_ModelRegistry.TransactOpts, id) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ModelRegistry *ModelRegistryTransactor) Initialize(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "initialize", _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ModelRegistry *ModelRegistrySession) Initialize(_token common.Address) (*types.Transaction, error) { - return _ModelRegistry.Contract.Initialize(&_ModelRegistry.TransactOpts, _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) Initialize(_token common.Address) (*types.Transaction, error) { - return _ModelRegistry.Contract.Initialize(&_ModelRegistry.TransactOpts, _token) -} - -// Register is a paid mutator transaction binding the contract method 0x9e4aaa05. -// -// Solidity: function register(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() -func (_ModelRegistry *ModelRegistryTransactor) Register(opts *bind.TransactOpts, modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "register", modelId, ipfsCID, fee, addStake, owner, name, tags) -} - -// Register is a paid mutator transaction binding the contract method 0x9e4aaa05. -// -// Solidity: function register(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() -func (_ModelRegistry *ModelRegistrySession) Register(modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { - return _ModelRegistry.Contract.Register(&_ModelRegistry.TransactOpts, modelId, ipfsCID, fee, addStake, owner, name, tags) -} - -// Register is a paid mutator transaction binding the contract method 0x9e4aaa05. -// -// Solidity: function register(bytes32 modelId, bytes32 ipfsCID, uint256 fee, uint256 addStake, address owner, string name, string[] tags) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) Register(modelId [32]byte, ipfsCID [32]byte, fee *big.Int, addStake *big.Int, owner common.Address, name string, tags []string) (*types.Transaction, error) { - return _ModelRegistry.Contract.Register(&_ModelRegistry.TransactOpts, modelId, ipfsCID, fee, addStake, owner, name, tags) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ModelRegistry *ModelRegistryTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ModelRegistry *ModelRegistrySession) RenounceOwnership() (*types.Transaction, error) { - return _ModelRegistry.Contract.RenounceOwnership(&_ModelRegistry.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ModelRegistry *ModelRegistryTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _ModelRegistry.Contract.RenounceOwnership(&_ModelRegistry.TransactOpts) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ModelRegistry *ModelRegistryTransactor) SetMinStake(opts *bind.TransactOpts, _minStake *big.Int) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "setMinStake", _minStake) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ModelRegistry *ModelRegistrySession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _ModelRegistry.Contract.SetMinStake(&_ModelRegistry.TransactOpts, _minStake) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _ModelRegistry.Contract.SetMinStake(&_ModelRegistry.TransactOpts, _minStake) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ModelRegistry *ModelRegistryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _ModelRegistry.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ModelRegistry *ModelRegistrySession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ModelRegistry.Contract.TransferOwnership(&_ModelRegistry.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ModelRegistry *ModelRegistryTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ModelRegistry.Contract.TransferOwnership(&_ModelRegistry.TransactOpts, newOwner) -} - -// ModelRegistryDeregisteredIterator is returned from FilterDeregistered and is used to iterate over the raw logs and unpacked data for Deregistered events raised by the ModelRegistry contract. -type ModelRegistryDeregisteredIterator struct { - Event *ModelRegistryDeregistered // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ModelRegistryDeregisteredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ModelRegistryDeregistered) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ModelRegistryDeregistered) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryDeregisteredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ModelRegistryDeregisteredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ModelRegistryDeregistered represents a Deregistered event raised by the ModelRegistry contract. -type ModelRegistryDeregistered struct { - Owner common.Address - ModelId [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterDeregistered is a free log retrieval operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. -// -// Solidity: event Deregistered(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) FilterDeregistered(opts *bind.FilterOpts, owner []common.Address, modelId [][32]byte) (*ModelRegistryDeregisteredIterator, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var modelIdRule []interface{} - for _, modelIdItem := range modelId { - modelIdRule = append(modelIdRule, modelIdItem) - } - - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "Deregistered", ownerRule, modelIdRule) - if err != nil { - return nil, err - } - return &ModelRegistryDeregisteredIterator{contract: _ModelRegistry.contract, event: "Deregistered", logs: logs, sub: sub}, nil -} - -// WatchDeregistered is a free log subscription operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. -// -// Solidity: event Deregistered(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) WatchDeregistered(opts *bind.WatchOpts, sink chan<- *ModelRegistryDeregistered, owner []common.Address, modelId [][32]byte) (event.Subscription, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var modelIdRule []interface{} - for _, modelIdItem := range modelId { - modelIdRule = append(modelIdRule, modelIdItem) - } - - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "Deregistered", ownerRule, modelIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ModelRegistryDeregistered) - if err := _ModelRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseDeregistered is a log parse operation binding the contract event 0xcc0d8d49cb9a5a3eebc1e1f0b607b8aad83fbe9618e448df79b8a0cc33319472. -// -// Solidity: event Deregistered(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) ParseDeregistered(log types.Log) (*ModelRegistryDeregistered, error) { - event := new(ModelRegistryDeregistered) - if err := _ModelRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ModelRegistryInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the ModelRegistry contract. -type ModelRegistryInitializedIterator struct { - Event *ModelRegistryInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ModelRegistryInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ModelRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ModelRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ModelRegistryInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ModelRegistryInitialized represents a Initialized event raised by the ModelRegistry contract. -type ModelRegistryInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ModelRegistry *ModelRegistryFilterer) FilterInitialized(opts *bind.FilterOpts) (*ModelRegistryInitializedIterator, error) { - - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &ModelRegistryInitializedIterator{contract: _ModelRegistry.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ModelRegistry *ModelRegistryFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *ModelRegistryInitialized) (event.Subscription, error) { - - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ModelRegistryInitialized) - if err := _ModelRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ModelRegistry *ModelRegistryFilterer) ParseInitialized(log types.Log) (*ModelRegistryInitialized, error) { - event := new(ModelRegistryInitialized) - if err := _ModelRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ModelRegistryMinStakeUpdatedIterator is returned from FilterMinStakeUpdated and is used to iterate over the raw logs and unpacked data for MinStakeUpdated events raised by the ModelRegistry contract. -type ModelRegistryMinStakeUpdatedIterator struct { - Event *ModelRegistryMinStakeUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ModelRegistryMinStakeUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ModelRegistryMinStakeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ModelRegistryMinStakeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryMinStakeUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ModelRegistryMinStakeUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ModelRegistryMinStakeUpdated represents a MinStakeUpdated event raised by the ModelRegistry contract. -type ModelRegistryMinStakeUpdated struct { - NewStake *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMinStakeUpdated is a free log retrieval operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ModelRegistry *ModelRegistryFilterer) FilterMinStakeUpdated(opts *bind.FilterOpts) (*ModelRegistryMinStakeUpdatedIterator, error) { - - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return &ModelRegistryMinStakeUpdatedIterator{contract: _ModelRegistry.contract, event: "MinStakeUpdated", logs: logs, sub: sub}, nil -} - -// WatchMinStakeUpdated is a free log subscription operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ModelRegistry *ModelRegistryFilterer) WatchMinStakeUpdated(opts *bind.WatchOpts, sink chan<- *ModelRegistryMinStakeUpdated) (event.Subscription, error) { - - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ModelRegistryMinStakeUpdated) - if err := _ModelRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMinStakeUpdated is a log parse operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ModelRegistry *ModelRegistryFilterer) ParseMinStakeUpdated(log types.Log) (*ModelRegistryMinStakeUpdated, error) { - event := new(ModelRegistryMinStakeUpdated) - if err := _ModelRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ModelRegistryOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ModelRegistry contract. -type ModelRegistryOwnershipTransferredIterator struct { - Event *ModelRegistryOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ModelRegistryOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ModelRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ModelRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ModelRegistryOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ModelRegistryOwnershipTransferred represents a OwnershipTransferred event raised by the ModelRegistry contract. -type ModelRegistryOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ModelRegistry *ModelRegistryFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ModelRegistryOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &ModelRegistryOwnershipTransferredIterator{contract: _ModelRegistry.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ModelRegistry *ModelRegistryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ModelRegistryOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ModelRegistryOwnershipTransferred) - if err := _ModelRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ModelRegistry *ModelRegistryFilterer) ParseOwnershipTransferred(log types.Log) (*ModelRegistryOwnershipTransferred, error) { - event := new(ModelRegistryOwnershipTransferred) - if err := _ModelRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ModelRegistryRegisteredUpdatedIterator is returned from FilterRegisteredUpdated and is used to iterate over the raw logs and unpacked data for RegisteredUpdated events raised by the ModelRegistry contract. -type ModelRegistryRegisteredUpdatedIterator struct { - Event *ModelRegistryRegisteredUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ModelRegistryRegisteredUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ModelRegistryRegisteredUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ModelRegistryRegisteredUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ModelRegistryRegisteredUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ModelRegistryRegisteredUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ModelRegistryRegisteredUpdated represents a RegisteredUpdated event raised by the ModelRegistry contract. -type ModelRegistryRegisteredUpdated struct { - Owner common.Address - ModelId [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterRegisteredUpdated is a free log retrieval operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. -// -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) FilterRegisteredUpdated(opts *bind.FilterOpts, owner []common.Address, modelId [][32]byte) (*ModelRegistryRegisteredUpdatedIterator, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var modelIdRule []interface{} - for _, modelIdItem := range modelId { - modelIdRule = append(modelIdRule, modelIdItem) - } - - logs, sub, err := _ModelRegistry.contract.FilterLogs(opts, "RegisteredUpdated", ownerRule, modelIdRule) - if err != nil { - return nil, err - } - return &ModelRegistryRegisteredUpdatedIterator{contract: _ModelRegistry.contract, event: "RegisteredUpdated", logs: logs, sub: sub}, nil -} - -// WatchRegisteredUpdated is a free log subscription operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. -// -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) WatchRegisteredUpdated(opts *bind.WatchOpts, sink chan<- *ModelRegistryRegisteredUpdated, owner []common.Address, modelId [][32]byte) (event.Subscription, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var modelIdRule []interface{} - for _, modelIdItem := range modelId { - modelIdRule = append(modelIdRule, modelIdItem) - } - - logs, sub, err := _ModelRegistry.contract.WatchLogs(opts, "RegisteredUpdated", ownerRule, modelIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ModelRegistryRegisteredUpdated) - if err := _ModelRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseRegisteredUpdated is a log parse operation binding the contract event 0x4dffc4e92367641816479c647d1ff3f03202f6c73b97340cba51a7b577c55804. -// -// Solidity: event RegisteredUpdated(address indexed owner, bytes32 indexed modelId) -func (_ModelRegistry *ModelRegistryFilterer) ParseRegisteredUpdated(log types.Log) (*ModelRegistryRegisteredUpdated, error) { - event := new(ModelRegistryRegisteredUpdated) - if err := _ModelRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/smart-contracts/bindings/go/contracts/providerregistry/ProviderRegistry.go b/smart-contracts/bindings/go/contracts/providerregistry/ProviderRegistry.go deleted file mode 100644 index 8afa5ffa..00000000 --- a/smart-contracts/bindings/go/contracts/providerregistry/ProviderRegistry.go +++ /dev/null @@ -1,1373 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package providerregistry - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// ProviderRegistryProvider is an auto generated low-level Go binding around an user-defined struct. -type ProviderRegistryProvider struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool -} - -// ProviderRegistryMetaData contains all meta data concerning the ProviderRegistry contract. -var ProviderRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"KeyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeTooLow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroKey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"Deregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"}],\"name\":\"MinStakeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"}],\"name\":\"RegisteredUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"deregister\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"exists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAll\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structProviderRegistry.Provider[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getByIndex\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"internalType\":\"structProviderRegistry.Provider\",\"name\":\"provider\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getIds\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"timestamp\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"isDeleted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"providers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addStake\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"setMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - -// ProviderRegistryABI is the input ABI used to generate the binding from. -// Deprecated: Use ProviderRegistryMetaData.ABI instead. -var ProviderRegistryABI = ProviderRegistryMetaData.ABI - -// ProviderRegistry is an auto generated Go binding around an Ethereum contract. -type ProviderRegistry struct { - ProviderRegistryCaller // Read-only binding to the contract - ProviderRegistryTransactor // Write-only binding to the contract - ProviderRegistryFilterer // Log filterer for contract events -} - -// ProviderRegistryCaller is an auto generated read-only Go binding around an Ethereum contract. -type ProviderRegistryCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProviderRegistryTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ProviderRegistryTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProviderRegistryFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ProviderRegistryFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProviderRegistrySession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ProviderRegistrySession struct { - Contract *ProviderRegistry // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ProviderRegistryCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ProviderRegistryCallerSession struct { - Contract *ProviderRegistryCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ProviderRegistryTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ProviderRegistryTransactorSession struct { - Contract *ProviderRegistryTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ProviderRegistryRaw is an auto generated low-level Go binding around an Ethereum contract. -type ProviderRegistryRaw struct { - Contract *ProviderRegistry // Generic contract binding to access the raw methods on -} - -// ProviderRegistryCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ProviderRegistryCallerRaw struct { - Contract *ProviderRegistryCaller // Generic read-only contract binding to access the raw methods on -} - -// ProviderRegistryTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ProviderRegistryTransactorRaw struct { - Contract *ProviderRegistryTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewProviderRegistry creates a new instance of ProviderRegistry, bound to a specific deployed contract. -func NewProviderRegistry(address common.Address, backend bind.ContractBackend) (*ProviderRegistry, error) { - contract, err := bindProviderRegistry(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &ProviderRegistry{ProviderRegistryCaller: ProviderRegistryCaller{contract: contract}, ProviderRegistryTransactor: ProviderRegistryTransactor{contract: contract}, ProviderRegistryFilterer: ProviderRegistryFilterer{contract: contract}}, nil -} - -// NewProviderRegistryCaller creates a new read-only instance of ProviderRegistry, bound to a specific deployed contract. -func NewProviderRegistryCaller(address common.Address, caller bind.ContractCaller) (*ProviderRegistryCaller, error) { - contract, err := bindProviderRegistry(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &ProviderRegistryCaller{contract: contract}, nil -} - -// NewProviderRegistryTransactor creates a new write-only instance of ProviderRegistry, bound to a specific deployed contract. -func NewProviderRegistryTransactor(address common.Address, transactor bind.ContractTransactor) (*ProviderRegistryTransactor, error) { - contract, err := bindProviderRegistry(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &ProviderRegistryTransactor{contract: contract}, nil -} - -// NewProviderRegistryFilterer creates a new log filterer instance of ProviderRegistry, bound to a specific deployed contract. -func NewProviderRegistryFilterer(address common.Address, filterer bind.ContractFilterer) (*ProviderRegistryFilterer, error) { - contract, err := bindProviderRegistry(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &ProviderRegistryFilterer{contract: contract}, nil -} - -// bindProviderRegistry binds a generic wrapper to an already deployed contract. -func bindProviderRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ProviderRegistryMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ProviderRegistry *ProviderRegistryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ProviderRegistry.Contract.ProviderRegistryCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ProviderRegistry *ProviderRegistryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ProviderRegistry.Contract.ProviderRegistryTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ProviderRegistry *ProviderRegistryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ProviderRegistry.Contract.ProviderRegistryTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ProviderRegistry *ProviderRegistryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ProviderRegistry.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ProviderRegistry *ProviderRegistryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ProviderRegistry.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ProviderRegistry *ProviderRegistryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ProviderRegistry.Contract.contract.Transact(opts, method, params...) -} - -// Exists is a free data retrieval call binding the contract method 0xf6a3d24e. -// -// Solidity: function exists(address addr) view returns(bool) -func (_ProviderRegistry *ProviderRegistryCaller) Exists(opts *bind.CallOpts, addr common.Address) (bool, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "exists", addr) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// Exists is a free data retrieval call binding the contract method 0xf6a3d24e. -// -// Solidity: function exists(address addr) view returns(bool) -func (_ProviderRegistry *ProviderRegistrySession) Exists(addr common.Address) (bool, error) { - return _ProviderRegistry.Contract.Exists(&_ProviderRegistry.CallOpts, addr) -} - -// Exists is a free data retrieval call binding the contract method 0xf6a3d24e. -// -// Solidity: function exists(address addr) view returns(bool) -func (_ProviderRegistry *ProviderRegistryCallerSession) Exists(addr common.Address) (bool, error) { - return _ProviderRegistry.Contract.Exists(&_ProviderRegistry.CallOpts, addr) -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns(address[], (string,uint256,uint128,bool)[]) -func (_ProviderRegistry *ProviderRegistryCaller) GetAll(opts *bind.CallOpts) ([]common.Address, []ProviderRegistryProvider, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "getAll") - - if err != nil { - return *new([]common.Address), *new([]ProviderRegistryProvider), err - } - - out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) - out1 := *abi.ConvertType(out[1], new([]ProviderRegistryProvider)).(*[]ProviderRegistryProvider) - - return out0, out1, err - -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns(address[], (string,uint256,uint128,bool)[]) -func (_ProviderRegistry *ProviderRegistrySession) GetAll() ([]common.Address, []ProviderRegistryProvider, error) { - return _ProviderRegistry.Contract.GetAll(&_ProviderRegistry.CallOpts) -} - -// GetAll is a free data retrieval call binding the contract method 0x53ed5143. -// -// Solidity: function getAll() view returns(address[], (string,uint256,uint128,bool)[]) -func (_ProviderRegistry *ProviderRegistryCallerSession) GetAll() ([]common.Address, []ProviderRegistryProvider, error) { - return _ProviderRegistry.Contract.GetAll(&_ProviderRegistry.CallOpts) -} - -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. -// -// Solidity: function getByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) -func (_ProviderRegistry *ProviderRegistryCaller) GetByIndex(opts *bind.CallOpts, index *big.Int) (struct { - Addr common.Address - Provider ProviderRegistryProvider -}, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "getByIndex", index) - - outstruct := new(struct { - Addr common.Address - Provider ProviderRegistryProvider - }) - if err != nil { - return *outstruct, err - } - - outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - outstruct.Provider = *abi.ConvertType(out[1], new(ProviderRegistryProvider)).(*ProviderRegistryProvider) - - return *outstruct, err - -} - -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. -// -// Solidity: function getByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) -func (_ProviderRegistry *ProviderRegistrySession) GetByIndex(index *big.Int) (struct { - Addr common.Address - Provider ProviderRegistryProvider -}, error) { - return _ProviderRegistry.Contract.GetByIndex(&_ProviderRegistry.CallOpts, index) -} - -// GetByIndex is a free data retrieval call binding the contract method 0x2d883a73. -// -// Solidity: function getByIndex(uint256 index) view returns(address addr, (string,uint256,uint128,bool) provider) -func (_ProviderRegistry *ProviderRegistryCallerSession) GetByIndex(index *big.Int) (struct { - Addr common.Address - Provider ProviderRegistryProvider -}, error) { - return _ProviderRegistry.Contract.GetByIndex(&_ProviderRegistry.CallOpts, index) -} - -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. -// -// Solidity: function getCount() view returns(uint256 count) -func (_ProviderRegistry *ProviderRegistryCaller) GetCount(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "getCount") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. -// -// Solidity: function getCount() view returns(uint256 count) -func (_ProviderRegistry *ProviderRegistrySession) GetCount() (*big.Int, error) { - return _ProviderRegistry.Contract.GetCount(&_ProviderRegistry.CallOpts) -} - -// GetCount is a free data retrieval call binding the contract method 0xa87d942c. -// -// Solidity: function getCount() view returns(uint256 count) -func (_ProviderRegistry *ProviderRegistryCallerSession) GetCount() (*big.Int, error) { - return _ProviderRegistry.Contract.GetCount(&_ProviderRegistry.CallOpts) -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(address[]) -func (_ProviderRegistry *ProviderRegistryCaller) GetIds(opts *bind.CallOpts) ([]common.Address, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "getIds") - - if err != nil { - return *new([]common.Address), err - } - - out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) - - return out0, err - -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(address[]) -func (_ProviderRegistry *ProviderRegistrySession) GetIds() ([]common.Address, error) { - return _ProviderRegistry.Contract.GetIds(&_ProviderRegistry.CallOpts) -} - -// GetIds is a free data retrieval call binding the contract method 0x2b105663. -// -// Solidity: function getIds() view returns(address[]) -func (_ProviderRegistry *ProviderRegistryCallerSession) GetIds() ([]common.Address, error) { - return _ProviderRegistry.Contract.GetIds(&_ProviderRegistry.CallOpts) -} - -// Map is a free data retrieval call binding the contract method 0xb721ef6e. -// -// Solidity: function map(address ) view returns(string endpoint, uint256 stake, uint128 timestamp, bool isDeleted) -func (_ProviderRegistry *ProviderRegistryCaller) Map(opts *bind.CallOpts, arg0 common.Address) (struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool -}, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "map", arg0) - - outstruct := new(struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool - }) - if err != nil { - return *outstruct, err - } - - outstruct.Endpoint = *abi.ConvertType(out[0], new(string)).(*string) - outstruct.Stake = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.Timestamp = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.IsDeleted = *abi.ConvertType(out[3], new(bool)).(*bool) - - return *outstruct, err - -} - -// Map is a free data retrieval call binding the contract method 0xb721ef6e. -// -// Solidity: function map(address ) view returns(string endpoint, uint256 stake, uint128 timestamp, bool isDeleted) -func (_ProviderRegistry *ProviderRegistrySession) Map(arg0 common.Address) (struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool -}, error) { - return _ProviderRegistry.Contract.Map(&_ProviderRegistry.CallOpts, arg0) -} - -// Map is a free data retrieval call binding the contract method 0xb721ef6e. -// -// Solidity: function map(address ) view returns(string endpoint, uint256 stake, uint128 timestamp, bool isDeleted) -func (_ProviderRegistry *ProviderRegistryCallerSession) Map(arg0 common.Address) (struct { - Endpoint string - Stake *big.Int - Timestamp *big.Int - IsDeleted bool -}, error) { - return _ProviderRegistry.Contract.Map(&_ProviderRegistry.CallOpts, arg0) -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_ProviderRegistry *ProviderRegistryCaller) MinStake(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "minStake") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_ProviderRegistry *ProviderRegistrySession) MinStake() (*big.Int, error) { - return _ProviderRegistry.Contract.MinStake(&_ProviderRegistry.CallOpts) -} - -// MinStake is a free data retrieval call binding the contract method 0x375b3c0a. -// -// Solidity: function minStake() view returns(uint256) -func (_ProviderRegistry *ProviderRegistryCallerSession) MinStake() (*big.Int, error) { - return _ProviderRegistry.Contract.MinStake(&_ProviderRegistry.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ProviderRegistry *ProviderRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ProviderRegistry *ProviderRegistrySession) Owner() (common.Address, error) { - return _ProviderRegistry.Contract.Owner(&_ProviderRegistry.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ProviderRegistry *ProviderRegistryCallerSession) Owner() (common.Address, error) { - return _ProviderRegistry.Contract.Owner(&_ProviderRegistry.CallOpts) -} - -// Providers is a free data retrieval call binding the contract method 0x50f3fc81. -// -// Solidity: function providers(uint256 ) view returns(address) -func (_ProviderRegistry *ProviderRegistryCaller) Providers(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "providers", arg0) - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Providers is a free data retrieval call binding the contract method 0x50f3fc81. -// -// Solidity: function providers(uint256 ) view returns(address) -func (_ProviderRegistry *ProviderRegistrySession) Providers(arg0 *big.Int) (common.Address, error) { - return _ProviderRegistry.Contract.Providers(&_ProviderRegistry.CallOpts, arg0) -} - -// Providers is a free data retrieval call binding the contract method 0x50f3fc81. -// -// Solidity: function providers(uint256 ) view returns(address) -func (_ProviderRegistry *ProviderRegistryCallerSession) Providers(arg0 *big.Int) (common.Address, error) { - return _ProviderRegistry.Contract.Providers(&_ProviderRegistry.CallOpts, arg0) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ProviderRegistry *ProviderRegistryCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ProviderRegistry.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ProviderRegistry *ProviderRegistrySession) Token() (common.Address, error) { - return _ProviderRegistry.Contract.Token(&_ProviderRegistry.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_ProviderRegistry *ProviderRegistryCallerSession) Token() (common.Address, error) { - return _ProviderRegistry.Contract.Token(&_ProviderRegistry.CallOpts) -} - -// Deregister is a paid mutator transaction binding the contract method 0x84ac33ec. -// -// Solidity: function deregister(address addr) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) Deregister(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "deregister", addr) -} - -// Deregister is a paid mutator transaction binding the contract method 0x84ac33ec. -// -// Solidity: function deregister(address addr) returns() -func (_ProviderRegistry *ProviderRegistrySession) Deregister(addr common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Deregister(&_ProviderRegistry.TransactOpts, addr) -} - -// Deregister is a paid mutator transaction binding the contract method 0x84ac33ec. -// -// Solidity: function deregister(address addr) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) Deregister(addr common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Deregister(&_ProviderRegistry.TransactOpts, addr) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) Initialize(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "initialize", _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ProviderRegistry *ProviderRegistrySession) Initialize(_token common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Initialize(&_ProviderRegistry.TransactOpts, _token) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. -// -// Solidity: function initialize(address _token) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) Initialize(_token common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Initialize(&_ProviderRegistry.TransactOpts, _token) -} - -// Register is a paid mutator transaction binding the contract method 0xf11b1b88. -// -// Solidity: function register(address addr, uint256 addStake, string endpoint) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) Register(opts *bind.TransactOpts, addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "register", addr, addStake, endpoint) -} - -// Register is a paid mutator transaction binding the contract method 0xf11b1b88. -// -// Solidity: function register(address addr, uint256 addStake, string endpoint) returns() -func (_ProviderRegistry *ProviderRegistrySession) Register(addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Register(&_ProviderRegistry.TransactOpts, addr, addStake, endpoint) -} - -// Register is a paid mutator transaction binding the contract method 0xf11b1b88. -// -// Solidity: function register(address addr, uint256 addStake, string endpoint) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) Register(addr common.Address, addStake *big.Int, endpoint string) (*types.Transaction, error) { - return _ProviderRegistry.Contract.Register(&_ProviderRegistry.TransactOpts, addr, addStake, endpoint) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ProviderRegistry *ProviderRegistryTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ProviderRegistry *ProviderRegistrySession) RenounceOwnership() (*types.Transaction, error) { - return _ProviderRegistry.Contract.RenounceOwnership(&_ProviderRegistry.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _ProviderRegistry.Contract.RenounceOwnership(&_ProviderRegistry.TransactOpts) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) SetMinStake(opts *bind.TransactOpts, _minStake *big.Int) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "setMinStake", _minStake) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ProviderRegistry *ProviderRegistrySession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _ProviderRegistry.Contract.SetMinStake(&_ProviderRegistry.TransactOpts, _minStake) -} - -// SetMinStake is a paid mutator transaction binding the contract method 0x8c80fd90. -// -// Solidity: function setMinStake(uint256 _minStake) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) SetMinStake(_minStake *big.Int) (*types.Transaction, error) { - return _ProviderRegistry.Contract.SetMinStake(&_ProviderRegistry.TransactOpts, _minStake) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ProviderRegistry *ProviderRegistryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _ProviderRegistry.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ProviderRegistry *ProviderRegistrySession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.TransferOwnership(&_ProviderRegistry.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ProviderRegistry *ProviderRegistryTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ProviderRegistry.Contract.TransferOwnership(&_ProviderRegistry.TransactOpts, newOwner) -} - -// ProviderRegistryDeregisteredIterator is returned from FilterDeregistered and is used to iterate over the raw logs and unpacked data for Deregistered events raised by the ProviderRegistry contract. -type ProviderRegistryDeregisteredIterator struct { - Event *ProviderRegistryDeregistered // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryDeregisteredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryDeregistered) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryDeregistered) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryDeregisteredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ProviderRegistryDeregisteredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ProviderRegistryDeregistered represents a Deregistered event raised by the ProviderRegistry contract. -type ProviderRegistryDeregistered struct { - Provider common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterDeregistered is a free log retrieval operation binding the contract event 0xafebd0f81ba8c430fcc0c6a6e7a26fd7f868af9c4e4f19db37a0f16502374fd5. -// -// Solidity: event Deregistered(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterDeregistered(opts *bind.FilterOpts, provider []common.Address) (*ProviderRegistryDeregisteredIterator, error) { - - var providerRule []interface{} - for _, providerItem := range provider { - providerRule = append(providerRule, providerItem) - } - - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "Deregistered", providerRule) - if err != nil { - return nil, err - } - return &ProviderRegistryDeregisteredIterator{contract: _ProviderRegistry.contract, event: "Deregistered", logs: logs, sub: sub}, nil -} - -// WatchDeregistered is a free log subscription operation binding the contract event 0xafebd0f81ba8c430fcc0c6a6e7a26fd7f868af9c4e4f19db37a0f16502374fd5. -// -// Solidity: event Deregistered(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchDeregistered(opts *bind.WatchOpts, sink chan<- *ProviderRegistryDeregistered, provider []common.Address) (event.Subscription, error) { - - var providerRule []interface{} - for _, providerItem := range provider { - providerRule = append(providerRule, providerItem) - } - - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "Deregistered", providerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryDeregistered) - if err := _ProviderRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseDeregistered is a log parse operation binding the contract event 0xafebd0f81ba8c430fcc0c6a6e7a26fd7f868af9c4e4f19db37a0f16502374fd5. -// -// Solidity: event Deregistered(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseDeregistered(log types.Log) (*ProviderRegistryDeregistered, error) { - event := new(ProviderRegistryDeregistered) - if err := _ProviderRegistry.contract.UnpackLog(event, "Deregistered", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ProviderRegistryInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the ProviderRegistry contract. -type ProviderRegistryInitializedIterator struct { - Event *ProviderRegistryInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ProviderRegistryInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ProviderRegistryInitialized represents a Initialized event raised by the ProviderRegistry contract. -type ProviderRegistryInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterInitialized(opts *bind.FilterOpts) (*ProviderRegistryInitializedIterator, error) { - - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &ProviderRegistryInitializedIterator{contract: _ProviderRegistry.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *ProviderRegistryInitialized) (event.Subscription, error) { - - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryInitialized) - if err := _ProviderRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseInitialized(log types.Log) (*ProviderRegistryInitialized, error) { - event := new(ProviderRegistryInitialized) - if err := _ProviderRegistry.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ProviderRegistryMinStakeUpdatedIterator is returned from FilterMinStakeUpdated and is used to iterate over the raw logs and unpacked data for MinStakeUpdated events raised by the ProviderRegistry contract. -type ProviderRegistryMinStakeUpdatedIterator struct { - Event *ProviderRegistryMinStakeUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryMinStakeUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryMinStakeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryMinStakeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryMinStakeUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ProviderRegistryMinStakeUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ProviderRegistryMinStakeUpdated represents a MinStakeUpdated event raised by the ProviderRegistry contract. -type ProviderRegistryMinStakeUpdated struct { - NewStake *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMinStakeUpdated is a free log retrieval operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterMinStakeUpdated(opts *bind.FilterOpts) (*ProviderRegistryMinStakeUpdatedIterator, error) { - - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return &ProviderRegistryMinStakeUpdatedIterator{contract: _ProviderRegistry.contract, event: "MinStakeUpdated", logs: logs, sub: sub}, nil -} - -// WatchMinStakeUpdated is a free log subscription operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchMinStakeUpdated(opts *bind.WatchOpts, sink chan<- *ProviderRegistryMinStakeUpdated) (event.Subscription, error) { - - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "MinStakeUpdated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryMinStakeUpdated) - if err := _ProviderRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMinStakeUpdated is a log parse operation binding the contract event 0x47ab46f2c8d4258304a2f5551c1cbdb6981be49631365d1ba7191288a73f39ef. -// -// Solidity: event MinStakeUpdated(uint256 newStake) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseMinStakeUpdated(log types.Log) (*ProviderRegistryMinStakeUpdated, error) { - event := new(ProviderRegistryMinStakeUpdated) - if err := _ProviderRegistry.contract.UnpackLog(event, "MinStakeUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ProviderRegistryOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ProviderRegistry contract. -type ProviderRegistryOwnershipTransferredIterator struct { - Event *ProviderRegistryOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ProviderRegistryOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ProviderRegistryOwnershipTransferred represents a OwnershipTransferred event raised by the ProviderRegistry contract. -type ProviderRegistryOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ProviderRegistryOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &ProviderRegistryOwnershipTransferredIterator{contract: _ProviderRegistry.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ProviderRegistryOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryOwnershipTransferred) - if err := _ProviderRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseOwnershipTransferred(log types.Log) (*ProviderRegistryOwnershipTransferred, error) { - event := new(ProviderRegistryOwnershipTransferred) - if err := _ProviderRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ProviderRegistryRegisteredUpdatedIterator is returned from FilterRegisteredUpdated and is used to iterate over the raw logs and unpacked data for RegisteredUpdated events raised by the ProviderRegistry contract. -type ProviderRegistryRegisteredUpdatedIterator struct { - Event *ProviderRegistryRegisteredUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ProviderRegistryRegisteredUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryRegisteredUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ProviderRegistryRegisteredUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ProviderRegistryRegisteredUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ProviderRegistryRegisteredUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ProviderRegistryRegisteredUpdated represents a RegisteredUpdated event raised by the ProviderRegistry contract. -type ProviderRegistryRegisteredUpdated struct { - Provider common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterRegisteredUpdated is a free log retrieval operation binding the contract event 0x0407973ec6e86eb9f260606351583a2737e1db4d6f44c2414e699bd665ae10dc. -// -// Solidity: event RegisteredUpdated(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) FilterRegisteredUpdated(opts *bind.FilterOpts, provider []common.Address) (*ProviderRegistryRegisteredUpdatedIterator, error) { - - var providerRule []interface{} - for _, providerItem := range provider { - providerRule = append(providerRule, providerItem) - } - - logs, sub, err := _ProviderRegistry.contract.FilterLogs(opts, "RegisteredUpdated", providerRule) - if err != nil { - return nil, err - } - return &ProviderRegistryRegisteredUpdatedIterator{contract: _ProviderRegistry.contract, event: "RegisteredUpdated", logs: logs, sub: sub}, nil -} - -// WatchRegisteredUpdated is a free log subscription operation binding the contract event 0x0407973ec6e86eb9f260606351583a2737e1db4d6f44c2414e699bd665ae10dc. -// -// Solidity: event RegisteredUpdated(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) WatchRegisteredUpdated(opts *bind.WatchOpts, sink chan<- *ProviderRegistryRegisteredUpdated, provider []common.Address) (event.Subscription, error) { - - var providerRule []interface{} - for _, providerItem := range provider { - providerRule = append(providerRule, providerItem) - } - - logs, sub, err := _ProviderRegistry.contract.WatchLogs(opts, "RegisteredUpdated", providerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ProviderRegistryRegisteredUpdated) - if err := _ProviderRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseRegisteredUpdated is a log parse operation binding the contract event 0x0407973ec6e86eb9f260606351583a2737e1db4d6f44c2414e699bd665ae10dc. -// -// Solidity: event RegisteredUpdated(address indexed provider) -func (_ProviderRegistry *ProviderRegistryFilterer) ParseRegisteredUpdated(log types.Log) (*ProviderRegistryRegisteredUpdated, error) { - event := new(ProviderRegistryRegisteredUpdated) - if err := _ProviderRegistry.contract.UnpackLog(event, "RegisteredUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/smart-contracts/bindings/go/contracts/sessionrouter/SessionRouter.go b/smart-contracts/bindings/go/contracts/sessionrouter/SessionRouter.go deleted file mode 100644 index 516bbb93..00000000 --- a/smart-contracts/bindings/go/contracts/sessionrouter/SessionRouter.go +++ /dev/null @@ -1,1944 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package sessionrouter - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// SessionRouterSession is an auto generated low-level Go binding around an user-defined struct. -type SessionRouterSession struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int -} - -// SessionRouterMetaData contains all meta data concerning the SessionRouter contract. -var SessionRouterMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"BidNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughStipend\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotUser\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotUserOrProvider\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SessionNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SessionTooShort\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"providerAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ProviderClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"providerId\",\"type\":\"address\"}],\"name\":\"SessionClosed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"providerId\",\"type\":\"address\"}],\"name\":\"SessionOpened\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToWithdraw\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claimProviderBalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"receiptEncoded\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"closeSession\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"name\":\"deleteHistory\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_encodedMessage\",\"type\":\"bytes\"}],\"name\":\"getEthSignedMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"providerAddr\",\"type\":\"address\"}],\"name\":\"getProviderBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hold\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"providerAddr\",\"type\":\"address\"}],\"name\":\"getProviderClaimBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"name\":\"getSession\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"budget\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"internalType\":\"structSessionRouter.Session\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stakingDailyStipend\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_marketplace\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"map\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"marketplace\",\"outputs\":[{\"internalType\":\"contractMarketplace\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bidId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"budget\",\"type\":\"uint256\"}],\"name\":\"openSession\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"sessionId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"providerOnHold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"releaseAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"message\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"recoverSigner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sessions\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"modelAgentId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"budget\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"closeoutReceipt\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"closeoutType\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"closedAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"delay\",\"type\":\"int256\"}],\"name\":\"setStakeDelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"splitSignature\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakeDelay\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingDailyStipend\",\"outputs\":[{\"internalType\":\"contractStakingDailyStipend\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - -// SessionRouterABI is the input ABI used to generate the binding from. -// Deprecated: Use SessionRouterMetaData.ABI instead. -var SessionRouterABI = SessionRouterMetaData.ABI - -// SessionRouter is an auto generated Go binding around an Ethereum contract. -type SessionRouter struct { - SessionRouterCaller // Read-only binding to the contract - SessionRouterTransactor // Write-only binding to the contract - SessionRouterFilterer // Log filterer for contract events -} - -// SessionRouterCaller is an auto generated read-only Go binding around an Ethereum contract. -type SessionRouterCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SessionRouterTransactor is an auto generated write-only Go binding around an Ethereum contract. -type SessionRouterTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SessionRouterFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type SessionRouterFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SessionRouterSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type SessionRouterSession struct { - Contract *SessionRouter // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SessionRouterCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type SessionRouterCallerSession struct { - Contract *SessionRouterCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// SessionRouterTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type SessionRouterTransactorSession struct { - Contract *SessionRouterTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SessionRouterRaw is an auto generated low-level Go binding around an Ethereum contract. -type SessionRouterRaw struct { - Contract *SessionRouter // Generic contract binding to access the raw methods on -} - -// SessionRouterCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type SessionRouterCallerRaw struct { - Contract *SessionRouterCaller // Generic read-only contract binding to access the raw methods on -} - -// SessionRouterTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type SessionRouterTransactorRaw struct { - Contract *SessionRouterTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewSessionRouter creates a new instance of SessionRouter, bound to a specific deployed contract. -func NewSessionRouter(address common.Address, backend bind.ContractBackend) (*SessionRouter, error) { - contract, err := bindSessionRouter(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SessionRouter{SessionRouterCaller: SessionRouterCaller{contract: contract}, SessionRouterTransactor: SessionRouterTransactor{contract: contract}, SessionRouterFilterer: SessionRouterFilterer{contract: contract}}, nil -} - -// NewSessionRouterCaller creates a new read-only instance of SessionRouter, bound to a specific deployed contract. -func NewSessionRouterCaller(address common.Address, caller bind.ContractCaller) (*SessionRouterCaller, error) { - contract, err := bindSessionRouter(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SessionRouterCaller{contract: contract}, nil -} - -// NewSessionRouterTransactor creates a new write-only instance of SessionRouter, bound to a specific deployed contract. -func NewSessionRouterTransactor(address common.Address, transactor bind.ContractTransactor) (*SessionRouterTransactor, error) { - contract, err := bindSessionRouter(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SessionRouterTransactor{contract: contract}, nil -} - -// NewSessionRouterFilterer creates a new log filterer instance of SessionRouter, bound to a specific deployed contract. -func NewSessionRouterFilterer(address common.Address, filterer bind.ContractFilterer) (*SessionRouterFilterer, error) { - contract, err := bindSessionRouter(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SessionRouterFilterer{contract: contract}, nil -} - -// bindSessionRouter binds a generic wrapper to an already deployed contract. -func bindSessionRouter(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SessionRouterMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SessionRouter *SessionRouterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SessionRouter.Contract.SessionRouterCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SessionRouter *SessionRouterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SessionRouter.Contract.SessionRouterTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SessionRouter *SessionRouterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SessionRouter.Contract.SessionRouterTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SessionRouter *SessionRouterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SessionRouter.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SessionRouter *SessionRouterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SessionRouter.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SessionRouter *SessionRouterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SessionRouter.Contract.contract.Transact(opts, method, params...) -} - -// GetEthSignedMessageHash is a free data retrieval call binding the contract method 0xf9aea466. -// -// Solidity: function getEthSignedMessageHash(bytes _encodedMessage) pure returns(bytes32) -func (_SessionRouter *SessionRouterCaller) GetEthSignedMessageHash(opts *bind.CallOpts, _encodedMessage []byte) ([32]byte, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "getEthSignedMessageHash", _encodedMessage) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetEthSignedMessageHash is a free data retrieval call binding the contract method 0xf9aea466. -// -// Solidity: function getEthSignedMessageHash(bytes _encodedMessage) pure returns(bytes32) -func (_SessionRouter *SessionRouterSession) GetEthSignedMessageHash(_encodedMessage []byte) ([32]byte, error) { - return _SessionRouter.Contract.GetEthSignedMessageHash(&_SessionRouter.CallOpts, _encodedMessage) -} - -// GetEthSignedMessageHash is a free data retrieval call binding the contract method 0xf9aea466. -// -// Solidity: function getEthSignedMessageHash(bytes _encodedMessage) pure returns(bytes32) -func (_SessionRouter *SessionRouterCallerSession) GetEthSignedMessageHash(_encodedMessage []byte) ([32]byte, error) { - return _SessionRouter.Contract.GetEthSignedMessageHash(&_SessionRouter.CallOpts, _encodedMessage) -} - -// GetProviderBalance is a free data retrieval call binding the contract method 0x832eea0c. -// -// Solidity: function getProviderBalance(address providerAddr) view returns(uint256 total, uint256 hold) -func (_SessionRouter *SessionRouterCaller) GetProviderBalance(opts *bind.CallOpts, providerAddr common.Address) (struct { - Total *big.Int - Hold *big.Int -}, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "getProviderBalance", providerAddr) - - outstruct := new(struct { - Total *big.Int - Hold *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Total = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.Hold = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// GetProviderBalance is a free data retrieval call binding the contract method 0x832eea0c. -// -// Solidity: function getProviderBalance(address providerAddr) view returns(uint256 total, uint256 hold) -func (_SessionRouter *SessionRouterSession) GetProviderBalance(providerAddr common.Address) (struct { - Total *big.Int - Hold *big.Int -}, error) { - return _SessionRouter.Contract.GetProviderBalance(&_SessionRouter.CallOpts, providerAddr) -} - -// GetProviderBalance is a free data retrieval call binding the contract method 0x832eea0c. -// -// Solidity: function getProviderBalance(address providerAddr) view returns(uint256 total, uint256 hold) -func (_SessionRouter *SessionRouterCallerSession) GetProviderBalance(providerAddr common.Address) (struct { - Total *big.Int - Hold *big.Int -}, error) { - return _SessionRouter.Contract.GetProviderBalance(&_SessionRouter.CallOpts, providerAddr) -} - -// GetProviderClaimBalance is a free data retrieval call binding the contract method 0x6c98599b. -// -// Solidity: function getProviderClaimBalance(address providerAddr) view returns(uint256) -func (_SessionRouter *SessionRouterCaller) GetProviderClaimBalance(opts *bind.CallOpts, providerAddr common.Address) (*big.Int, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "getProviderClaimBalance", providerAddr) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetProviderClaimBalance is a free data retrieval call binding the contract method 0x6c98599b. -// -// Solidity: function getProviderClaimBalance(address providerAddr) view returns(uint256) -func (_SessionRouter *SessionRouterSession) GetProviderClaimBalance(providerAddr common.Address) (*big.Int, error) { - return _SessionRouter.Contract.GetProviderClaimBalance(&_SessionRouter.CallOpts, providerAddr) -} - -// GetProviderClaimBalance is a free data retrieval call binding the contract method 0x6c98599b. -// -// Solidity: function getProviderClaimBalance(address providerAddr) view returns(uint256) -func (_SessionRouter *SessionRouterCallerSession) GetProviderClaimBalance(providerAddr common.Address) (*big.Int, error) { - return _SessionRouter.Contract.GetProviderClaimBalance(&_SessionRouter.CallOpts, providerAddr) -} - -// GetSession is a free data retrieval call binding the contract method 0x39b240bd. -// -// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,uint256,uint256,bytes,uint256,uint256,uint256)) -func (_SessionRouter *SessionRouterCaller) GetSession(opts *bind.CallOpts, sessionId [32]byte) (SessionRouterSession, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "getSession", sessionId) - - if err != nil { - return *new(SessionRouterSession), err - } - - out0 := *abi.ConvertType(out[0], new(SessionRouterSession)).(*SessionRouterSession) - - return out0, err - -} - -// GetSession is a free data retrieval call binding the contract method 0x39b240bd. -// -// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,uint256,uint256,bytes,uint256,uint256,uint256)) -func (_SessionRouter *SessionRouterSession) GetSession(sessionId [32]byte) (SessionRouterSession, error) { - return _SessionRouter.Contract.GetSession(&_SessionRouter.CallOpts, sessionId) -} - -// GetSession is a free data retrieval call binding the contract method 0x39b240bd. -// -// Solidity: function getSession(bytes32 sessionId) view returns((bytes32,address,address,bytes32,uint256,uint256,bytes,uint256,uint256,uint256)) -func (_SessionRouter *SessionRouterCallerSession) GetSession(sessionId [32]byte) (SessionRouterSession, error) { - return _SessionRouter.Contract.GetSession(&_SessionRouter.CallOpts, sessionId) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(uint256) -func (_SessionRouter *SessionRouterCaller) Map(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "map", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(uint256) -func (_SessionRouter *SessionRouterSession) Map(arg0 [32]byte) (*big.Int, error) { - return _SessionRouter.Contract.Map(&_SessionRouter.CallOpts, arg0) -} - -// Map is a free data retrieval call binding the contract method 0x0ae186a8. -// -// Solidity: function map(bytes32 ) view returns(uint256) -func (_SessionRouter *SessionRouterCallerSession) Map(arg0 [32]byte) (*big.Int, error) { - return _SessionRouter.Contract.Map(&_SessionRouter.CallOpts, arg0) -} - -// Marketplace is a free data retrieval call binding the contract method 0xabc8c7af. -// -// Solidity: function marketplace() view returns(address) -func (_SessionRouter *SessionRouterCaller) Marketplace(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "marketplace") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Marketplace is a free data retrieval call binding the contract method 0xabc8c7af. -// -// Solidity: function marketplace() view returns(address) -func (_SessionRouter *SessionRouterSession) Marketplace() (common.Address, error) { - return _SessionRouter.Contract.Marketplace(&_SessionRouter.CallOpts) -} - -// Marketplace is a free data retrieval call binding the contract method 0xabc8c7af. -// -// Solidity: function marketplace() view returns(address) -func (_SessionRouter *SessionRouterCallerSession) Marketplace() (common.Address, error) { - return _SessionRouter.Contract.Marketplace(&_SessionRouter.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_SessionRouter *SessionRouterCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_SessionRouter *SessionRouterSession) Owner() (common.Address, error) { - return _SessionRouter.Contract.Owner(&_SessionRouter.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_SessionRouter *SessionRouterCallerSession) Owner() (common.Address, error) { - return _SessionRouter.Contract.Owner(&_SessionRouter.CallOpts) -} - -// ProviderOnHold is a free data retrieval call binding the contract method 0xdbf7d54f. -// -// Solidity: function providerOnHold(address , uint256 ) view returns(uint256 amount, uint256 releaseAt) -func (_SessionRouter *SessionRouterCaller) ProviderOnHold(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "providerOnHold", arg0, arg1) - - outstruct := new(struct { - Amount *big.Int - ReleaseAt *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Amount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.ReleaseAt = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// ProviderOnHold is a free data retrieval call binding the contract method 0xdbf7d54f. -// -// Solidity: function providerOnHold(address , uint256 ) view returns(uint256 amount, uint256 releaseAt) -func (_SessionRouter *SessionRouterSession) ProviderOnHold(arg0 common.Address, arg1 *big.Int) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - return _SessionRouter.Contract.ProviderOnHold(&_SessionRouter.CallOpts, arg0, arg1) -} - -// ProviderOnHold is a free data retrieval call binding the contract method 0xdbf7d54f. -// -// Solidity: function providerOnHold(address , uint256 ) view returns(uint256 amount, uint256 releaseAt) -func (_SessionRouter *SessionRouterCallerSession) ProviderOnHold(arg0 common.Address, arg1 *big.Int) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - return _SessionRouter.Contract.ProviderOnHold(&_SessionRouter.CallOpts, arg0, arg1) -} - -// RecoverSigner is a free data retrieval call binding the contract method 0x97aba7f9. -// -// Solidity: function recoverSigner(bytes32 message, bytes sig) pure returns(address) -func (_SessionRouter *SessionRouterCaller) RecoverSigner(opts *bind.CallOpts, message [32]byte, sig []byte) (common.Address, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "recoverSigner", message, sig) - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// RecoverSigner is a free data retrieval call binding the contract method 0x97aba7f9. -// -// Solidity: function recoverSigner(bytes32 message, bytes sig) pure returns(address) -func (_SessionRouter *SessionRouterSession) RecoverSigner(message [32]byte, sig []byte) (common.Address, error) { - return _SessionRouter.Contract.RecoverSigner(&_SessionRouter.CallOpts, message, sig) -} - -// RecoverSigner is a free data retrieval call binding the contract method 0x97aba7f9. -// -// Solidity: function recoverSigner(bytes32 message, bytes sig) pure returns(address) -func (_SessionRouter *SessionRouterCallerSession) RecoverSigner(message [32]byte, sig []byte) (common.Address, error) { - return _SessionRouter.Contract.RecoverSigner(&_SessionRouter.CallOpts, message, sig) -} - -// Sessions is a free data retrieval call binding the contract method 0x83c4b7a3. -// -// Solidity: function sessions(uint256 ) view returns(bytes32 id, address user, address provider, bytes32 modelAgentId, uint256 budget, uint256 price, bytes closeoutReceipt, uint256 closeoutType, uint256 openedAt, uint256 closedAt) -func (_SessionRouter *SessionRouterCaller) Sessions(opts *bind.CallOpts, arg0 *big.Int) (struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int -}, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "sessions", arg0) - - outstruct := new(struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Id = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.User = *abi.ConvertType(out[1], new(common.Address)).(*common.Address) - outstruct.Provider = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) - outstruct.ModelAgentId = *abi.ConvertType(out[3], new([32]byte)).(*[32]byte) - outstruct.Budget = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) - outstruct.Price = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) - outstruct.CloseoutReceipt = *abi.ConvertType(out[6], new([]byte)).(*[]byte) - outstruct.CloseoutType = *abi.ConvertType(out[7], new(*big.Int)).(**big.Int) - outstruct.OpenedAt = *abi.ConvertType(out[8], new(*big.Int)).(**big.Int) - outstruct.ClosedAt = *abi.ConvertType(out[9], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// Sessions is a free data retrieval call binding the contract method 0x83c4b7a3. -// -// Solidity: function sessions(uint256 ) view returns(bytes32 id, address user, address provider, bytes32 modelAgentId, uint256 budget, uint256 price, bytes closeoutReceipt, uint256 closeoutType, uint256 openedAt, uint256 closedAt) -func (_SessionRouter *SessionRouterSession) Sessions(arg0 *big.Int) (struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int -}, error) { - return _SessionRouter.Contract.Sessions(&_SessionRouter.CallOpts, arg0) -} - -// Sessions is a free data retrieval call binding the contract method 0x83c4b7a3. -// -// Solidity: function sessions(uint256 ) view returns(bytes32 id, address user, address provider, bytes32 modelAgentId, uint256 budget, uint256 price, bytes closeoutReceipt, uint256 closeoutType, uint256 openedAt, uint256 closedAt) -func (_SessionRouter *SessionRouterCallerSession) Sessions(arg0 *big.Int) (struct { - Id [32]byte - User common.Address - Provider common.Address - ModelAgentId [32]byte - Budget *big.Int - Price *big.Int - CloseoutReceipt []byte - CloseoutType *big.Int - OpenedAt *big.Int - ClosedAt *big.Int -}, error) { - return _SessionRouter.Contract.Sessions(&_SessionRouter.CallOpts, arg0) -} - -// SplitSignature is a free data retrieval call binding the contract method 0xa7bb5803. -// -// Solidity: function splitSignature(bytes sig) pure returns(bytes32 r, bytes32 s, uint8 v) -func (_SessionRouter *SessionRouterCaller) SplitSignature(opts *bind.CallOpts, sig []byte) (struct { - R [32]byte - S [32]byte - V uint8 -}, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "splitSignature", sig) - - outstruct := new(struct { - R [32]byte - S [32]byte - V uint8 - }) - if err != nil { - return *outstruct, err - } - - outstruct.R = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - outstruct.S = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) - outstruct.V = *abi.ConvertType(out[2], new(uint8)).(*uint8) - - return *outstruct, err - -} - -// SplitSignature is a free data retrieval call binding the contract method 0xa7bb5803. -// -// Solidity: function splitSignature(bytes sig) pure returns(bytes32 r, bytes32 s, uint8 v) -func (_SessionRouter *SessionRouterSession) SplitSignature(sig []byte) (struct { - R [32]byte - S [32]byte - V uint8 -}, error) { - return _SessionRouter.Contract.SplitSignature(&_SessionRouter.CallOpts, sig) -} - -// SplitSignature is a free data retrieval call binding the contract method 0xa7bb5803. -// -// Solidity: function splitSignature(bytes sig) pure returns(bytes32 r, bytes32 s, uint8 v) -func (_SessionRouter *SessionRouterCallerSession) SplitSignature(sig []byte) (struct { - R [32]byte - S [32]byte - V uint8 -}, error) { - return _SessionRouter.Contract.SplitSignature(&_SessionRouter.CallOpts, sig) -} - -// StakeDelay is a free data retrieval call binding the contract method 0x946ada60. -// -// Solidity: function stakeDelay() view returns(int256) -func (_SessionRouter *SessionRouterCaller) StakeDelay(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "stakeDelay") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// StakeDelay is a free data retrieval call binding the contract method 0x946ada60. -// -// Solidity: function stakeDelay() view returns(int256) -func (_SessionRouter *SessionRouterSession) StakeDelay() (*big.Int, error) { - return _SessionRouter.Contract.StakeDelay(&_SessionRouter.CallOpts) -} - -// StakeDelay is a free data retrieval call binding the contract method 0x946ada60. -// -// Solidity: function stakeDelay() view returns(int256) -func (_SessionRouter *SessionRouterCallerSession) StakeDelay() (*big.Int, error) { - return _SessionRouter.Contract.StakeDelay(&_SessionRouter.CallOpts) -} - -// StakingDailyStipend is a free data retrieval call binding the contract method 0xfcfc2201. -// -// Solidity: function stakingDailyStipend() view returns(address) -func (_SessionRouter *SessionRouterCaller) StakingDailyStipend(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "stakingDailyStipend") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// StakingDailyStipend is a free data retrieval call binding the contract method 0xfcfc2201. -// -// Solidity: function stakingDailyStipend() view returns(address) -func (_SessionRouter *SessionRouterSession) StakingDailyStipend() (common.Address, error) { - return _SessionRouter.Contract.StakingDailyStipend(&_SessionRouter.CallOpts) -} - -// StakingDailyStipend is a free data retrieval call binding the contract method 0xfcfc2201. -// -// Solidity: function stakingDailyStipend() view returns(address) -func (_SessionRouter *SessionRouterCallerSession) StakingDailyStipend() (common.Address, error) { - return _SessionRouter.Contract.StakingDailyStipend(&_SessionRouter.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_SessionRouter *SessionRouterCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _SessionRouter.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_SessionRouter *SessionRouterSession) Token() (common.Address, error) { - return _SessionRouter.Contract.Token(&_SessionRouter.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_SessionRouter *SessionRouterCallerSession) Token() (common.Address, error) { - return _SessionRouter.Contract.Token(&_SessionRouter.CallOpts) -} - -// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xc9a93c1a. -// -// Solidity: function claimProviderBalance(uint256 amountToWithdraw, address to) returns() -func (_SessionRouter *SessionRouterTransactor) ClaimProviderBalance(opts *bind.TransactOpts, amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "claimProviderBalance", amountToWithdraw, to) -} - -// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xc9a93c1a. -// -// Solidity: function claimProviderBalance(uint256 amountToWithdraw, address to) returns() -func (_SessionRouter *SessionRouterSession) ClaimProviderBalance(amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.ClaimProviderBalance(&_SessionRouter.TransactOpts, amountToWithdraw, to) -} - -// ClaimProviderBalance is a paid mutator transaction binding the contract method 0xc9a93c1a. -// -// Solidity: function claimProviderBalance(uint256 amountToWithdraw, address to) returns() -func (_SessionRouter *SessionRouterTransactorSession) ClaimProviderBalance(amountToWithdraw *big.Int, to common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.ClaimProviderBalance(&_SessionRouter.TransactOpts, amountToWithdraw, to) -} - -// CloseSession is a paid mutator transaction binding the contract method 0x9775d1ff. -// -// Solidity: function closeSession(bytes32 sessionId, bytes receiptEncoded, bytes signature) returns() -func (_SessionRouter *SessionRouterTransactor) CloseSession(opts *bind.TransactOpts, sessionId [32]byte, receiptEncoded []byte, signature []byte) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "closeSession", sessionId, receiptEncoded, signature) -} - -// CloseSession is a paid mutator transaction binding the contract method 0x9775d1ff. -// -// Solidity: function closeSession(bytes32 sessionId, bytes receiptEncoded, bytes signature) returns() -func (_SessionRouter *SessionRouterSession) CloseSession(sessionId [32]byte, receiptEncoded []byte, signature []byte) (*types.Transaction, error) { - return _SessionRouter.Contract.CloseSession(&_SessionRouter.TransactOpts, sessionId, receiptEncoded, signature) -} - -// CloseSession is a paid mutator transaction binding the contract method 0x9775d1ff. -// -// Solidity: function closeSession(bytes32 sessionId, bytes receiptEncoded, bytes signature) returns() -func (_SessionRouter *SessionRouterTransactorSession) CloseSession(sessionId [32]byte, receiptEncoded []byte, signature []byte) (*types.Transaction, error) { - return _SessionRouter.Contract.CloseSession(&_SessionRouter.TransactOpts, sessionId, receiptEncoded, signature) -} - -// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. -// -// Solidity: function deleteHistory(bytes32 sessionId) returns() -func (_SessionRouter *SessionRouterTransactor) DeleteHistory(opts *bind.TransactOpts, sessionId [32]byte) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "deleteHistory", sessionId) -} - -// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. -// -// Solidity: function deleteHistory(bytes32 sessionId) returns() -func (_SessionRouter *SessionRouterSession) DeleteHistory(sessionId [32]byte) (*types.Transaction, error) { - return _SessionRouter.Contract.DeleteHistory(&_SessionRouter.TransactOpts, sessionId) -} - -// DeleteHistory is a paid mutator transaction binding the contract method 0xf074ca6b. -// -// Solidity: function deleteHistory(bytes32 sessionId) returns() -func (_SessionRouter *SessionRouterTransactorSession) DeleteHistory(sessionId [32]byte) (*types.Transaction, error) { - return _SessionRouter.Contract.DeleteHistory(&_SessionRouter.TransactOpts, sessionId) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address _stakingDailyStipend, address _marketplace) returns() -func (_SessionRouter *SessionRouterTransactor) Initialize(opts *bind.TransactOpts, _token common.Address, _stakingDailyStipend common.Address, _marketplace common.Address) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "initialize", _token, _stakingDailyStipend, _marketplace) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address _stakingDailyStipend, address _marketplace) returns() -func (_SessionRouter *SessionRouterSession) Initialize(_token common.Address, _stakingDailyStipend common.Address, _marketplace common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.Initialize(&_SessionRouter.TransactOpts, _token, _stakingDailyStipend, _marketplace) -} - -// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. -// -// Solidity: function initialize(address _token, address _stakingDailyStipend, address _marketplace) returns() -func (_SessionRouter *SessionRouterTransactorSession) Initialize(_token common.Address, _stakingDailyStipend common.Address, _marketplace common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.Initialize(&_SessionRouter.TransactOpts, _token, _stakingDailyStipend, _marketplace) -} - -// OpenSession is a paid mutator transaction binding the contract method 0x48c00c90. -// -// Solidity: function openSession(bytes32 bidId, uint256 budget) returns(bytes32 sessionId) -func (_SessionRouter *SessionRouterTransactor) OpenSession(opts *bind.TransactOpts, bidId [32]byte, budget *big.Int) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "openSession", bidId, budget) -} - -// OpenSession is a paid mutator transaction binding the contract method 0x48c00c90. -// -// Solidity: function openSession(bytes32 bidId, uint256 budget) returns(bytes32 sessionId) -func (_SessionRouter *SessionRouterSession) OpenSession(bidId [32]byte, budget *big.Int) (*types.Transaction, error) { - return _SessionRouter.Contract.OpenSession(&_SessionRouter.TransactOpts, bidId, budget) -} - -// OpenSession is a paid mutator transaction binding the contract method 0x48c00c90. -// -// Solidity: function openSession(bytes32 bidId, uint256 budget) returns(bytes32 sessionId) -func (_SessionRouter *SessionRouterTransactorSession) OpenSession(bidId [32]byte, budget *big.Int) (*types.Transaction, error) { - return _SessionRouter.Contract.OpenSession(&_SessionRouter.TransactOpts, bidId, budget) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_SessionRouter *SessionRouterTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_SessionRouter *SessionRouterSession) RenounceOwnership() (*types.Transaction, error) { - return _SessionRouter.Contract.RenounceOwnership(&_SessionRouter.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_SessionRouter *SessionRouterTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _SessionRouter.Contract.RenounceOwnership(&_SessionRouter.TransactOpts) -} - -// SetStakeDelay is a paid mutator transaction binding the contract method 0x3cadd8bb. -// -// Solidity: function setStakeDelay(int256 delay) returns() -func (_SessionRouter *SessionRouterTransactor) SetStakeDelay(opts *bind.TransactOpts, delay *big.Int) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "setStakeDelay", delay) -} - -// SetStakeDelay is a paid mutator transaction binding the contract method 0x3cadd8bb. -// -// Solidity: function setStakeDelay(int256 delay) returns() -func (_SessionRouter *SessionRouterSession) SetStakeDelay(delay *big.Int) (*types.Transaction, error) { - return _SessionRouter.Contract.SetStakeDelay(&_SessionRouter.TransactOpts, delay) -} - -// SetStakeDelay is a paid mutator transaction binding the contract method 0x3cadd8bb. -// -// Solidity: function setStakeDelay(int256 delay) returns() -func (_SessionRouter *SessionRouterTransactorSession) SetStakeDelay(delay *big.Int) (*types.Transaction, error) { - return _SessionRouter.Contract.SetStakeDelay(&_SessionRouter.TransactOpts, delay) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_SessionRouter *SessionRouterTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _SessionRouter.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_SessionRouter *SessionRouterSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.TransferOwnership(&_SessionRouter.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_SessionRouter *SessionRouterTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _SessionRouter.Contract.TransferOwnership(&_SessionRouter.TransactOpts, newOwner) -} - -// SessionRouterInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the SessionRouter contract. -type SessionRouterInitializedIterator struct { - Event *SessionRouterInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterInitialized represents a Initialized event raised by the SessionRouter contract. -type SessionRouterInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_SessionRouter *SessionRouterFilterer) FilterInitialized(opts *bind.FilterOpts) (*SessionRouterInitializedIterator, error) { - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &SessionRouterInitializedIterator{contract: _SessionRouter.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_SessionRouter *SessionRouterFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *SessionRouterInitialized) (event.Subscription, error) { - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterInitialized) - if err := _SessionRouter.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_SessionRouter *SessionRouterFilterer) ParseInitialized(log types.Log) (*SessionRouterInitialized, error) { - event := new(SessionRouterInitialized) - if err := _SessionRouter.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the SessionRouter contract. -type SessionRouterOwnershipTransferredIterator struct { - Event *SessionRouterOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterOwnershipTransferred represents a OwnershipTransferred event raised by the SessionRouter contract. -type SessionRouterOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_SessionRouter *SessionRouterFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*SessionRouterOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &SessionRouterOwnershipTransferredIterator{contract: _SessionRouter.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_SessionRouter *SessionRouterFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *SessionRouterOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterOwnershipTransferred) - if err := _SessionRouter.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_SessionRouter *SessionRouterFilterer) ParseOwnershipTransferred(log types.Log) (*SessionRouterOwnershipTransferred, error) { - event := new(SessionRouterOwnershipTransferred) - if err := _SessionRouter.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterProviderClaimedIterator is returned from FilterProviderClaimed and is used to iterate over the raw logs and unpacked data for ProviderClaimed events raised by the SessionRouter contract. -type SessionRouterProviderClaimedIterator struct { - Event *SessionRouterProviderClaimed // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterProviderClaimedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterProviderClaimed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterProviderClaimed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterProviderClaimedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterProviderClaimedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterProviderClaimed represents a ProviderClaimed event raised by the SessionRouter contract. -type SessionRouterProviderClaimed struct { - ProviderAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterProviderClaimed is a free log retrieval operation binding the contract event 0x1cd322e3d02eade120b8dceb43a6c1dee437af36e7acd81726c4b54adf5584c2. -// -// Solidity: event ProviderClaimed(address indexed providerAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) FilterProviderClaimed(opts *bind.FilterOpts, providerAddress []common.Address) (*SessionRouterProviderClaimedIterator, error) { - - var providerAddressRule []interface{} - for _, providerAddressItem := range providerAddress { - providerAddressRule = append(providerAddressRule, providerAddressItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "ProviderClaimed", providerAddressRule) - if err != nil { - return nil, err - } - return &SessionRouterProviderClaimedIterator{contract: _SessionRouter.contract, event: "ProviderClaimed", logs: logs, sub: sub}, nil -} - -// WatchProviderClaimed is a free log subscription operation binding the contract event 0x1cd322e3d02eade120b8dceb43a6c1dee437af36e7acd81726c4b54adf5584c2. -// -// Solidity: event ProviderClaimed(address indexed providerAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) WatchProviderClaimed(opts *bind.WatchOpts, sink chan<- *SessionRouterProviderClaimed, providerAddress []common.Address) (event.Subscription, error) { - - var providerAddressRule []interface{} - for _, providerAddressItem := range providerAddress { - providerAddressRule = append(providerAddressRule, providerAddressItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "ProviderClaimed", providerAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterProviderClaimed) - if err := _SessionRouter.contract.UnpackLog(event, "ProviderClaimed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseProviderClaimed is a log parse operation binding the contract event 0x1cd322e3d02eade120b8dceb43a6c1dee437af36e7acd81726c4b54adf5584c2. -// -// Solidity: event ProviderClaimed(address indexed providerAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) ParseProviderClaimed(log types.Log) (*SessionRouterProviderClaimed, error) { - event := new(SessionRouterProviderClaimed) - if err := _SessionRouter.contract.UnpackLog(event, "ProviderClaimed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterSessionClosedIterator is returned from FilterSessionClosed and is used to iterate over the raw logs and unpacked data for SessionClosed events raised by the SessionRouter contract. -type SessionRouterSessionClosedIterator struct { - Event *SessionRouterSessionClosed // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterSessionClosedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterSessionClosed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterSessionClosed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterSessionClosedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterSessionClosedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterSessionClosed represents a SessionClosed event raised by the SessionRouter contract. -type SessionRouterSessionClosed struct { - UserAddress common.Address - SessionId [32]byte - ProviderId common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSessionClosed is a free log retrieval operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. -// -// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) FilterSessionClosed(opts *bind.FilterOpts, userAddress []common.Address, sessionId [][32]byte, providerId []common.Address) (*SessionRouterSessionClosedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - var sessionIdRule []interface{} - for _, sessionIdItem := range sessionId { - sessionIdRule = append(sessionIdRule, sessionIdItem) - } - var providerIdRule []interface{} - for _, providerIdItem := range providerId { - providerIdRule = append(providerIdRule, providerIdItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "SessionClosed", userAddressRule, sessionIdRule, providerIdRule) - if err != nil { - return nil, err - } - return &SessionRouterSessionClosedIterator{contract: _SessionRouter.contract, event: "SessionClosed", logs: logs, sub: sub}, nil -} - -// WatchSessionClosed is a free log subscription operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. -// -// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) WatchSessionClosed(opts *bind.WatchOpts, sink chan<- *SessionRouterSessionClosed, userAddress []common.Address, sessionId [][32]byte, providerId []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - var sessionIdRule []interface{} - for _, sessionIdItem := range sessionId { - sessionIdRule = append(sessionIdRule, sessionIdItem) - } - var providerIdRule []interface{} - for _, providerIdItem := range providerId { - providerIdRule = append(providerIdRule, providerIdItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "SessionClosed", userAddressRule, sessionIdRule, providerIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterSessionClosed) - if err := _SessionRouter.contract.UnpackLog(event, "SessionClosed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseSessionClosed is a log parse operation binding the contract event 0x337fbb0a41a596db800dc836595a57815f967185e3596615c646f2455ac3914a. -// -// Solidity: event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) ParseSessionClosed(log types.Log) (*SessionRouterSessionClosed, error) { - event := new(SessionRouterSessionClosed) - if err := _SessionRouter.contract.UnpackLog(event, "SessionClosed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterSessionOpenedIterator is returned from FilterSessionOpened and is used to iterate over the raw logs and unpacked data for SessionOpened events raised by the SessionRouter contract. -type SessionRouterSessionOpenedIterator struct { - Event *SessionRouterSessionOpened // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterSessionOpenedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterSessionOpened) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterSessionOpened) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterSessionOpenedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterSessionOpenedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterSessionOpened represents a SessionOpened event raised by the SessionRouter contract. -type SessionRouterSessionOpened struct { - UserAddress common.Address - SessionId [32]byte - ProviderId common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSessionOpened is a free log retrieval operation binding the contract event 0x2bd7c890baf595977d256a6e784512c873ac58ba612b4895dbb7f784bfbf4839. -// -// Solidity: event SessionOpened(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) FilterSessionOpened(opts *bind.FilterOpts, userAddress []common.Address, sessionId [][32]byte, providerId []common.Address) (*SessionRouterSessionOpenedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - var sessionIdRule []interface{} - for _, sessionIdItem := range sessionId { - sessionIdRule = append(sessionIdRule, sessionIdItem) - } - var providerIdRule []interface{} - for _, providerIdItem := range providerId { - providerIdRule = append(providerIdRule, providerIdItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "SessionOpened", userAddressRule, sessionIdRule, providerIdRule) - if err != nil { - return nil, err - } - return &SessionRouterSessionOpenedIterator{contract: _SessionRouter.contract, event: "SessionOpened", logs: logs, sub: sub}, nil -} - -// WatchSessionOpened is a free log subscription operation binding the contract event 0x2bd7c890baf595977d256a6e784512c873ac58ba612b4895dbb7f784bfbf4839. -// -// Solidity: event SessionOpened(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) WatchSessionOpened(opts *bind.WatchOpts, sink chan<- *SessionRouterSessionOpened, userAddress []common.Address, sessionId [][32]byte, providerId []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - var sessionIdRule []interface{} - for _, sessionIdItem := range sessionId { - sessionIdRule = append(sessionIdRule, sessionIdItem) - } - var providerIdRule []interface{} - for _, providerIdItem := range providerId { - providerIdRule = append(providerIdRule, providerIdItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "SessionOpened", userAddressRule, sessionIdRule, providerIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterSessionOpened) - if err := _SessionRouter.contract.UnpackLog(event, "SessionOpened", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseSessionOpened is a log parse operation binding the contract event 0x2bd7c890baf595977d256a6e784512c873ac58ba612b4895dbb7f784bfbf4839. -// -// Solidity: event SessionOpened(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId) -func (_SessionRouter *SessionRouterFilterer) ParseSessionOpened(log types.Log) (*SessionRouterSessionOpened, error) { - event := new(SessionRouterSessionOpened) - if err := _SessionRouter.contract.UnpackLog(event, "SessionOpened", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterStakedIterator is returned from FilterStaked and is used to iterate over the raw logs and unpacked data for Staked events raised by the SessionRouter contract. -type SessionRouterStakedIterator struct { - Event *SessionRouterStaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterStakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterStakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterStakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterStaked represents a Staked event raised by the SessionRouter contract. -type SessionRouterStaked struct { - UserAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterStaked is a free log retrieval operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) FilterStaked(opts *bind.FilterOpts, userAddress []common.Address) (*SessionRouterStakedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "Staked", userAddressRule) - if err != nil { - return nil, err - } - return &SessionRouterStakedIterator{contract: _SessionRouter.contract, event: "Staked", logs: logs, sub: sub}, nil -} - -// WatchStaked is a free log subscription operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) WatchStaked(opts *bind.WatchOpts, sink chan<- *SessionRouterStaked, userAddress []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "Staked", userAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterStaked) - if err := _SessionRouter.contract.UnpackLog(event, "Staked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseStaked is a log parse operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) ParseStaked(log types.Log) (*SessionRouterStaked, error) { - event := new(SessionRouterStaked) - if err := _SessionRouter.contract.UnpackLog(event, "Staked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SessionRouterUnstakedIterator is returned from FilterUnstaked and is used to iterate over the raw logs and unpacked data for Unstaked events raised by the SessionRouter contract. -type SessionRouterUnstakedIterator struct { - Event *SessionRouterUnstaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SessionRouterUnstakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SessionRouterUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SessionRouterUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SessionRouterUnstakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SessionRouterUnstakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SessionRouterUnstaked represents a Unstaked event raised by the SessionRouter contract. -type SessionRouterUnstaked struct { - UserAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUnstaked is a free log retrieval operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) FilterUnstaked(opts *bind.FilterOpts, userAddress []common.Address) (*SessionRouterUnstakedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _SessionRouter.contract.FilterLogs(opts, "Unstaked", userAddressRule) - if err != nil { - return nil, err - } - return &SessionRouterUnstakedIterator{contract: _SessionRouter.contract, event: "Unstaked", logs: logs, sub: sub}, nil -} - -// WatchUnstaked is a free log subscription operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) WatchUnstaked(opts *bind.WatchOpts, sink chan<- *SessionRouterUnstaked, userAddress []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _SessionRouter.contract.WatchLogs(opts, "Unstaked", userAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SessionRouterUnstaked) - if err := _SessionRouter.contract.UnpackLog(event, "Unstaked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUnstaked is a log parse operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_SessionRouter *SessionRouterFilterer) ParseUnstaked(log types.Log) (*SessionRouterUnstaked, error) { - event := new(SessionRouterUnstaked) - if err := _SessionRouter.contract.UnpackLog(event, "Unstaked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/smart-contracts/bindings/go/contracts/stakingdailystipend/StakingDailyStipend.go b/smart-contracts/bindings/go/contracts/stakingdailystipend/StakingDailyStipend.go deleted file mode 100644 index 08a3dbdf..00000000 --- a/smart-contracts/bindings/go/contracts/stakingdailystipend/StakingDailyStipend.go +++ /dev/null @@ -1,1291 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package stakingdailystipend - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// StakingDailyStipendMetaData contains all meta data concerning the StakingDailyStipend contract. -var StakingDailyStipendMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"NotEnoughDailyStipend\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughStake\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSenderOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSessionRouterOrOwner\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"}],\"name\":\"balanceOfDailyStipend\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getComputeBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"}],\"name\":\"getStakeOnHold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTodaysBudget\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"}],\"name\":\"getTodaysSpend\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tokenAccount\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"returnStipend\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sessionRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"todaysSpend\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"releaseAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferDailyStipend\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sendToAddr\",\"type\":\"address\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"userAddress\",\"type\":\"address\"}],\"name\":\"withdrawableStakeBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// StakingDailyStipendABI is the input ABI used to generate the binding from. -// Deprecated: Use StakingDailyStipendMetaData.ABI instead. -var StakingDailyStipendABI = StakingDailyStipendMetaData.ABI - -// StakingDailyStipend is an auto generated Go binding around an Ethereum contract. -type StakingDailyStipend struct { - StakingDailyStipendCaller // Read-only binding to the contract - StakingDailyStipendTransactor // Write-only binding to the contract - StakingDailyStipendFilterer // Log filterer for contract events -} - -// StakingDailyStipendCaller is an auto generated read-only Go binding around an Ethereum contract. -type StakingDailyStipendCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingDailyStipendTransactor is an auto generated write-only Go binding around an Ethereum contract. -type StakingDailyStipendTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingDailyStipendFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type StakingDailyStipendFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingDailyStipendSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type StakingDailyStipendSession struct { - Contract *StakingDailyStipend // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// StakingDailyStipendCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type StakingDailyStipendCallerSession struct { - Contract *StakingDailyStipendCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// StakingDailyStipendTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type StakingDailyStipendTransactorSession struct { - Contract *StakingDailyStipendTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// StakingDailyStipendRaw is an auto generated low-level Go binding around an Ethereum contract. -type StakingDailyStipendRaw struct { - Contract *StakingDailyStipend // Generic contract binding to access the raw methods on -} - -// StakingDailyStipendCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type StakingDailyStipendCallerRaw struct { - Contract *StakingDailyStipendCaller // Generic read-only contract binding to access the raw methods on -} - -// StakingDailyStipendTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type StakingDailyStipendTransactorRaw struct { - Contract *StakingDailyStipendTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewStakingDailyStipend creates a new instance of StakingDailyStipend, bound to a specific deployed contract. -func NewStakingDailyStipend(address common.Address, backend bind.ContractBackend) (*StakingDailyStipend, error) { - contract, err := bindStakingDailyStipend(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &StakingDailyStipend{StakingDailyStipendCaller: StakingDailyStipendCaller{contract: contract}, StakingDailyStipendTransactor: StakingDailyStipendTransactor{contract: contract}, StakingDailyStipendFilterer: StakingDailyStipendFilterer{contract: contract}}, nil -} - -// NewStakingDailyStipendCaller creates a new read-only instance of StakingDailyStipend, bound to a specific deployed contract. -func NewStakingDailyStipendCaller(address common.Address, caller bind.ContractCaller) (*StakingDailyStipendCaller, error) { - contract, err := bindStakingDailyStipend(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &StakingDailyStipendCaller{contract: contract}, nil -} - -// NewStakingDailyStipendTransactor creates a new write-only instance of StakingDailyStipend, bound to a specific deployed contract. -func NewStakingDailyStipendTransactor(address common.Address, transactor bind.ContractTransactor) (*StakingDailyStipendTransactor, error) { - contract, err := bindStakingDailyStipend(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &StakingDailyStipendTransactor{contract: contract}, nil -} - -// NewStakingDailyStipendFilterer creates a new log filterer instance of StakingDailyStipend, bound to a specific deployed contract. -func NewStakingDailyStipendFilterer(address common.Address, filterer bind.ContractFilterer) (*StakingDailyStipendFilterer, error) { - contract, err := bindStakingDailyStipend(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &StakingDailyStipendFilterer{contract: contract}, nil -} - -// bindStakingDailyStipend binds a generic wrapper to an already deployed contract. -func bindStakingDailyStipend(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := StakingDailyStipendMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_StakingDailyStipend *StakingDailyStipendRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StakingDailyStipend.Contract.StakingDailyStipendCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_StakingDailyStipend *StakingDailyStipendRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.StakingDailyStipendTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_StakingDailyStipend *StakingDailyStipendRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.StakingDailyStipendTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_StakingDailyStipend *StakingDailyStipendCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StakingDailyStipend.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_StakingDailyStipend *StakingDailyStipendTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_StakingDailyStipend *StakingDailyStipendTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.contract.Transact(opts, method, params...) -} - -// BalanceOfDailyStipend is a free data retrieval call binding the contract method 0xf0612b48. -// -// Solidity: function balanceOfDailyStipend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) BalanceOfDailyStipend(opts *bind.CallOpts, userAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "balanceOfDailyStipend", userAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// BalanceOfDailyStipend is a free data retrieval call binding the contract method 0xf0612b48. -// -// Solidity: function balanceOfDailyStipend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) BalanceOfDailyStipend(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.BalanceOfDailyStipend(&_StakingDailyStipend.CallOpts, userAddress) -} - -// BalanceOfDailyStipend is a free data retrieval call binding the contract method 0xf0612b48. -// -// Solidity: function balanceOfDailyStipend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) BalanceOfDailyStipend(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.BalanceOfDailyStipend(&_StakingDailyStipend.CallOpts, userAddress) -} - -// GetComputeBalance is a free data retrieval call binding the contract method 0x653cdf0c. -// -// Solidity: function getComputeBalance() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) GetComputeBalance(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "getComputeBalance") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetComputeBalance is a free data retrieval call binding the contract method 0x653cdf0c. -// -// Solidity: function getComputeBalance() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) GetComputeBalance() (*big.Int, error) { - return _StakingDailyStipend.Contract.GetComputeBalance(&_StakingDailyStipend.CallOpts) -} - -// GetComputeBalance is a free data retrieval call binding the contract method 0x653cdf0c. -// -// Solidity: function getComputeBalance() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) GetComputeBalance() (*big.Int, error) { - return _StakingDailyStipend.Contract.GetComputeBalance(&_StakingDailyStipend.CallOpts) -} - -// GetStakeOnHold is a free data retrieval call binding the contract method 0x9bc65da5. -// -// Solidity: function getStakeOnHold(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) GetStakeOnHold(opts *bind.CallOpts, userAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "getStakeOnHold", userAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetStakeOnHold is a free data retrieval call binding the contract method 0x9bc65da5. -// -// Solidity: function getStakeOnHold(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) GetStakeOnHold(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.GetStakeOnHold(&_StakingDailyStipend.CallOpts, userAddress) -} - -// GetStakeOnHold is a free data retrieval call binding the contract method 0x9bc65da5. -// -// Solidity: function getStakeOnHold(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) GetStakeOnHold(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.GetStakeOnHold(&_StakingDailyStipend.CallOpts, userAddress) -} - -// GetTodaysBudget is a free data retrieval call binding the contract method 0xa7e7f9a9. -// -// Solidity: function getTodaysBudget() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) GetTodaysBudget(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "getTodaysBudget") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetTodaysBudget is a free data retrieval call binding the contract method 0xa7e7f9a9. -// -// Solidity: function getTodaysBudget() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) GetTodaysBudget() (*big.Int, error) { - return _StakingDailyStipend.Contract.GetTodaysBudget(&_StakingDailyStipend.CallOpts) -} - -// GetTodaysBudget is a free data retrieval call binding the contract method 0xa7e7f9a9. -// -// Solidity: function getTodaysBudget() view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) GetTodaysBudget() (*big.Int, error) { - return _StakingDailyStipend.Contract.GetTodaysBudget(&_StakingDailyStipend.CallOpts) -} - -// GetTodaysSpend is a free data retrieval call binding the contract method 0x02fc4ec8. -// -// Solidity: function getTodaysSpend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) GetTodaysSpend(opts *bind.CallOpts, userAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "getTodaysSpend", userAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetTodaysSpend is a free data retrieval call binding the contract method 0x02fc4ec8. -// -// Solidity: function getTodaysSpend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) GetTodaysSpend(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.GetTodaysSpend(&_StakingDailyStipend.CallOpts, userAddress) -} - -// GetTodaysSpend is a free data retrieval call binding the contract method 0x02fc4ec8. -// -// Solidity: function getTodaysSpend(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) GetTodaysSpend(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.GetTodaysSpend(&_StakingDailyStipend.CallOpts, userAddress) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendSession) Owner() (common.Address, error) { - return _StakingDailyStipend.Contract.Owner(&_StakingDailyStipend.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) Owner() (common.Address, error) { - return _StakingDailyStipend.Contract.Owner(&_StakingDailyStipend.CallOpts) -} - -// SessionRouter is a free data retrieval call binding the contract method 0x707ba08a. -// -// Solidity: function sessionRouter() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCaller) SessionRouter(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "sessionRouter") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// SessionRouter is a free data retrieval call binding the contract method 0x707ba08a. -// -// Solidity: function sessionRouter() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendSession) SessionRouter() (common.Address, error) { - return _StakingDailyStipend.Contract.SessionRouter(&_StakingDailyStipend.CallOpts) -} - -// SessionRouter is a free data retrieval call binding the contract method 0x707ba08a. -// -// Solidity: function sessionRouter() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) SessionRouter() (common.Address, error) { - return _StakingDailyStipend.Contract.SessionRouter(&_StakingDailyStipend.CallOpts) -} - -// TodaysSpend is a free data retrieval call binding the contract method 0x9b6e4a06. -// -// Solidity: function todaysSpend(address ) view returns(uint256 amount, uint256 releaseAt) -func (_StakingDailyStipend *StakingDailyStipendCaller) TodaysSpend(opts *bind.CallOpts, arg0 common.Address) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "todaysSpend", arg0) - - outstruct := new(struct { - Amount *big.Int - ReleaseAt *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Amount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.ReleaseAt = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// TodaysSpend is a free data retrieval call binding the contract method 0x9b6e4a06. -// -// Solidity: function todaysSpend(address ) view returns(uint256 amount, uint256 releaseAt) -func (_StakingDailyStipend *StakingDailyStipendSession) TodaysSpend(arg0 common.Address) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - return _StakingDailyStipend.Contract.TodaysSpend(&_StakingDailyStipend.CallOpts, arg0) -} - -// TodaysSpend is a free data retrieval call binding the contract method 0x9b6e4a06. -// -// Solidity: function todaysSpend(address ) view returns(uint256 amount, uint256 releaseAt) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) TodaysSpend(arg0 common.Address) (struct { - Amount *big.Int - ReleaseAt *big.Int -}, error) { - return _StakingDailyStipend.Contract.TodaysSpend(&_StakingDailyStipend.CallOpts, arg0) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCaller) Token(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "token") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendSession) Token() (common.Address, error) { - return _StakingDailyStipend.Contract.Token(&_StakingDailyStipend.CallOpts) -} - -// Token is a free data retrieval call binding the contract method 0xfc0c546a. -// -// Solidity: function token() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) Token() (common.Address, error) { - return _StakingDailyStipend.Contract.Token(&_StakingDailyStipend.CallOpts) -} - -// TokenAccount is a free data retrieval call binding the contract method 0x30ddebcb. -// -// Solidity: function tokenAccount() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCaller) TokenAccount(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "tokenAccount") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// TokenAccount is a free data retrieval call binding the contract method 0x30ddebcb. -// -// Solidity: function tokenAccount() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendSession) TokenAccount() (common.Address, error) { - return _StakingDailyStipend.Contract.TokenAccount(&_StakingDailyStipend.CallOpts) -} - -// TokenAccount is a free data retrieval call binding the contract method 0x30ddebcb. -// -// Solidity: function tokenAccount() view returns(address) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) TokenAccount() (common.Address, error) { - return _StakingDailyStipend.Contract.TokenAccount(&_StakingDailyStipend.CallOpts) -} - -// UserStake is a free data retrieval call binding the contract method 0x68e5585d. -// -// Solidity: function userStake(address ) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) UserStake(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "userStake", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// UserStake is a free data retrieval call binding the contract method 0x68e5585d. -// -// Solidity: function userStake(address ) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) UserStake(arg0 common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.UserStake(&_StakingDailyStipend.CallOpts, arg0) -} - -// UserStake is a free data retrieval call binding the contract method 0x68e5585d. -// -// Solidity: function userStake(address ) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) UserStake(arg0 common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.UserStake(&_StakingDailyStipend.CallOpts, arg0) -} - -// WithdrawableStakeBalance is a free data retrieval call binding the contract method 0x7594e4d9. -// -// Solidity: function withdrawableStakeBalance(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCaller) WithdrawableStakeBalance(opts *bind.CallOpts, userAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _StakingDailyStipend.contract.Call(opts, &out, "withdrawableStakeBalance", userAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// WithdrawableStakeBalance is a free data retrieval call binding the contract method 0x7594e4d9. -// -// Solidity: function withdrawableStakeBalance(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendSession) WithdrawableStakeBalance(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.WithdrawableStakeBalance(&_StakingDailyStipend.CallOpts, userAddress) -} - -// WithdrawableStakeBalance is a free data retrieval call binding the contract method 0x7594e4d9. -// -// Solidity: function withdrawableStakeBalance(address userAddress) view returns(uint256) -func (_StakingDailyStipend *StakingDailyStipendCallerSession) WithdrawableStakeBalance(userAddress common.Address) (*big.Int, error) { - return _StakingDailyStipend.Contract.WithdrawableStakeBalance(&_StakingDailyStipend.CallOpts, userAddress) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _token, address _tokenAccount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) Initialize(opts *bind.TransactOpts, _token common.Address, _tokenAccount common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "initialize", _token, _tokenAccount) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _token, address _tokenAccount) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) Initialize(_token common.Address, _tokenAccount common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Initialize(&_StakingDailyStipend.TransactOpts, _token, _tokenAccount) -} - -// Initialize is a paid mutator transaction binding the contract method 0x485cc955. -// -// Solidity: function initialize(address _token, address _tokenAccount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) Initialize(_token common.Address, _tokenAccount common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Initialize(&_StakingDailyStipend.TransactOpts, _token, _tokenAccount) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StakingDailyStipend *StakingDailyStipendSession) RenounceOwnership() (*types.Transaction, error) { - return _StakingDailyStipend.Contract.RenounceOwnership(&_StakingDailyStipend.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _StakingDailyStipend.Contract.RenounceOwnership(&_StakingDailyStipend.TransactOpts) -} - -// ReturnStipend is a paid mutator transaction binding the contract method 0x93c87377. -// -// Solidity: function returnStipend(address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) ReturnStipend(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "returnStipend", to, amount) -} - -// ReturnStipend is a paid mutator transaction binding the contract method 0x93c87377. -// -// Solidity: function returnStipend(address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) ReturnStipend(to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.ReturnStipend(&_StakingDailyStipend.TransactOpts, to, amount) -} - -// ReturnStipend is a paid mutator transaction binding the contract method 0x93c87377. -// -// Solidity: function returnStipend(address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) ReturnStipend(to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.ReturnStipend(&_StakingDailyStipend.TransactOpts, to, amount) -} - -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. -// -// Solidity: function stake(address addr, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) Stake(opts *bind.TransactOpts, addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "stake", addr, amount) -} - -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. -// -// Solidity: function stake(address addr, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) Stake(addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Stake(&_StakingDailyStipend.TransactOpts, addr, amount) -} - -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. -// -// Solidity: function stake(address addr, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) Stake(addr common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Stake(&_StakingDailyStipend.TransactOpts, addr, amount) -} - -// TransferDailyStipend is a paid mutator transaction binding the contract method 0x93a7483a. -// -// Solidity: function transferDailyStipend(address from, address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) TransferDailyStipend(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "transferDailyStipend", from, to, amount) -} - -// TransferDailyStipend is a paid mutator transaction binding the contract method 0x93a7483a. -// -// Solidity: function transferDailyStipend(address from, address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) TransferDailyStipend(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.TransferDailyStipend(&_StakingDailyStipend.TransactOpts, from, to, amount) -} - -// TransferDailyStipend is a paid mutator transaction binding the contract method 0x93a7483a. -// -// Solidity: function transferDailyStipend(address from, address to, uint256 amount) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) TransferDailyStipend(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.TransferDailyStipend(&_StakingDailyStipend.TransactOpts, from, to, amount) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.TransferOwnership(&_StakingDailyStipend.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.TransferOwnership(&_StakingDailyStipend.TransactOpts, newOwner) -} - -// Unstake is a paid mutator transaction binding the contract method 0x926e31d6. -// -// Solidity: function unstake(address addr, uint256 amount, address sendToAddr) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactor) Unstake(opts *bind.TransactOpts, addr common.Address, amount *big.Int, sendToAddr common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.contract.Transact(opts, "unstake", addr, amount, sendToAddr) -} - -// Unstake is a paid mutator transaction binding the contract method 0x926e31d6. -// -// Solidity: function unstake(address addr, uint256 amount, address sendToAddr) returns() -func (_StakingDailyStipend *StakingDailyStipendSession) Unstake(addr common.Address, amount *big.Int, sendToAddr common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Unstake(&_StakingDailyStipend.TransactOpts, addr, amount, sendToAddr) -} - -// Unstake is a paid mutator transaction binding the contract method 0x926e31d6. -// -// Solidity: function unstake(address addr, uint256 amount, address sendToAddr) returns() -func (_StakingDailyStipend *StakingDailyStipendTransactorSession) Unstake(addr common.Address, amount *big.Int, sendToAddr common.Address) (*types.Transaction, error) { - return _StakingDailyStipend.Contract.Unstake(&_StakingDailyStipend.TransactOpts, addr, amount, sendToAddr) -} - -// StakingDailyStipendInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the StakingDailyStipend contract. -type StakingDailyStipendInitializedIterator struct { - Event *StakingDailyStipendInitialized // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingDailyStipendInitializedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingDailyStipendInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingDailyStipendInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingDailyStipendInitialized represents a Initialized event raised by the StakingDailyStipend contract. -type StakingDailyStipendInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StakingDailyStipend *StakingDailyStipendFilterer) FilterInitialized(opts *bind.FilterOpts) (*StakingDailyStipendInitializedIterator, error) { - - logs, sub, err := _StakingDailyStipend.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &StakingDailyStipendInitializedIterator{contract: _StakingDailyStipend.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StakingDailyStipend *StakingDailyStipendFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *StakingDailyStipendInitialized) (event.Subscription, error) { - - logs, sub, err := _StakingDailyStipend.contract.WatchLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingDailyStipendInitialized) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Initialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StakingDailyStipend *StakingDailyStipendFilterer) ParseInitialized(log types.Log) (*StakingDailyStipendInitialized, error) { - event := new(StakingDailyStipendInitialized) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingDailyStipendOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the StakingDailyStipend contract. -type StakingDailyStipendOwnershipTransferredIterator struct { - Event *StakingDailyStipendOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingDailyStipendOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingDailyStipendOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingDailyStipendOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingDailyStipendOwnershipTransferred represents a OwnershipTransferred event raised by the StakingDailyStipend contract. -type StakingDailyStipendOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StakingDailyStipend *StakingDailyStipendFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*StakingDailyStipendOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _StakingDailyStipend.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &StakingDailyStipendOwnershipTransferredIterator{contract: _StakingDailyStipend.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StakingDailyStipend *StakingDailyStipendFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *StakingDailyStipendOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _StakingDailyStipend.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingDailyStipendOwnershipTransferred) - if err := _StakingDailyStipend.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StakingDailyStipend *StakingDailyStipendFilterer) ParseOwnershipTransferred(log types.Log) (*StakingDailyStipendOwnershipTransferred, error) { - event := new(StakingDailyStipendOwnershipTransferred) - if err := _StakingDailyStipend.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingDailyStipendStakedIterator is returned from FilterStaked and is used to iterate over the raw logs and unpacked data for Staked events raised by the StakingDailyStipend contract. -type StakingDailyStipendStakedIterator struct { - Event *StakingDailyStipendStaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingDailyStipendStakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingDailyStipendStakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingDailyStipendStakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingDailyStipendStaked represents a Staked event raised by the StakingDailyStipend contract. -type StakingDailyStipendStaked struct { - UserAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterStaked is a free log retrieval operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) FilterStaked(opts *bind.FilterOpts, userAddress []common.Address) (*StakingDailyStipendStakedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _StakingDailyStipend.contract.FilterLogs(opts, "Staked", userAddressRule) - if err != nil { - return nil, err - } - return &StakingDailyStipendStakedIterator{contract: _StakingDailyStipend.contract, event: "Staked", logs: logs, sub: sub}, nil -} - -// WatchStaked is a free log subscription operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) WatchStaked(opts *bind.WatchOpts, sink chan<- *StakingDailyStipendStaked, userAddress []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _StakingDailyStipend.contract.WatchLogs(opts, "Staked", userAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingDailyStipendStaked) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Staked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseStaked is a log parse operation binding the contract event 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d. -// -// Solidity: event Staked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) ParseStaked(log types.Log) (*StakingDailyStipendStaked, error) { - event := new(StakingDailyStipendStaked) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Staked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingDailyStipendUnstakedIterator is returned from FilterUnstaked and is used to iterate over the raw logs and unpacked data for Unstaked events raised by the StakingDailyStipend contract. -type StakingDailyStipendUnstakedIterator struct { - Event *StakingDailyStipendUnstaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingDailyStipendUnstakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingDailyStipendUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingDailyStipendUnstakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingDailyStipendUnstakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingDailyStipendUnstaked represents a Unstaked event raised by the StakingDailyStipend contract. -type StakingDailyStipendUnstaked struct { - UserAddress common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUnstaked is a free log retrieval operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) FilterUnstaked(opts *bind.FilterOpts, userAddress []common.Address) (*StakingDailyStipendUnstakedIterator, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _StakingDailyStipend.contract.FilterLogs(opts, "Unstaked", userAddressRule) - if err != nil { - return nil, err - } - return &StakingDailyStipendUnstakedIterator{contract: _StakingDailyStipend.contract, event: "Unstaked", logs: logs, sub: sub}, nil -} - -// WatchUnstaked is a free log subscription operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) WatchUnstaked(opts *bind.WatchOpts, sink chan<- *StakingDailyStipendUnstaked, userAddress []common.Address) (event.Subscription, error) { - - var userAddressRule []interface{} - for _, userAddressItem := range userAddress { - userAddressRule = append(userAddressRule, userAddressItem) - } - - logs, sub, err := _StakingDailyStipend.contract.WatchLogs(opts, "Unstaked", userAddressRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingDailyStipendUnstaked) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Unstaked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUnstaked is a log parse operation binding the contract event 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75. -// -// Solidity: event Unstaked(address indexed userAddress, uint256 amount) -func (_StakingDailyStipend *StakingDailyStipendFilterer) ParseUnstaked(log types.Log) (*StakingDailyStipendUnstaked, error) { - event := new(StakingDailyStipendUnstaked) - if err := _StakingDailyStipend.contract.UnpackLog(event, "Unstaked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/smart-contracts/contracts/AppStorage.sol b/smart-contracts/contracts/AppStorage.sol index 2ccfa7a8..ce3145cb 100644 --- a/smart-contracts/contracts/AppStorage.sol +++ b/smart-contracts/contracts/AppStorage.sol @@ -1,13 +1,13 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import { KeySet, AddressSet } from "./libraries/KeySet.sol"; +import { KeySet, AddressSet, Uint256Set } from "./libraries/KeySet.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; struct Provider { string endpoint; // example 'domain.com:1234' uint256 stake; // stake amount - uint128 timestamp; // timestamp of the registration + uint128 createdAt; // timestamp of the registration bool isDeleted; } @@ -18,7 +18,7 @@ struct Model { address owner; string name; // limit name length string[] tags; // TODO: limit tags amount - uint128 timestamp; + uint128 createdAt; bool isDeleted; } @@ -27,8 +27,8 @@ struct Bid { bytes32 modelAgentId; uint256 pricePerSecond; // hourly price uint256 nonce; - uint256 createdAt; - uint256 deletedAt; + uint128 createdAt; + uint128 deletedAt; } struct Session { @@ -41,31 +41,42 @@ struct Session { uint256 pricePerSecond; bytes closeoutReceipt; uint256 closeoutType; + // amount of funds that was already withdrawn by provider (we allow to withdraw for the previous day) + uint256 providerWithdrawnAmount; uint256 openedAt; + uint256 endsAt; // expected end time considering the stake provided uint256 closedAt; } struct OnHold { uint256 amount; - uint256 releaseAt; // in epoch seconds TODO: consider using hours to reduce storage cost + uint128 releaseAt; // in epoch seconds TODO: consider using hours to reduce storage cost +} + +struct Pool { + uint256 initialReward; + uint256 rewardDecrease; + uint128 payoutStart; + uint128 decreaseInterval; } struct AppStorage { - IERC20 token; - // provider storage - uint256 providerMinStake; + // + // PROVIDER storage + // mapping(address => Provider) providerMap; // provider address => Provider address[] providers; // all providers ids AddressSet.Set activeProviders; // active providers ids + // // MODEL storage - uint256 modelMinStake; + // mapping(bytes32 => Model) modelMap; // modelId => Model // mapping(address => bytes32[]) public modelsByOwner; // owner to modelIds bytes32[] models; // all model ids KeySet.Set activeModels; // active model ids + // // BID storage - uint256 bidFee; - uint256 feeBalance; + // mapping(bytes32 => Bid) bidMap; // bidId = keccak256(provider, modelAgentId, nonce) => bid mapping(bytes32 => uint256) providerModelAgentNonce; // keccak256(provider, modelAgentId) => last nonce KeySet.Set activeBids; // all active bidIds @@ -73,19 +84,33 @@ struct AppStorage { mapping(bytes32 => KeySet.Set) modelAgentActiveBids; // modelAgentId => active bidIds mapping(bytes32 => bytes32[]) modelAgentBids; // keccak256(provider, modelAgentId) => all bidIds mapping(address => bytes32[]) providerBids; // provider => all bidIds + // // SESSION storage - // Number of seconds to delay the stake return when a user closes out a session using a user signed receipt. - int256 stakeDelay; - address tokenAccount; // account which stores the MOR tokens with infinite allowance for this contract - // arguments for getPeriodReward call - // address public constant distributionContractAddr = address(0x0); - // uint32 public constant distributionRewardStartTime = 1707350400; // ephochSeconds Feb 8 2024 00:00:00 - // uint8 public constant distributionPoolId = 3; - - Session[] sessions; // all sessions + // + // all sessions + Session[] sessions; mapping(bytes32 => uint256) sessionMap; // sessionId => session index - mapping(bytes32 => uint256) bidSessionMap; // bidId => session index - mapping(address => OnHold[]) providerOnHold; // provider address => balance + mapping(address => uint256[]) userSessions; // user address => all session indexes + mapping(address => uint256[]) providerSessions; // provider address => all session indexes + mapping(bytes32 => uint256[]) modelSessions; // modelId => all session indexes + // active sessions + mapping(address => Uint256Set.Set) userActiveSessions; // user address => active session indexes + mapping(address => Uint256Set.Set) providerActiveSessions; // provider address => active session indexes + mapping(address => OnHold[]) userOnHold; // user address => balance + mapping(bytes => bool) approvalMap; // provider approval => true if approval was already used + uint64 activeSessionsCount; + // + // OTHER + // + IERC20 token; // MOR token + // Number of seconds to delay the stake return when a user closes out a session using a user signed receipt + int256 stakeDelay; + address fundingAccount; // account which stores the MOR tokens with infinite allowance for this contract + uint256 bidFee; + uint256 feeBalance; // total fees balance of the contract + uint256 modelMinStake; + uint256 providerMinStake; + Pool pool; // distribution pool configuration } library LibAppStorage { diff --git a/smart-contracts/contracts/DiamondInit.sol b/smart-contracts/contracts/DiamondInit.sol index 9e76a2c1..ae372c1b 100644 --- a/smart-contracts/contracts/DiamondInit.sol +++ b/smart-contracts/contracts/DiamondInit.sol @@ -13,9 +13,12 @@ import { IDiamondLoupe } from "./diamond/interfaces/IDiamondLoupe.sol"; import { IDiamondCut } from "./diamond/interfaces/IDiamondCut.sol"; import { IERC173 } from "./diamond/interfaces/IERC173.sol"; import { IERC165 } from "./diamond/interfaces/IERC165.sol"; -import { LibAppStorage, AppStorage, Session } from "./AppStorage.sol"; +import { LibAppStorage, AppStorage, Session, Pool } from "./AppStorage.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +// Diamond contract resources +// https://github.com/mudgen/awesome-diamonds/blob/main/README.md + // It is expected that this contract is customized if you want to deploy your diamond // with data from a deployment script. Use the init function to initialize state variables // of your diamond. Add parameters to the init funciton if you need to. @@ -26,7 +29,7 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract DiamondInit { // You can add parameters to this function in order to pass in // data to set your own state variables - function init(address _token, address _tokenAccount) external { + function init(address _token, address _fundingAccount) external { // adding ERC165 data LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); ds.supportedInterfaces[type(IERC165).interfaceId] = true; @@ -39,7 +42,9 @@ contract DiamondInit { s.token = IERC20(_token); s.stakeDelay = 0; - s.tokenAccount = _tokenAccount; + s.fundingAccount = _fundingAccount; + + // we need to add a dummy session to avoid index 0 s.sessions.push( Session({ id: bytes32(0), @@ -51,10 +56,22 @@ contract DiamondInit { pricePerSecond: 0, closeoutReceipt: "", closeoutType: 0, + providerWithdrawnAmount: 0, openedAt: 0, + endsAt: 0, closedAt: 0 }) ); + + // default values for pool + // watch also (SessionRouter.sol).setPoolConfig + s.pool = Pool({ + payoutStart: 1707393600, + decreaseInterval: 86400, + initialReward: 3456000000000000000000, + rewardDecrease: 592558728240000000 + }); + // EIP-2535 specifies that the `diamondCut` function takes two optional // arguments: address _init and bytes calldata _calldata // These arguments are used to execute an arbitrary function using delegatecall diff --git a/smart-contracts/contracts/Linear.sol b/smart-contracts/contracts/Linear.sol new file mode 100644 index 00000000..45a9a5ea --- /dev/null +++ b/smart-contracts/contracts/Linear.sol @@ -0,0 +1,30 @@ + +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.0; + +import { LinearDistributionIntervalDecrease } from './libraries/LinearDistributionIntervalDecrease.sol'; + +contract Linear { + uint256 public constant initialAmount = 1000; + + constructor() { + } + + function getPeriodReward( + uint256 initialAmount_, + uint256 decreaseAmount_, + uint128 payoutStart_, + uint128 interval_, + uint128 startTime_, + uint128 endTime_ + ) public pure returns (uint256) { + return LinearDistributionIntervalDecrease.getPeriodReward( + initialAmount_, + decreaseAmount_, + payoutStart_, + interval_, + startTime_, + endTime_ + ); + } +} \ No newline at end of file diff --git a/smart-contracts/contracts/MorpheusToken.sol b/smart-contracts/contracts/MorpheusToken.sol index 8cec5bb5..22fae9f5 100644 --- a/smart-contracts/contracts/MorpheusToken.sol +++ b/smart-contracts/contracts/MorpheusToken.sol @@ -4,7 +4,8 @@ pragma solidity ^0.8.0; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract MorpheusToken is ERC20 { - uint256 constant initialSupply = 1000000 * (10 ** 18); + // set the initial supply to 42 million like in whitepaper + uint256 constant initialSupply = 42_000_000 * (10 ** 18); constructor() ERC20("Morpheus dev", "MOR") { _mint(msg.sender, initialSupply); diff --git a/smart-contracts/contracts/diamond/Diamond.sol b/smart-contracts/contracts/diamond/Diamond.sol index adca6b0f..1db969c6 100644 --- a/smart-contracts/contracts/diamond/Diamond.sol +++ b/smart-contracts/contracts/diamond/Diamond.sol @@ -27,10 +27,7 @@ struct DiamondArgs { } contract Diamond { - constructor( - IDiamondCut.FacetCut[] memory _diamondCut, - DiamondArgs memory _args - ) payable { + constructor(IDiamondCut.FacetCut[] memory _diamondCut, DiamondArgs memory _args) payable { LibDiamond.setContractOwner(_args.owner); LibDiamond.diamondCut(_diamondCut, _args.init, _args.initCalldata); diff --git a/smart-contracts/contracts/diamond/facets/DiamondCutFacet.sol b/smart-contracts/contracts/diamond/facets/DiamondCutFacet.sol index 19d55846..738adee9 100644 --- a/smart-contracts/contracts/diamond/facets/DiamondCutFacet.sol +++ b/smart-contracts/contracts/diamond/facets/DiamondCutFacet.sol @@ -19,11 +19,7 @@ contract DiamondCutFacet is IDiamondCut { /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init - function diamondCut( - FacetCut[] calldata _diamondCut, - address _init, - bytes calldata _calldata - ) external override { + function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external override { LibDiamond.enforceIsContractOwner(); LibDiamond.diamondCut(_diamondCut, _init, _calldata); } diff --git a/smart-contracts/contracts/diamond/facets/DiamondLoupeFacet.sol b/smart-contracts/contracts/diamond/facets/DiamondLoupeFacet.sol index c173df25..b2984b0d 100644 --- a/smart-contracts/contracts/diamond/facets/DiamondLoupeFacet.sol +++ b/smart-contracts/contracts/diamond/facets/DiamondLoupeFacet.sol @@ -33,22 +33,14 @@ contract DiamondLoupeFacet is IDiamondLoupe, IERC165 { // total number of facets uint256 numFacets; // loop through function selectors - for ( - uint256 selectorIndex; - selectorIndex < selectorCount; - selectorIndex++ - ) { + for (uint256 selectorIndex; selectorIndex < selectorCount; selectorIndex++) { bytes4 selector = ds.selectors[selectorIndex]; - address facetAddress_ = ds - .facetAddressAndSelectorPosition[selector] - .facetAddress; + address facetAddress_ = ds.facetAddressAndSelectorPosition[selector].facetAddress; bool continueLoop = false; // find the functionSelectors array for selector and add selector to it for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) { if (facets_[facetIndex].facetAddress == facetAddress_) { - facets_[facetIndex].functionSelectors[ - numFacetSelectors[facetIndex] - ] = selector; + facets_[facetIndex].functionSelectors[numFacetSelectors[facetIndex]] = selector; numFacetSelectors[facetIndex]++; continueLoop = true; break; @@ -91,15 +83,9 @@ contract DiamondLoupeFacet is IDiamondLoupe, IERC165 { uint256 numSelectors; _facetFunctionSelectors = new bytes4[](selectorCount); // loop through function selectors - for ( - uint256 selectorIndex; - selectorIndex < selectorCount; - selectorIndex++ - ) { + for (uint256 selectorIndex; selectorIndex < selectorCount; selectorIndex++) { bytes4 selector = ds.selectors[selectorIndex]; - address facetAddress_ = ds - .facetAddressAndSelectorPosition[selector] - .facetAddress; + address facetAddress_ = ds.facetAddressAndSelectorPosition[selector].facetAddress; if (_facet == facetAddress_) { _facetFunctionSelectors[numSelectors] = selector; numSelectors++; @@ -113,27 +99,16 @@ contract DiamondLoupeFacet is IDiamondLoupe, IERC165 { /// @notice Get all the facet addresses used by a diamond. /// @return facetAddresses_ - function facetAddresses() - external - view - override - returns (address[] memory facetAddresses_) - { + function facetAddresses() external view override returns (address[] memory facetAddresses_) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); uint256 selectorCount = ds.selectors.length; // create an array set to the maximum size possible facetAddresses_ = new address[](selectorCount); uint256 numFacets; // loop through function selectors - for ( - uint256 selectorIndex; - selectorIndex < selectorCount; - selectorIndex++ - ) { + for (uint256 selectorIndex; selectorIndex < selectorCount; selectorIndex++) { bytes4 selector = ds.selectors[selectorIndex]; - address facetAddress_ = ds - .facetAddressAndSelectorPosition[selector] - .facetAddress; + address facetAddress_ = ds.facetAddressAndSelectorPosition[selector].facetAddress; bool continueLoop = false; // see if we have collected the address already and break out of loop if we have for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) { @@ -161,19 +136,13 @@ contract DiamondLoupeFacet is IDiamondLoupe, IERC165 { /// @dev If facet is not found return address(0). /// @param _functionSelector The function selector. /// @return facetAddress_ The facet address. - function facetAddress( - bytes4 _functionSelector - ) external view override returns (address facetAddress_) { + function facetAddress(bytes4 _functionSelector) external view override returns (address facetAddress_) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); - facetAddress_ = ds - .facetAddressAndSelectorPosition[_functionSelector] - .facetAddress; + facetAddress_ = ds.facetAddressAndSelectorPosition[_functionSelector].facetAddress; } // This implements ERC-165. - function supportsInterface( - bytes4 _interfaceId - ) external view override returns (bool) { + function supportsInterface(bytes4 _interfaceId) external view override returns (bool) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); return ds.supportedInterfaces[_interfaceId]; } diff --git a/smart-contracts/contracts/diamond/facets/Test1Facet.sol b/smart-contracts/contracts/diamond/facets/Test1Facet.sol index b50b9574..c059545c 100644 --- a/smart-contracts/contracts/diamond/facets/Test1Facet.sol +++ b/smart-contracts/contracts/diamond/facets/Test1Facet.sol @@ -4,8 +4,7 @@ pragma solidity ^0.8.0; // Example library to show a simple example of diamond storage library TestLib { - bytes32 constant DIAMOND_STORAGE_POSITION = - keccak256("diamond.standard.test.storage"); + bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.test.storage"); struct TestState { address myAddress; @@ -76,7 +75,5 @@ contract Test1Facet { function test1Func20() external {} - function supportsInterface( - bytes4 _interfaceID - ) external view returns (bool) {} + function supportsInterface(bytes4 _interfaceID) external view returns (bool) {} } diff --git a/smart-contracts/contracts/diamond/interfaces/IDiamondCut.sol b/smart-contracts/contracts/diamond/interfaces/IDiamondCut.sol index 313fa4d0..be3f3ae0 100644 --- a/smart-contracts/contracts/diamond/interfaces/IDiamondCut.sol +++ b/smart-contracts/contracts/diamond/interfaces/IDiamondCut.sol @@ -15,9 +15,5 @@ interface IDiamondCut is IDiamond { /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init - function diamondCut( - FacetCut[] calldata _diamondCut, - address _init, - bytes calldata _calldata - ) external; + function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external; } diff --git a/smart-contracts/contracts/diamond/interfaces/IDiamondLoupe.sol b/smart-contracts/contracts/diamond/interfaces/IDiamondLoupe.sol index b2a53cb4..490efc04 100644 --- a/smart-contracts/contracts/diamond/interfaces/IDiamondLoupe.sol +++ b/smart-contracts/contracts/diamond/interfaces/IDiamondLoupe.sol @@ -24,22 +24,15 @@ interface IDiamondLoupe { /// @notice Gets all the function selectors supported by a specific facet. /// @param _facet The facet address. /// @return facetFunctionSelectors_ - function facetFunctionSelectors( - address _facet - ) external view returns (bytes4[] memory facetFunctionSelectors_); + function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_); /// @notice Get all the facet addresses used by a diamond. /// @return facetAddresses_ - function facetAddresses() - external - view - returns (address[] memory facetAddresses_); + function facetAddresses() external view returns (address[] memory facetAddresses_); /// @notice Gets the facet that supports the given selector. /// @dev If facet is not found return address(0). /// @param _functionSelector The function selector. /// @return facetAddress_ The facet address. - function facetAddress( - bytes4 _functionSelector - ) external view returns (address facetAddress_); + function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_); } diff --git a/smart-contracts/contracts/diamond/interfaces/IERC173.sol b/smart-contracts/contracts/diamond/interfaces/IERC173.sol index e40ac3df..b5f023e5 100644 --- a/smart-contracts/contracts/diamond/interfaces/IERC173.sol +++ b/smart-contracts/contracts/diamond/interfaces/IERC173.sol @@ -6,10 +6,7 @@ pragma solidity ^0.8.0; /* is ERC165 */ interface IERC173 { /// @dev This emits when ownership of a contract changes. - event OwnershipTransferred( - address indexed previousOwner, - address indexed newOwner - ); + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice Get the address of the owner /// @return owner_ The address of the owner. diff --git a/smart-contracts/contracts/diamond/libraries/LibDiamond.sol b/smart-contracts/contracts/diamond/libraries/LibDiamond.sol index 68788ceb..2b2734d2 100644 --- a/smart-contracts/contracts/diamond/libraries/LibDiamond.sol +++ b/smart-contracts/contracts/diamond/libraries/LibDiamond.sol @@ -20,21 +20,15 @@ error IncorrectFacetCutAction(uint8 _action); error CannotAddFunctionToDiamondThatAlreadyExists(bytes4 _selector); error CannotReplaceFunctionsFromFacetWithZeroAddress(bytes4[] _selectors); error CannotReplaceImmutableFunction(bytes4 _selector); -error CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet( - bytes4 _selector -); +error CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(bytes4 _selector); error CannotReplaceFunctionThatDoesNotExists(bytes4 _selector); error RemoveFacetAddressMustBeZeroAddress(address _facetAddress); error CannotRemoveFunctionThatDoesNotExist(bytes4 _selector); error CannotRemoveImmutableFunction(bytes4 _selector); -error InitializationFunctionReverted( - address _initializationContractAddress, - bytes _calldata -); +error InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata); library LibDiamond { - bytes32 constant DIAMOND_STORAGE_POSITION = - keccak256("diamond.standard.diamond.storage"); + bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct FacetAddressAndSelectorPosition { address facetAddress; @@ -57,10 +51,7 @@ library LibDiamond { } } - event OwnershipTransferred( - address indexed previousOwner, - address indexed newOwner - ); + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function setContractOwner(address _newOwner) internal { DiamondStorage storage ds = diamondStorage(); @@ -79,21 +70,12 @@ library LibDiamond { } } - event DiamondCut( - IDiamondCut.FacetCut[] _diamondCut, - address _init, - bytes _calldata - ); + event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata); // Internal function version of diamondCut - function diamondCut( - IDiamondCut.FacetCut[] memory _diamondCut, - address _init, - bytes memory _calldata - ) internal { + function diamondCut(IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata) internal { for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { - bytes4[] memory functionSelectors = _diamondCut[facetIndex] - .functionSelectors; + bytes4[] memory functionSelectors = _diamondCut[facetIndex].functionSelectors; address facetAddress = _diamondCut[facetIndex].facetAddress; if (functionSelectors.length == 0) { revert NoSelectorsProvidedForFacetForCut(facetAddress); @@ -113,68 +95,40 @@ library LibDiamond { initializeDiamondCut(_init, _calldata); } - function addFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { + function addFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { if (_facetAddress == address(0)) { revert CannotAddSelectorsToZeroAddress(_functionSelectors); } DiamondStorage storage ds = diamondStorage(); uint16 selectorCount = uint16(ds.selectors.length); - enforceHasContractCode( - _facetAddress, - "LibDiamondCut: Add facet has no code" - ); - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { + enforceHasContractCode(_facetAddress, "LibDiamondCut: Add facet has no code"); + for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; - address oldFacetAddress = ds - .facetAddressAndSelectorPosition[selector] - .facetAddress; + address oldFacetAddress = ds.facetAddressAndSelectorPosition[selector].facetAddress; if (oldFacetAddress != address(0)) { revert CannotAddFunctionToDiamondThatAlreadyExists(selector); } - ds.facetAddressAndSelectorPosition[ - selector - ] = FacetAddressAndSelectorPosition(_facetAddress, selectorCount); + ds.facetAddressAndSelectorPosition[selector] = FacetAddressAndSelectorPosition(_facetAddress, selectorCount); ds.selectors.push(selector); selectorCount++; } } - function replaceFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { + function replaceFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { DiamondStorage storage ds = diamondStorage(); if (_facetAddress == address(0)) { revert CannotReplaceFunctionsFromFacetWithZeroAddress(_functionSelectors); } - enforceHasContractCode( - _facetAddress, - "LibDiamondCut: Replace facet has no code" - ); - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { + enforceHasContractCode(_facetAddress, "LibDiamondCut: Replace facet has no code"); + for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; - address oldFacetAddress = ds - .facetAddressAndSelectorPosition[selector] - .facetAddress; + address oldFacetAddress = ds.facetAddressAndSelectorPosition[selector].facetAddress; // can't replace immutable functions -- functions defined directly in the diamond in this case if (oldFacetAddress == address(this)) { revert CannotReplaceImmutableFunction(selector); } if (oldFacetAddress == _facetAddress) { - revert CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet( - selector - ); + revert CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(selector); } if (oldFacetAddress == address(0)) { revert CannotReplaceFunctionThatDoesNotExists(selector); @@ -184,24 +138,17 @@ library LibDiamond { } } - function removeFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { + function removeFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { DiamondStorage storage ds = diamondStorage(); uint256 selectorCount = ds.selectors.length; if (_facetAddress != address(0)) { revert RemoveFacetAddressMustBeZeroAddress(_facetAddress); } - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { + for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; - FacetAddressAndSelectorPosition - memory oldFacetAddressAndSelectorPosition = ds - .facetAddressAndSelectorPosition[selector]; + FacetAddressAndSelectorPosition memory oldFacetAddressAndSelectorPosition = ds.facetAddressAndSelectorPosition[ + selector + ]; if (oldFacetAddressAndSelectorPosition.facetAddress == address(0)) { revert CannotRemoveFunctionThatDoesNotExist(selector); } @@ -212,16 +159,10 @@ library LibDiamond { } // replace selector with last selector selectorCount--; - if ( - oldFacetAddressAndSelectorPosition.selectorPosition != selectorCount - ) { + if (oldFacetAddressAndSelectorPosition.selectorPosition != selectorCount) { bytes4 lastSelector = ds.selectors[selectorCount]; - ds.selectors[ - oldFacetAddressAndSelectorPosition.selectorPosition - ] = lastSelector; - ds - .facetAddressAndSelectorPosition[lastSelector] - .selectorPosition = oldFacetAddressAndSelectorPosition + ds.selectors[oldFacetAddressAndSelectorPosition.selectorPosition] = lastSelector; + ds.facetAddressAndSelectorPosition[lastSelector].selectorPosition = oldFacetAddressAndSelectorPosition .selectorPosition; } // delete last selector @@ -230,10 +171,7 @@ library LibDiamond { } } - function initializeDiamondCut( - address _init, - bytes memory _calldata - ) internal { + function initializeDiamondCut(address _init, bytes memory _calldata) internal { if (_init == address(0)) { return; } @@ -253,10 +191,7 @@ library LibDiamond { } } - function enforceHasContractCode( - address _contract, - string memory _errorMessage - ) internal view { + function enforceHasContractCode(address _contract, string memory _errorMessage) internal view { uint256 contractSize; assembly { contractSize := extcodesize(_contract) diff --git a/smart-contracts/contracts/diamond/upgradeInitializers/DiamondMultiInit.sol b/smart-contracts/contracts/diamond/upgradeInitializers/DiamondMultiInit.sol index 32b7d5e5..65a457e1 100644 --- a/smart-contracts/contracts/diamond/upgradeInitializers/DiamondMultiInit.sol +++ b/smart-contracts/contracts/diamond/upgradeInitializers/DiamondMultiInit.sol @@ -10,24 +10,15 @@ pragma solidity ^0.8.0; import { LibDiamond } from "../libraries/LibDiamond.sol"; -error AddressAndCalldataLengthDoNotMatch( - uint256 _addressesLength, - uint256 _calldataLength -); +error AddressAndCalldataLengthDoNotMatch(uint256 _addressesLength, uint256 _calldataLength); contract DiamondMultiInit { // This function is provided in the third parameter of the `diamondCut` function. // The `diamondCut` function executes this function to execute multiple initializer functions for a single upgrade. - function multiInit( - address[] calldata _addresses, - bytes[] calldata _calldata - ) external { + function multiInit(address[] calldata _addresses, bytes[] calldata _calldata) external { if (_addresses.length != _calldata.length) { - revert AddressAndCalldataLengthDoNotMatch( - _addresses.length, - _calldata.length - ); + revert AddressAndCalldataLengthDoNotMatch(_addresses.length, _calldata.length); } for (uint i; i < _addresses.length; i++) { LibDiamond.initializeDiamondCut(_addresses[i], _calldata[i]); diff --git a/smart-contracts/contracts/facets/AgentRegistry.sol b/smart-contracts/contracts/facets/AgentRegistry.sol index 0761778c..da8f9144 100644 --- a/smart-contracts/contracts/facets/AgentRegistry.sol +++ b/smart-contracts/contracts/facets/AgentRegistry.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.24; + import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { KeySet } from "../libraries/KeySet.sol"; @@ -11,7 +12,7 @@ contract AgentRegistry is OwnableUpgradeable { bytes32 agentId; uint256 fee; uint256 stake; - uint256 timestamp; + uint128 createdAt; address owner; string name; // limit name length string[] tags; // TODO: limit tags amount @@ -30,7 +31,7 @@ contract AgentRegistry is OwnableUpgradeable { ERC20 public token; // model storage - KeySet.Set set; + KeySet.Set private set; mapping(bytes32 => Agent) public map; function initialize(address _token) public initializer { @@ -78,7 +79,7 @@ contract AgentRegistry is OwnableUpgradeable { map[agentId] = Agent({ fee: fee, stake: newStake, - timestamp: block.timestamp, + createdAt: uint128(block.timestamp), owner: owner, agentId: agentId, name: name, diff --git a/smart-contracts/contracts/facets/Marketplace.sol b/smart-contracts/contracts/facets/Marketplace.sol index 6212573b..303e8389 100644 --- a/smart-contracts/contracts/facets/Marketplace.sol +++ b/smart-contracts/contracts/facets/Marketplace.sol @@ -1,30 +1,18 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.24; -import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; -import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; -import { MessageHashUtils } from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -import { ModelRegistry } from "./ModelRegistry.sol"; -import { ProviderRegistry } from "./ProviderRegistry.sol"; + import { AppStorage, Bid } from "../AppStorage.sol"; -import { KeySet } from "../libraries/KeySet.sol"; +import { KeySet, AddressSet } from "../libraries/KeySet.sol"; import { LibOwner } from "../libraries/LibOwner.sol"; contract Marketplace { using KeySet for KeySet.Set; + using AddressSet for AddressSet.Set; AppStorage internal s; - event BidPosted( - address indexed provider, - bytes32 indexed modelAgentId, - uint256 nonce - ); - event BidDeleted( - address indexed provider, - bytes32 indexed modelAgentId, - uint256 nonce - ); + event BidPosted(address indexed provider, bytes32 indexed modelAgentId, uint256 nonce); + event BidDeleted(address indexed provider, bytes32 indexed modelAgentId, uint256 nonce); event FeeUpdated(uint256 bidFee); error ProviderNotFound(); @@ -38,79 +26,86 @@ contract Marketplace { return s.bidMap[bidId]; } - function getActiveBidsByProvider( - address provider - ) public view returns (Bid[] memory) { + function getActiveBidsByProvider(address provider) public view returns (Bid[] memory) { KeySet.Set storage providerBidsSet = s.providerActiveBids[provider]; - Bid[] memory _bids = new Bid[](providerBidsSet.count()); + uint256 length = providerBidsSet.count(); + + Bid[] memory _bids = new Bid[](length); + bytes32[] memory bidIds = new bytes32[](length); for (uint i = 0; i < providerBidsSet.count(); i++) { - _bids[i] = s.bidMap[providerBidsSet.keyAtIndex(i)]; + bytes32 id = providerBidsSet.keyAtIndex(i); + bidIds[i] = id; + _bids[i] = s.bidMap[id]; } return _bids; } - // returns active bids by model agent - function getActiveBidsByModelAgent( - bytes32 modelAgentId - ) public view returns (Bid[] memory) { + /// @notice returns active bids by model or agent id + function getActiveBidsByModelAgent(bytes32 modelAgentId) public view returns (Bid[] memory) { KeySet.Set storage modelAgentBidsSet = s.modelAgentActiveBids[modelAgentId]; - Bid[] memory _bids = new Bid[](modelAgentBidsSet.count()); - for (uint i = 0; i < modelAgentBidsSet.count(); i++) { - _bids[i] = s.bidMap[modelAgentBidsSet.keyAtIndex(i)]; + uint256 length = modelAgentBidsSet.count(); + + Bid[] memory _bids = new Bid[](length); + bytes32[] memory bidIds = new bytes32[](length); + for (uint i = 0; i < length; i++) { + bytes32 id = modelAgentBidsSet.keyAtIndex(i); + bidIds[i] = id; + _bids[i] = s.bidMap[id]; } return _bids; } - // returns all bids by provider sorted from newest to oldest + /// @notice returns all bids by provider sorted from newest to oldest function getBidsByProvider( address provider, uint256 offset, uint8 limit - ) public view returns (Bid[] memory) { + ) public view returns (bytes32[] memory, Bid[] memory) { uint256 length = s.providerBids[provider].length; if (length < offset) { - return new Bid[](0); + return (new bytes32[](0), new Bid[](0)); } uint8 size = offset + limit > length ? uint8(length - offset) : limit; Bid[] memory _bids = new Bid[](size); + bytes32[] memory bidIds = new bytes32[](size); for (uint i = 0; i < size; i++) { uint256 index = length - offset - i - 1; bytes32 id = s.providerBids[provider][index]; + bidIds[i] = id; _bids[i] = s.bidMap[id]; } - return _bids; + return (bidIds, _bids); } - // returns all bids by provider sorted from newest to oldest + /// @notice returns all bids by model or agent Id sorted from newest to oldest function getBidsByModelAgent( bytes32 modelAgentId, uint256 offset, uint8 limit - ) public view returns (Bid[] memory) { + ) public view returns (bytes32[] memory, Bid[] memory) { uint256 length = s.modelAgentBids[modelAgentId].length; if (length < offset) { - return new Bid[](0); + return (new bytes32[](0), new Bid[](0)); } uint8 size = offset + limit > length ? uint8(length - offset) : limit; Bid[] memory _bids = new Bid[](size); + bytes32[] memory bidIds = new bytes32[](size); for (uint i = 0; i < size; i++) { uint256 index = length - offset - i - 1; bytes32 id = s.modelAgentBids[modelAgentId][index]; + bidIds[i] = id; _bids[i] = s.bidMap[id]; } - return _bids; + return (bidIds, _bids); } - function postModelBid( - address providerAddr, - bytes32 modelId, - uint256 pricePerSecond - ) public returns (bytes32 bidId) { + /// @notice posts a new bid for a model + function postModelBid(address providerAddr, bytes32 modelId, uint256 pricePerSecond) public returns (bytes32 bidId) { LibOwner._senderOrOwner(providerAddr); - if (s.providerMap[providerAddr].isDeleted) { + if (!s.activeProviders.exists(providerAddr)) { revert ProviderNotFound(); } - if (s.modelMap[modelId].isDeleted) { + if (!s.activeModels.exists(modelId)) { revert ModelOrAgentNotFound(); } @@ -125,13 +120,9 @@ contract Marketplace { // remove old bid // TEST IT if it increments nonce correctly - uint256 nonce = s.providerModelAgentNonce[ - keccak256(abi.encodePacked(provider, modelAgentId)) - ]++; + uint256 nonce = s.providerModelAgentNonce[keccak256(abi.encodePacked(provider, modelAgentId))]++; if (nonce > 0) { - deleteModelAgentBid( - keccak256(abi.encodePacked(provider, modelAgentId, nonce - 1)) - ); + deleteModelAgentBid(keccak256(abi.encodePacked(provider, modelAgentId, nonce - 1))); } bidId = keccak256(abi.encodePacked(provider, modelAgentId, nonce)); @@ -141,7 +132,7 @@ contract Marketplace { modelAgentId: modelAgentId, pricePerSecond: pricePerSecond, nonce: nonce, - createdAt: block.timestamp, + createdAt: uint128(block.timestamp), deletedAt: 0 }); @@ -162,6 +153,7 @@ contract Marketplace { return bidId; } + /// @notice deletes a bid function deleteModelAgentBid(bytes32 bidId) public { Bid storage bid = s.bidMap[bidId]; if (bid.createdAt == 0 || bid.deletedAt != 0) { @@ -170,7 +162,7 @@ contract Marketplace { LibOwner._senderOrOwner(bid.provider); - bid.deletedAt = block.timestamp; + bid.deletedAt = uint128(block.timestamp); // indexes update s.activeBids.remove(bidId); s.providerActiveBids[bid.provider].remove(bidId); @@ -179,16 +171,19 @@ contract Marketplace { emit BidDeleted(bid.provider, bid.modelAgentId, bid.nonce); } + /// @notice sets a bid fee function setBidFee(uint256 _bidFee) public { LibOwner._onlyOwner(); s.bidFee = _bidFee; emit FeeUpdated(_bidFee); } + /// @notice returns the bid fee function bidFee() public view returns (uint256) { return s.bidFee; } + /// @notice withdraws the fee balance (OWNER ONLY) function withdraw(address addr, uint256 amount) public { LibOwner._onlyOwner(); if (amount > s.feeBalance) { diff --git a/smart-contracts/contracts/facets/ModelRegistry.sol b/smart-contracts/contracts/facets/ModelRegistry.sol index 15aaa55d..a71d7788 100644 --- a/smart-contracts/contracts/facets/ModelRegistry.sol +++ b/smart-contracts/contracts/facets/ModelRegistry.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.24; -import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; -import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + import { AppStorage, Model } from "../AppStorage.sol"; import { KeySet } from "../libraries/KeySet.sol"; import { LibOwner } from "../libraries/LibOwner.sol"; @@ -18,42 +17,53 @@ contract ModelRegistry { error ModelNotFound(); error StakeTooLow(); + /// @notice Returns model struct by id function modelMap(bytes32 id) public view returns (Model memory) { return s.modelMap[id]; } + /// @notice Returns model id by index function models(uint256 index) public view returns (bytes32) { return s.models[index]; } + /// @notice Returns active (undeleted) model IDs function modelGetIds() public view returns (bytes32[] memory) { return s.activeModels.keys(); } + /// @notice Returns count of active models function modelGetCount() public view returns (uint count) { return s.activeModels.count(); } - function modelGetAll() public view returns (Model[] memory) { - Model[] memory _models = new Model[](s.activeModels.count()); - for (uint i = 0; i < s.activeModels.count(); i++) { - _models[i] = s.modelMap[s.activeModels.keyAtIndex(i)]; + /// @notice Returns all models + /// @return ids array of model ids + /// @return models array of model structs + function modelGetAll() public view returns (bytes32[] memory, Model[] memory) { + uint256 len = s.activeModels.count(); + Model[] memory _models = new Model[](len); + bytes32[] memory ids = new bytes32[](len); + for (uint i = 0; i < len; i++) { + bytes32 id = s.activeModels.keyAtIndex(i); + ids[i] = id; + _models[i] = s.modelMap[id]; } - return _models; + return (ids, _models); } - function modelGetByIndex( - uint index - ) public view returns (bytes32 modelId, Model memory model) { + /// @notice Returns active model struct by index + function modelGetByIndex(uint index) public view returns (bytes32 modelId, Model memory model) { modelId = s.activeModels.keyAtIndex(index); return (modelId, s.modelMap[modelId]); } + /// @notice Checks if model exists function modelExists(bytes32 id) public view returns (bool) { return s.activeModels.exists(id); } - // registers new model or updates existing + /// @notice Registers or updates existing model function modelRegister( bytes32 modelId, bytes32 ipfsCID, @@ -79,7 +89,7 @@ contract ModelRegistry { s.modelMap[modelId] = Model({ fee: fee, stake: newStake, - timestamp: uint128(block.timestamp), + createdAt: uint128(block.timestamp), ipfsCID: ipfsCID, owner: owner, name: name, @@ -88,14 +98,15 @@ contract ModelRegistry { }); emit ModelRegisteredUpdated(owner, modelId); - s.token.transferFrom(msg.sender, address(this), addStake); // reverts with ERC20InsufficientAllowance + s.token.transferFrom(msg.sender, address(this), addStake); // reverts with ERC20InsufficientAllowance() } + /// @notice Deregisters a model function modelDeregister(bytes32 id) public { Model storage model = s.modelMap[id]; LibOwner._senderOrOwner(model.owner); - s.activeModels.remove(id); + s.activeModels.remove(id); // reverts with KeyNotFound() model.isDeleted = true; uint256 stake = model.stake; @@ -103,12 +114,14 @@ contract ModelRegistry { s.token.transfer(model.owner, stake); } + /// @notice Sets the minimum stake required for a model function modelSetMinStake(uint256 _minStake) public { LibOwner._onlyOwner(); s.modelMinStake = _minStake; emit ModelMinStakeUpdated(s.modelMinStake); } + /// @notice Returns the minimum stake required for a model function modelMinStake() public view returns (uint256) { return s.modelMinStake; } diff --git a/smart-contracts/contracts/facets/ProviderRegistry.sol b/smart-contracts/contracts/facets/ProviderRegistry.sol index 65f2b8f9..fc3e1f40 100644 --- a/smart-contracts/contracts/facets/ProviderRegistry.sol +++ b/smart-contracts/contracts/facets/ProviderRegistry.sol @@ -1,14 +1,13 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.24; -import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; -import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + import { AddressSet } from "../libraries/KeySet.sol"; import { AppStorage, Provider } from "../AppStorage.sol"; import { LibOwner } from "../libraries/LibOwner.sol"; contract ProviderRegistry { using AddressSet for AddressSet.Set; - + AppStorage internal s; event ProviderRegisteredUpdated(address indexed provider); @@ -16,35 +15,36 @@ contract ProviderRegistry { event ProviderMinStakeUpdated(uint256 newStake); error StakeTooLow(); - + + /// @notice Returns provider struct by address function providerMap(address addr) public view returns (Provider memory) { return s.providerMap[addr]; } + /// @notice Returns provider address by index function providers(uint256 index) public view returns (address) { return s.providers[index]; } + /// @notice Returns active (undeleted) provider IDs function providerGetIds() public view returns (address[] memory) { return s.activeProviders.keys(); } + /// @notice Returns count of active providers function providerGetCount() public view returns (uint count) { return s.activeProviders.count(); } - - function providerGetByIndex( - uint index - ) public view returns (address addr, Provider memory provider) { + + /// @notice Returns provider by index + function providerGetByIndex(uint index) public view returns (address addr, Provider memory provider) { addr = s.activeProviders.keyAtIndex(index); return (addr, s.providerMap[addr]); } - function providerGetAll() - public - view - returns (address[] memory, Provider[] memory) - { + + /// @notice Returns all providers + function providerGetAll() public view returns (address[] memory, Provider[] memory) { uint256 count = s.activeProviders.count(); address[] memory _addrs = new address[](count); Provider[] memory _providers = new Provider[](count); @@ -58,37 +58,30 @@ contract ProviderRegistry { return (_addrs, _providers); } - // registers new provider or updates existing - function providerRegister( - address addr, - uint256 addStake, - string memory endpoint - ) public { + /// @notice Registers a provider + /// @param addr provider address + /// @param addStake amount of stake to add + /// @param endpoint provider endpoint (host.com:1234) + function providerRegister(address addr, uint256 addStake, string memory endpoint) public { LibOwner._senderOrOwner(addr); Provider memory provider = s.providerMap[addr]; uint256 newStake = provider.stake + addStake; if (newStake < s.providerMinStake) { revert StakeTooLow(); } - if (provider.timestamp == 0) { + if (provider.createdAt == 0) { s.activeProviders.insert(addr); s.providers.push(addr); - } else { - LibOwner._senderOrOwner(addr); } - s.providerMap[addr] = Provider( - endpoint, - newStake, - uint128(block.timestamp), - false - ); + s.providerMap[addr] = Provider(endpoint, newStake, uint128(block.timestamp), false); emit ProviderRegisteredUpdated(addr); s.token.transferFrom(msg.sender, address(this), addStake); // reverts with ERC20InsufficientAllowance } - + + /// @notice Deregisters a provider function providerDeregister(address addr) public { LibOwner._senderOrOwner(addr); s.activeProviders.remove(addr); @@ -100,16 +93,19 @@ contract ProviderRegistry { s.token.transfer(addr, stake); } + /// @notice Sets the minimum stake required for a provider function providerSetMinStake(uint256 _minStake) public { LibOwner._onlyOwner(); s.providerMinStake = _minStake; emit ProviderMinStakeUpdated(_minStake); } - + + /// @notice Checks if a provider exists (is active / not deleted) function providrerExists(address addr) public view returns (bool) { return s.activeProviders.exists(addr); } + /// @notice Returns the minimum stake required for a provider function providerMinStake() public view returns (uint256) { return s.providerMinStake; } diff --git a/smart-contracts/contracts/facets/SessionRouter.sol b/smart-contracts/contracts/facets/SessionRouter.sol index df349691..e924f374 100644 --- a/smart-contracts/contracts/facets/SessionRouter.sol +++ b/smart-contracts/contracts/facets/SessionRouter.sol @@ -1,90 +1,141 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.24; -import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import { MessageHashUtils } from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -import { KeySet } from "../libraries/KeySet.sol"; -import { ModelRegistry } from "./ModelRegistry.sol"; -import { ProviderRegistry } from "./ProviderRegistry.sol"; -import { AppStorage, Session, Bid, OnHold } from "../AppStorage.sol"; +import { KeySet, Uint256Set } from "../libraries/KeySet.sol"; +import { AppStorage, Session, Bid, OnHold, Pool } from "../AppStorage.sol"; import { LibOwner } from "../libraries/LibOwner.sol"; +import { LinearDistributionIntervalDecrease } from "../libraries/LinearDistributionIntervalDecrease.sol"; contract SessionRouter { using KeySet for KeySet.Set; + using Uint256Set for Uint256Set.Set; + AppStorage internal s; // constants - uint32 constant DAY = 24 * 60 * 60; // 1 day - uint32 constant MIN_SESSION_DURATION = 5 * 60; // 5 minutes + uint32 public constant MIN_SESSION_DURATION = 5 minutes; + uint32 public constant MAX_SESSION_DURATION = 7 days; + uint32 public constant SIGNATURE_TTL = 10 minutes; // events - event SessionOpened( - address indexed userAddress, - bytes32 indexed sessionId, - address indexed providerId - ); - event SessionClosed( - address indexed userAddress, - bytes32 indexed sessionId, - address indexed providerId - ); - event Staked(address indexed userAddress, uint256 amount); - event Unstaked(address indexed userAddress, uint256 amount); - event ProviderClaimed(address indexed providerAddress, uint256 amount); + event SessionOpened(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId); + event SessionClosed(address indexed userAddress, bytes32 indexed sessionId, address indexed providerId); // errors error NotUserOrProvider(); - error NotUser(); - - error NotEnoughWithdrawableBalance(); - error NotEnoughStipend(); - error NotEnoughStake(); - error NotEnoughBalance(); + error NotEnoughWithdrawableBalance(); // means that there is not enough funds at all or some funds are still locked + error ProviderSignatureMismatch(); + error SignatureExpired(); + error DuplicateApproval(); - error InvalidSignature(); error SessionTooShort(); error SessionNotFound(); + error SessionAlreadyClosed(); error BidNotFound(); - error BidTaken(); + error CannotDecodeAbi(); //=========================== // SESSION //=========================== + /// @notice returns session by sessionId function getSession(bytes32 sessionId) public view returns (Session memory) { return s.sessions[s.sessionMap[sessionId]]; } + function getActiveSessionsByUser(address user) public view returns (Session[] memory) { + Uint256Set.Set storage userSessions = s.userActiveSessions[user]; + uint256 size = userSessions.count(); + Session[] memory sessions = new Session[](size); + for (uint i = 0; i < size; i++) { + sessions[i] = s.sessions[userSessions.keyAtIndex(i)]; + } + return sessions; + } + + function getActiveSessionsByProvider(address provider) public view returns (Session[] memory) { + Uint256Set.Set storage providerSessions = s.providerActiveSessions[provider]; + uint256 size = providerSessions.count(); + Session[] memory sessions = new Session[](size); + for (uint i = 0; i < size; i++) { + sessions[i] = s.sessions[providerSessions.keyAtIndex(i)]; + } + return sessions; + } + + function getSessionsByProvider(address provider, uint256 offset, uint8 limit) public view returns (Session[] memory) { + return paginate(s.providerSessions[provider], offset, limit); + } + + function getSessionsByUser(address user, uint256 offset, uint8 limit) public view returns (Session[] memory) { + return paginate(s.userSessions[user], offset, limit); + } + + function getSessionsByModel(bytes32 modelId, uint256 offset, uint8 limit) public view returns (Session[] memory) { + return paginate(s.modelSessions[modelId], offset, limit); + } + + function paginate(uint256[] memory indexes, uint256 offset, uint8 limit) private view returns (Session[] memory) { + uint256 length = indexes.length; + if (length < offset) { + return (new Session[](0)); + } + uint8 size = offset + limit > length ? uint8(length - offset) : limit; + Session[] memory sessions = new Session[](size); + for (uint i = 0; i < size; i++) { + uint256 index = length - offset - i - 1; + sessions[i] = s.sessions[indexes[index]]; + } + return sessions; + } + + function activeSessionsCount() public view returns (uint256) { + return s.activeSessionsCount; + } + + function sessionsCount() public view returns (uint256) { + return s.sessions.length; + } + function openSession( - bytes32 bidId, - uint256 _stake + uint256 _stake, + bytes memory providerApproval, + bytes memory signature ) public returns (bytes32 sessionId) { address sender = msg.sender; + // reverts without specific error if cannot decode abi + (bytes32 bidId, uint128 timestampMs) = abi.decode(providerApproval, (bytes32, uint128)); + + if (timestampMs / 1000 < block.timestamp - SIGNATURE_TTL) { + revert SignatureExpired(); + } + Bid memory bid = s.bidMap[bidId]; if (bid.deletedAt != 0 || bid.createdAt == 0) { revert BidNotFound(); } - if (s.bidSessionMap[bidId] != 0) { - // TODO: some bids might be already taken by other sessions - // but the session list in marketplace is ignorant of this fact. - // Marketplace and SessionRouter contracts should be merged together - // to avoid this issue and update indexes by avoiding costly intercontract calls - revert BidTaken(); + if (!isValidReceipt(bid.provider, providerApproval, signature)) { + revert ProviderSignatureMismatch(); } - uint256 duration = balanceOfSessionStipend(_stake) / bid.pricePerSecond; + if (s.approvalMap[providerApproval]) { + revert DuplicateApproval(); + } + s.approvalMap[providerApproval] = true; + + uint256 startOfToday = startOfTheDay(block.timestamp); + uint256 duration = stakeToStipend(_stake, startOfToday) / bid.pricePerSecond; + if (duration < MIN_SESSION_DURATION) { revert SessionTooShort(); } - sessionId = keccak256( - abi.encodePacked(sender, bid.provider, _stake, block.number) - ); + sessionId = keccak256(abi.encodePacked(sender, bid.provider, _stake, block.number)); s.sessions.push( Session({ id: sessionId, @@ -96,91 +147,193 @@ contract SessionRouter { pricePerSecond: bid.pricePerSecond, closeoutReceipt: "", closeoutType: 0, - openedAt: block.timestamp, + providerWithdrawnAmount: 0, + openedAt: uint128(block.timestamp), + endsAt: whenSessionEnds(_stake, bid.pricePerSecond, block.timestamp), closedAt: 0 }) ); uint256 sessionIndex = s.sessions.length - 1; s.sessionMap[sessionId] = sessionIndex; - s.bidSessionMap[bidId] = sessionIndex; // marks bid as "taken" by this session + s.userSessions[sender].push(sessionIndex); + s.providerSessions[bid.provider].push(sessionIndex); + s.modelSessions[bid.modelAgentId].push(sessionIndex); - emit SessionOpened(sender, sessionId, bid.provider); + s.userActiveSessions[sender].insert(sessionIndex); + s.providerActiveSessions[bid.provider].insert(sessionIndex); + s.activeSessionsCount++; + emit SessionOpened(sender, sessionId, bid.provider); s.token.transferFrom(sender, address(this), _stake); // errors with Insufficient Allowance if not approved return sessionId; } - // returns expected session duration in seconds - // should be called daily 00:00:00 UTC - // returns 24 hours if session should not be closed today - function getExpectedDuration( - uint256 _stake, - uint256 pricePerSecond - ) public view returns (uint256) { - uint256 stipend = balanceOfSessionStipend(_stake); - if (stipend > pricePerSecond) { - return DAY; + function closeSession(bytes memory receiptEncoded, bytes memory signature) public { + // reverts without specific error if cannot decode abi + (bytes32 sessionId, uint128 timestampMs, ) = abi.decode(receiptEncoded, (bytes32, uint128, uint32)); + if (timestampMs / 1000 < block.timestamp - SIGNATURE_TTL) { + revert SignatureExpired(); } - return (stipend / pricePerSecond) * 60 * 60; - } - function closeSession( - bytes32 sessionId, - bytes memory receiptEncoded, - bytes memory signature - ) public { - Session storage session = s.sessions[s.sessionMap[sessionId]]; + uint256 sessionIndex = s.sessionMap[sessionId]; + Session storage session = s.sessions[sessionIndex]; if (session.openedAt == 0) { revert SessionNotFound(); } if (session.user != msg.sender && session.provider != msg.sender) { revert NotUserOrProvider(); } + if (session.closedAt != 0) { + revert SessionAlreadyClosed(); + } - s.bidSessionMap[session.bidID] = 0; // marks bid as available - session.closeoutReceipt = receiptEncoded; - session.closedAt = block.timestamp; - - uint256 durationSeconds = session.closedAt - session.openedAt; - uint256 cost = durationSeconds * session.pricePerSecond; - - // TODO: partially return stake according to the usage - // and put rest on hold for 24 hours + // update indexes + s.userActiveSessions[session.user].remove(sessionIndex); + s.providerActiveSessions[session.provider].remove(sessionIndex); + s.activeSessionsCount--; - if (isValidReceipt(session.provider, receiptEncoded, signature)) { - s.token.transfer(session.provider, cost); + // update session record + session.closeoutReceipt = receiptEncoded; + session.closedAt = uint128(block.timestamp); + + // calculate provider withdraw + uint256 providerWithdraw; + bool isClosingLate = startOfTheDay(block.timestamp) > startOfTheDay(session.endsAt); + bool noDispute = isValidReceipt(session.provider, receiptEncoded, signature); + + if (noDispute || isClosingLate) { + // session was closed without dispute or next day after it expected to end + uint256 duration = minUint256(block.timestamp, session.endsAt) - session.openedAt; + uint256 cost = duration * session.pricePerSecond; + providerWithdraw = cost - session.providerWithdrawnAmount; } else { + // session was closed on the same day or earlier with dispute + // withdraw all funds except for today's session cost + uint256 durationTillToday = startOfTheDay(block.timestamp) - + minUint256(session.openedAt, startOfTheDay(block.timestamp)); + uint256 costTillToday = durationTillToday * session.pricePerSecond; + providerWithdraw = costTillToday - session.providerWithdrawnAmount; + } + + if (!noDispute) { session.closeoutType = 1; - s.providerOnHold[session.provider].push( - OnHold({ amount: cost, releaseAt: block.timestamp + DAY }) + } + + session.providerWithdrawnAmount += providerWithdraw; + + // calculate user withdraw + uint256 userStakeToLock = 0; + if (!isClosingLate) { + // session was closed on the same day + // lock today's stake + uint256 todaysDuration = minUint256(session.endsAt, block.timestamp) - + maxUint256(startOfTheDay(block.timestamp), session.openedAt); + uint256 todaysCost = todaysDuration * session.pricePerSecond; + userStakeToLock = stipendToStake(todaysCost, startOfTheDay(block.timestamp)); + s.userOnHold[session.user].push( + OnHold({ amount: userStakeToLock, releaseAt: uint128(block.timestamp + 1 days) }) ); } + + uint256 userWithdraw = session.stake - userStakeToLock; + + emit SessionClosed(session.user, sessionId, session.provider); + + // withdraw provider and user funds + s.token.transferFrom(s.fundingAccount, session.provider, providerWithdraw); + s.token.transfer(session.user, userWithdraw); } + // funds related functions - function getProviderBalance( - address providerAddr - ) public view returns (uint256 total, uint256 hold) { - OnHold[] memory onHold = s.providerOnHold[providerAddr]; + /// @notice returns total claimanble balance for the provider for particular session + function getProviderClaimableBalance(bytes32 sessionId) public view returns (uint256) { + Session memory session = s.sessions[s.sessionMap[sessionId]]; + if (session.openedAt == 0) { + revert SessionNotFound(); + } + return _getProviderClaimableBalance(session); + } + + /// @notice allows provider to claim their funds + function claimProviderBalance(bytes32 sessionId, uint256 amountToWithdraw, address to) public { + Session storage session = s.sessions[s.sessionMap[sessionId]]; + if (session.openedAt == 0) { + revert SessionNotFound(); + } + LibOwner._senderOrOwner(session.provider); + + uint256 withdrawableAmount = _getProviderClaimableBalance(session); + + if (amountToWithdraw > withdrawableAmount) { + revert NotEnoughWithdrawableBalance(); + } + + session.providerWithdrawnAmount += amountToWithdraw; + s.token.transferFrom(s.fundingAccount, to, amountToWithdraw); + return; + } + + function _getProviderClaimableBalance(Session memory session) internal view returns (uint256) { + // if session was closed with no dispute - provider already got all funds + // + // if session was closed with dispute - + // if session was ended but not closed - + // if session was not ended - provider can claim all funds except for today's session cost + + uint256 claimIntervalEnd = minUint256(startOfTheDay(block.timestamp), session.endsAt); + uint256 claimableDuration = maxUint256(claimIntervalEnd, session.openedAt) - session.openedAt; + uint256 totalCost = claimableDuration * session.pricePerSecond; + uint256 withdrawableAmount = totalCost - session.providerWithdrawnAmount; + + return withdrawableAmount; + } + + /// @notice deletes session from the history + function deleteHistory(bytes32 sessionId) public { + Session storage session = s.sessions[s.sessionMap[sessionId]]; + LibOwner._senderOrOwner(session.user); + session.user = address(0); + } + + /// @notice checks if receipt is valid + function isValidReceipt(address signer, bytes memory receipt, bytes memory signature) public pure returns (bool) { + if (signature.length == 0) { + return false; + } + bytes32 receiptHash = MessageHashUtils.toEthSignedMessageHash(keccak256(receipt)); + return ECDSA.recover(receiptHash, signature) == signer; + } + + /// @notice returns amount of withdrawable user stake and one on hold + function withdrawableUserStake(address userAddr) public view returns (uint256 avail, uint256 hold) { + OnHold[] memory onHold = s.userOnHold[userAddr]; for (uint i = 0; i < onHold.length; i++) { - total += onHold[i].amount; + uint256 amount = onHold[i].amount; if (block.timestamp < onHold[i].releaseAt) { - hold += onHold[i].amount; + hold += amount; + } else { + avail += amount; } } - return (total, hold); + return (avail, hold); } - // transfers provider claimable balance to provider address. - // set amount to 0 to claim all balance. - function claimProviderBalance(uint256 amountToWithdraw, address to) public { + /// @notice withdraws user stake + function withdrawUserStake(uint256 amountToWithdraw, address to) public { uint256 balance = 0; address sender = msg.sender; - OnHold[] storage onHoldEntries = s.providerOnHold[sender]; + // withdraw all available funds if amountToWithdraw is 0 + if (amountToWithdraw == 0) { + amountToWithdraw = type(uint256).max; + } + + OnHold[] storage onHoldEntries = s.userOnHold[sender]; uint i = 0; + // the only loop that is not avoidable while (i < onHoldEntries.length) { if (block.timestamp > onHoldEntries[i].releaseAt) { @@ -193,6 +346,7 @@ contract SessionRouter { return; } + // removes entry from array onHoldEntries[i] = onHoldEntries[onHoldEntries.length - 1]; onHoldEntries.pop(); } else { @@ -200,92 +354,101 @@ contract SessionRouter { } } - revert NotEnoughBalance(); + if (amountToWithdraw == type(uint256).max) { + s.token.transfer(to, balance); + return; + } + + revert NotEnoughWithdrawableBalance(); } - function deleteHistory(bytes32 sessionId) public { - Session storage session = s.sessions[s.sessionMap[sessionId]]; - LibOwner._senderOrOwner(session.user); - session.user = address(0); + /// @notice returns stipend of user based on their stake + function stakeToStipend(uint256 sessionStake, uint256 timestamp) public view returns (uint256) { + return sessionStake / (s.token.totalSupply() / getTodaysBudget(timestamp)); } - function setStakeDelay(int256 delay) public { - LibOwner._onlyOwner(); - s.stakeDelay = delay; + /// @notice returns stake of user based on their stipend + function stipendToStake(uint256 stipend, uint256 timestamp) public view returns (uint256) { + // TODO: cache total supply + return stipend * (s.token.totalSupply() / getTodaysBudget(timestamp)); } - function isValidReceipt( - address signer, - bytes memory receipt, - bytes memory signature - ) public pure returns (bool) { - if (signature.length == 0) { - return false; + /// @dev make it pure + function whenSessionEnds( + uint256 sessionStake, + uint256 pricePerSecond, + uint256 openedAt + ) private view returns (uint256) { + uint256 lastDay = whenStipendLessThanDailyPrice(sessionStake, pricePerSecond); + if (lastDay == 0) { + lastDay = openedAt; } - bytes32 receiptHash = MessageHashUtils.toEthSignedMessageHash( - keccak256(receipt) - ); - return ECDSA.recover(receiptHash, signature) == signer; - } - //=========================== - // STAKING - //=========================== + uint256 endTime = lastDay + stakeToStipend(sessionStake, lastDay) / pricePerSecond; - function withdrawableStakeBalance( - address userAddress - ) public view returns (uint256) { - //TODO: return user stake (on hold and withdrawable) - return 0; + // if session ends after today then count the next day stipend + if (startOfTheDay(endTime) > startOfTheDay(lastDay)) { + uint256 nextDayDuration = stakeToStipend(sessionStake, lastDay + 1 days) / pricePerSecond; + endTime = startOfTheDay(endTime) + nextDayDuration; + } + + return minUint256(endTime, openedAt + MAX_SESSION_DURATION); } - // return virtual MOR balance of user based on their stake - // DEPRECATED - // function balanceOfDailyStipend(address userAddress) public view returns (uint256) { - // return getTodaysBudget() * userStake[userAddress] / token.totalSupply() - getTodaysSpend(userAddress); - // } + /// @notice returns the time when stipend will be less than daily price + function whenStipendLessThanDailyPrice(uint256 sessionStake, uint256 pricePerSecond) public view returns (uint256) { + uint256 pricePerDay = pricePerSecond * 1 days; + uint256 minComputeBalance = (pricePerDay * 100 * s.token.totalSupply()) / sessionStake; + return whenComputeBalanceIsLessThan(minComputeBalance); + } - function balanceOfSessionStipend( - uint256 sessionStake - ) public view returns (uint256) { - return (getTodaysBudget() * sessionStake) / s.token.totalSupply(); + /// @notice returns today's budget in MOR + function getTodaysBudget(uint256 timestamp) public view returns (uint256) { + return getComputeBalance(timestamp) / 100; // 1% of Compute Balance } - function getTodaysSpend(address userAddress) public view returns (uint256) { - // OnHold memory spend = todaysSpend[userAddress]; - // if (block.timestamp > spend.releaseAt) { - // return 0; - // } - // return spend.amount; - // - // TODO: implement global counter of how much was spent today - return 0; + /// @notice returns today's compute balance in MOR + function getComputeBalance(uint256 timestamp) public view returns (uint256) { + // TODO: cache today's budget and compute balance + return + LinearDistributionIntervalDecrease.getPeriodReward( + s.pool.initialReward, + s.pool.rewardDecrease, + s.pool.payoutStart, + s.pool.decreaseInterval, + uint128(startOfTheDay(timestamp)), + uint128(startOfTheDay(timestamp) + 1 days) + ); } - function getTodaysBudget() public view returns (uint256) { - // 1% of Compute Balance - return getComputeBalance() / 100; + /// @notice returns the time when compute balance will be less than targetReward + /// @dev returns 0 if targetReward is greater than initial reward + function whenComputeBalanceIsLessThan(uint256 targetReward) public view returns (uint256) { + if (targetReward >= s.pool.initialReward) { + return 0; + } + return + ((s.pool.initialReward - targetReward) / s.pool.rewardDecrease) * s.pool.decreaseInterval + s.pool.payoutStart; } - function getComputeBalance() public view returns (uint256) { - // TODO: or call layer 1 contract to get daily compute balance contract - // - // arguments for getPeriodReward call - // address public constant distributionContractAddr = address(0x0); - // uint32 public constant distributionRewardStartTime = 1707350400; // ephochSeconds Feb 8 2024 00:00:00 - // uint8 public constant distributionPoolId = 3; - // - // return Distribution(distributionContractAddr) - // .getPeriodReward(distributionPoolId, distributionRewardStartTime, block.timestamp) - // return token.allowance(address(token), address(this)); - return 10 * 10 ** 18; // 10 tokens + /// @notice sets distibution pool configuration + /// @dev parameters should be the same as in Ethereum L1 Distribution contract + /// @dev at address 0x47176B2Af9885dC6C4575d4eFd63895f7Aaa4790 + /// @dev call 'Distribution.pools(3)' where '3' is a poolId + function setPoolConfig(Pool calldata pool) public { + LibOwner._onlyOwner(); + s.pool = pool; } - //=========================== - // BIDS - //=========================== + function startOfTheDay(uint256 timestamp) public pure returns (uint256) { + return timestamp - (timestamp % 1 days); + } - //=========================== - // ACCESS CONTROL - //=========================== + function minUint256(uint256 a, uint256 b) internal pure returns (uint256) { + return a < b ? a : b; + } + + function maxUint256(uint256 a, uint256 b) internal pure returns (uint256) { + return a > b ? a : b; + } } diff --git a/smart-contracts/contracts/libraries/KeySet.sol b/smart-contracts/contracts/libraries/KeySet.sol index f2b55bc4..ef14f6a6 100644 --- a/smart-contracts/contracts/libraries/KeySet.sol +++ b/smart-contracts/contracts/libraries/KeySet.sol @@ -46,10 +46,7 @@ library KeySet { return self.keyList[self.keyPointers[key]] == key; } - function keyAtIndex( - Set storage self, - uint index - ) internal view returns (bytes32) { + function keyAtIndex(Set storage self, uint index) internal view returns (bytes32) { return self.keyList[index]; } @@ -102,10 +99,7 @@ library AddressSet { return self.keyList[self.keyPointers[key]] == key; } - function keyAtIndex( - Set storage self, - uint index - ) internal view returns (address) { + function keyAtIndex(Set storage self, uint index) internal view returns (address) { return self.keyList[index]; } @@ -113,3 +107,52 @@ library AddressSet { return self.keyList; } } + +library Uint256Set { + struct Set { + mapping(uint256 => uint) keyPointers; + uint256[] keyList; + } + + error KeyExists(); + error KeyNotFound(); + + function insert(Set storage self, uint256 key) internal { + if (exists(self, key)) { + revert KeyExists(); + } + + self.keyPointers[key] = self.keyList.length; + self.keyList.push(key); + } + + function remove(Set storage self, uint256 key) internal { + if (!exists(self, key)) { + revert KeyNotFound(); + } + + uint256 keyToMove = self.keyList[count(self) - 1]; + uint rowToReplace = self.keyPointers[key]; + self.keyPointers[keyToMove] = rowToReplace; + self.keyList[rowToReplace] = keyToMove; + delete self.keyPointers[key]; + self.keyList.pop(); + } + + function count(Set storage self) internal view returns (uint) { + return (self.keyList.length); + } + + function exists(Set storage self, uint256 key) internal view returns (bool) { + if (self.keyList.length == 0) return false; + return self.keyList[self.keyPointers[key]] == key; + } + + function keyAtIndex(Set storage self, uint index) internal view returns (uint256) { + return self.keyList[index]; + } + + function keys(Set storage self) internal view returns (uint256[] memory) { + return self.keyList; + } +} diff --git a/smart-contracts/contracts/libraries/LibOwner.sol b/smart-contracts/contracts/libraries/LibOwner.sol index 0c161412..86b34e6d 100644 --- a/smart-contracts/contracts/libraries/LibOwner.sol +++ b/smart-contracts/contracts/libraries/LibOwner.sol @@ -16,6 +16,8 @@ library LibOwner { _; } + // Allows if sender is the owner of particular resource or the owner of the contract + // TODO: rename to onlyOwnerOrEntityOwner function _senderOrOwner(address resourceOwner) internal view { address owner = LibDiamond.diamondStorage().contractOwner; if (msg.sender != resourceOwner && msg.sender != owner) { diff --git a/smart-contracts/contracts/libraries/LinearDistributionIntervalDecrease.sol b/smart-contracts/contracts/libraries/LinearDistributionIntervalDecrease.sol new file mode 100644 index 00000000..37d36dc7 --- /dev/null +++ b/smart-contracts/contracts/libraries/LinearDistributionIntervalDecrease.sol @@ -0,0 +1,164 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +/** + * This is the library that calculates the reward for the period with linear distribution and interval decrease. + * Supports the constant reward amount (decreaseAmount_ = 0) + */ +library LinearDistributionIntervalDecrease { + /** + * The function to calculate the reward for the period. + * @param initialAmount_ The initial reward amount. + * @param decreaseAmount_ The reward decrease amount. + * @param payoutStart_ The timestamp when the period starts to pay out rewards. + * @param interval_ The interval in seconds between reward decreases. + * @param startTime_ The timestamp when the period starts. + * @param endTime_ The timestamp when the period ends. + * @return The reward amount. + */ + function getPeriodReward( + uint256 initialAmount_, + uint256 decreaseAmount_, + uint128 payoutStart_, + uint128 interval_, + uint128 startTime_, + uint128 endTime_ + ) internal pure returns (uint256) { + if (interval_ == 0) { + return 0; + } + + // 'startTime_' can't be less than 'payoutStart_' + if (startTime_ < payoutStart_) { + startTime_ = payoutStart_; + } + + uint128 maxEndTime_ = _calculateMaxEndTime(payoutStart_, interval_, initialAmount_, decreaseAmount_); + + if (endTime_ > maxEndTime_) { + endTime_ = maxEndTime_; + } + + // Return 0 when calculation 'startTime_' is bigger then 'endTime_'... + if (startTime_ >= endTime_) { + return 0; + } + + // Calculate interval that less then 'interval_' range + uint256 timePassedBefore_ = startTime_ - payoutStart_; + if ((timePassedBefore_ / interval_) == ((endTime_ - payoutStart_) / interval_)) { + uint256 intervalsPassed_ = timePassedBefore_ / interval_; + uint256 intervalFullReward_ = initialAmount_ - intervalsPassed_ * decreaseAmount_; + + return (intervalFullReward_ * (endTime_ - startTime_)) / interval_; + } + + // Calculate interval that more then 'interval_' range + uint256 firstPeriodReward_ = _calculatePartPeriodReward( + payoutStart_, + startTime_, + interval_, + initialAmount_, + decreaseAmount_, + true + ); + + uint256 secondPeriodReward_ = _calculateFullPeriodReward( + payoutStart_, + startTime_, + endTime_, + interval_, + initialAmount_, + decreaseAmount_ + ); + + uint256 thirdPeriodReward_ = _calculatePartPeriodReward( + payoutStart_, + endTime_, + interval_, + initialAmount_, + decreaseAmount_, + false + ); + + return firstPeriodReward_ + secondPeriodReward_ + thirdPeriodReward_; + } + + function _calculateMaxEndTime( + uint128 payoutStart_, + uint128 interval_, + uint256 initialAmount_, + uint256 decreaseAmount_ + ) private pure returns (uint128) { + if (decreaseAmount_ == 0) { + return type(uint128).max; + } + + uint256 maxIntervals_ = _divideCeil(initialAmount_, decreaseAmount_); + + return uint128(payoutStart_ + maxIntervals_ * interval_); + } + + function _calculatePartPeriodReward( + uint128 payoutStart_, + uint128 startTime_, + uint128 interval_, + uint256 initialAmount_, + uint256 decreaseAmount_, + bool toEnd_ + ) private pure returns (uint256) { + uint256 intervalsPassed_ = (startTime_ - payoutStart_) / interval_; + uint256 decreaseRewardAmount_ = intervalsPassed_ * decreaseAmount_; + if (decreaseRewardAmount_ >= initialAmount_) { + return 0; + } + uint256 intervalFullReward_ = initialAmount_ - decreaseRewardAmount_; + + uint256 intervalPart_; + if (toEnd_) { + intervalPart_ = interval_ * (intervalsPassed_ + 1) + payoutStart_ - startTime_; + } else { + intervalPart_ = startTime_ - interval_ * intervalsPassed_ - payoutStart_; + } + + if (intervalPart_ == interval_) { + return 0; + } + + return (intervalFullReward_ * intervalPart_) / interval_; + } + + function _calculateFullPeriodReward( + uint128 payoutStart_, + uint128 startTime_, + uint128 endTime_, + uint128 interval_, + uint256 initialAmount_, + uint256 decreaseAmount_ + ) private pure returns (uint256) { + // START calculate initial reward when period start + uint256 timePassedBefore_ = startTime_ - payoutStart_; + uint256 intervalsPassedBefore_ = _divideCeil(timePassedBefore_, interval_); + + uint256 decreaseRewardAmount_ = intervalsPassedBefore_ * decreaseAmount_; + + if (decreaseRewardAmount_ >= initialAmount_) { + return 0; + } + + uint256 initialReward_ = initialAmount_ - decreaseRewardAmount_; + // END + + // Intervals passed + uint256 ip_ = ((endTime_ - payoutStart_ - intervalsPassedBefore_ * interval_) / interval_); + if (ip_ == 0) { + return 0; + } + + return initialReward_ * ip_ - (decreaseAmount_ * (ip_ * (ip_ - 1))) / 2; + } + + function _divideCeil(uint256 a_, uint256 b_) private pure returns (uint256) { + return (a_ + b_ - 1) / b_; + } +} diff --git a/smart-contracts/hardhat-mainnet.config.ts b/smart-contracts/hardhat-mainnet.config.ts new file mode 100644 index 00000000..168aa5f8 --- /dev/null +++ b/smart-contracts/hardhat-mainnet.config.ts @@ -0,0 +1,36 @@ +import baseConfig from "./hardhat.config"; +import { HardhatUserConfig } from "hardhat/types"; + +if (!process.env.ETH_NODE_ADDRESS) { + throw new Error("ETH_NODE_ADDRESS env variable is not set"); +} + +if (!process.env.OWNER_PRIVATE_KEY) { + throw new Error("OWNER_PRIVATE_KEY env variable is not set"); +} + +if (!process.env.ETHERSCAN_API_KEY) { + throw new Error("ETHERSCAN_API_KEY env variable is not set"); +} + +const config: HardhatUserConfig = { + ...baseConfig, + networks: { + ...baseConfig.networks, + default: { + chainId: 421614, + url: process.env.ETH_NODE_ADDRESS, + accounts: [process.env.OWNER_PRIVATE_KEY], + }, + }, + etherscan: { + apiKey: { + arbitrumSepolia: process.env.ETHERSCAN_API_KEY, + }, + }, + sourcify: { + enabled: false, + }, +}; + +export default config; diff --git a/smart-contracts/hardhat.config.ts b/smart-contracts/hardhat.config.ts index be91361b..9b5964ec 100644 --- a/smart-contracts/hardhat.config.ts +++ b/smart-contracts/hardhat.config.ts @@ -1,10 +1,21 @@ import "dotenv/config"; -import { HardhatUserConfig } from "hardhat/config"; +import "@nomicfoundation/hardhat-verify"; import "@nomicfoundation/hardhat-toolbox-viem"; +import "@nomicfoundation/hardhat-ignition-viem"; import "@solarity/hardhat-gobind"; +import "./tasks/upgrade"; +import { HardhatUserConfig } from "hardhat/config"; const config: HardhatUserConfig = { - solidity: "0.8.24", + solidity: { + version: "0.8.24", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, mocha: { reporter: "nyan", }, @@ -15,7 +26,7 @@ const config: HardhatUserConfig = { coinmarketcap: process.env.COINMARKETCAP_API_KEY, darkMode: true, currency: "USD", - L2Etherscan: "E6UST5HFK6DNNTVUV1YTTRTN3BX727G8SU", + L2Etherscan: process.env.ETHERSCAN_API_KEY, L2: "arbitrum", L1: "ethereum", }, diff --git a/smart-contracts/libraries/diamond.ts b/smart-contracts/libraries/diamond.ts index e0c49318..513121e5 100644 --- a/smart-contracts/libraries/diamond.ts +++ b/smart-contracts/libraries/diamond.ts @@ -1,4 +1,5 @@ import { Abi, AbiFunction, AbiItem, toFunctionHash } from "viem"; +import { toFunctionSignature } from "viem/utils"; export const FacetCutAction = { Add: 0, @@ -11,11 +12,23 @@ export function isFunctionExceptInitAbi(abi: AbiItem): abi is AbiFunction { } // get function selectors from ABI -export function getSelectors(abi: Abi) { +export function getSelectors(abi: Abi): `0x${string}`[] { return abi.filter(isFunctionExceptInitAbi).map((item) => { const hash = toFunctionHash(item); // return "0x" + 4 bytes of the hash - return hash.slice(0, 2 + 8); + return hash.slice(0, 2 + 8) as `0x${string}`; + }); +} + +export function getSelectorsWithFunctions(abi: Abi): { + hash: `0x${string}`; + signature: string; +}[] { + return abi.filter(isFunctionExceptInitAbi).map((item) => { + const signature = toFunctionSignature(item); + const hash = toFunctionHash(item); + // return "0x" + 4 bytes of the hash + return { hash: hash.slice(0, 2 + 8) as `0x${string}`, signature }; }); } diff --git a/smart-contracts/package.json b/smart-contracts/package.json index ba51596c..446ec1cc 100644 --- a/smart-contracts/package.json +++ b/smart-contracts/package.json @@ -13,15 +13,17 @@ "bindings-go": "hardhat gobind", "node-local": "hardhat node", "deploy-local": "hardhat run --network localhost scripts/deploy-local.ts", - "format": "prettier --write \"contracts/**/*.sol\"" + "format": "prettier --write \"contracts/**/*.sol\"", + "lint": "solhint \"contracts/[!diamond]*/[!Test]*.sol\"" }, "devDependencies": { - "@nomicfoundation/hardhat-ignition": "^0.15.0", - "@nomicfoundation/hardhat-ignition-viem": "^0.15.0", + "@nomicfoundation/hardhat-ignition": "^0.15.2", + "@nomicfoundation/hardhat-ignition-viem": "^0.15.2", "@nomicfoundation/hardhat-network-helpers": "^1.0.0", "@nomicfoundation/hardhat-toolbox-viem": "^3.0.0", - "@nomicfoundation/hardhat-verify": "^2.0.0", - "@nomicfoundation/hardhat-viem": "^2.0.0", + "@nomicfoundation/hardhat-verify": "^2.0.6", + "@nomicfoundation/hardhat-viem": "^2.0.1", + "@nomicfoundation/ignition-core": "^0.15.2", "@openzeppelin/contracts": "^5.0.2", "@solarity/hardhat-gobind": "^1.2.2", "@types/chai": "^4.2.0", @@ -35,10 +37,11 @@ "morpheus-smart-contracts": "git+ssh://github.com/MorpheusAIs/SmartContracts.git#753accd", "prettier": "^3.2.5", "prettier-plugin-solidity": "^1.3.1", + "solhint": "^4.5.4", "solidity-coverage": "^0.8.12", "ts-node": ">=8.0.0", - "typescript": "~5.0.4", - "viem": "^2.9.21" + "typescript": "^5.4.5", + "viem": "^2.10.1" }, "dependencies": {} } \ No newline at end of file diff --git a/smart-contracts/scripts/deploy-diamond.ts b/smart-contracts/scripts/deploy-diamond.ts new file mode 100644 index 00000000..49dc28de --- /dev/null +++ b/smart-contracts/scripts/deploy-diamond.ts @@ -0,0 +1,36 @@ +import * as fixtures from "../test/fixtures"; +import hre from "hardhat"; + +async function main() { + const morAddress = process.env.MOR_ADDRESS; + if (!morAddress) { + throw new Error("MOR_ADDRESS is not set"); + } + console.log("Deploying diamond..."); + console.log("MOR_ADDRESS: ", morAddress); + + const [owner] = await hre.viem.getWalletClients(); + const data = await fixtures.onlyDeployDiamond(morAddress, owner); + console.log(` + Diamond deployed to ${data.diamond.address} + `); + + try { + console.log("Verifying diamond..."); + await hre.run("verify", { + address: data.diamond.address, + constructorArguments: data.constructorArgs, + }); + + for (const facet of data.facets) { + console.log(`Verifying facet ${facet.name} at address: ${facet.address}`); + await hre.run("verify", { address: facet.address }); + } + } catch (e) { + console.error("Error verifying diamond: ", e); + console.log("Facets", data.facets); + console.log("Constructor args", data.constructorArgs); + } +} + +main(); diff --git a/smart-contracts/tasks/upgrade.ts b/smart-contracts/tasks/upgrade.ts new file mode 100644 index 00000000..fff7f7d1 --- /dev/null +++ b/smart-contracts/tasks/upgrade.ts @@ -0,0 +1,81 @@ +import { task } from "hardhat/config"; +import { ArtifactsMap, HardhatRuntimeEnvironment } from "hardhat/types"; +import { + FacetCutAction, + getSelectors, + getSelectorsWithFunctions, +} from "../libraries/diamond"; +import { zeroAddress, zeroHash } from "viem"; + +interface Args { + facet: string; + diamond: string; +} + +function validateAddress(address: string): address is `0x${string}` { + return address.match(/^0x[0-9a-fA-F]{40}$/) !== null; +} + +function validateArtifact( + name: string, + hre: HardhatRuntimeEnvironment, +): name is keyof ArtifactsMap { + try { + const a = hre.artifacts.readArtifactSync(name); + return true; + } catch (e) { + return false; + } +} + +task("upgrade", "Upgrades contract's faucet") + .addParam("facet", "facet name") + .addParam("diamond", "diamond address") + .setAction(async (args: Args, hre) => { + if (!validateAddress(args.diamond)) { + throw new Error("Invalid diamond address"); + } + + if (!validateArtifact(args.facet, hre)) { + throw new Error("Facet does not exist"); + } + + const facetContract = await hre.viem.deployContract( + args.facet as string, + [], + {}, + ); + console.log(`Facet ${args.facet} deployed at ${facetContract.address}`); + + const fns = getSelectorsWithFunctions(facetContract.abi); + + console.log( + `Updating function names:\n${fns.map(({ hash, signature }) => { + return `${hash} - ${signature}\n`; + })}\n`, + ); + + const facetCut = { + facetAddress: facetContract.address, + action: FacetCutAction.Replace, + functionSelectors: fns.map((s) => s.hash), + }; + + const diamondCut = await hre.viem.getContractAt( + "DiamondCutFacet", + args.diamond, + ); + const [owner] = await hre.viem.getWalletClients(); + const publicClient = await hre.viem.getPublicClient(); + + const req = await diamondCut.simulate.diamondCut([ + [facetCut], + zeroAddress, + "0x", + ]); + const hash = await owner.writeContract(req.request); + await publicClient.waitForTransactionReceipt({ hash }); + + console.log("Diamond upgraded successfully!"); + console.log("Txhash:", hash); + }); diff --git a/smart-contracts/test/LinearDistribution.ts b/smart-contracts/test/LinearDistribution.ts new file mode 100644 index 00000000..f8f45d6a --- /dev/null +++ b/smart-contracts/test/LinearDistribution.ts @@ -0,0 +1,29 @@ +import hre from "hardhat"; +import fs from "node:fs"; + +async function main() { + const data = { + payoutStart: 1707393600n, + decreaseInterval: 86400n, + initialReward: 3_456_000_000_000_000_000_000n, + rewardDecrease: 592558728240000000n, + }; + + const linear = await hre.viem.deployContract("Linear", []); + const now = BigInt(new Date().getTime()) / 1000n; + const start = (now / 86400n + 1n) * 86400n; + const end = start + 86400n; + + const reward = await linear.read.getPeriodReward([ + data.initialReward, + data.rewardDecrease, + data.payoutStart, + data.decreaseInterval, + start, + end, + ]); + + console.log("Reward: ", reward.toString()); +} + +main(); diff --git a/smart-contracts/test/Marketplace.test.ts b/smart-contracts/test/Marketplace.test.ts index 6fe038a7..a0066bc3 100644 --- a/smart-contracts/test/Marketplace.test.ts +++ b/smart-contracts/test/Marketplace.test.ts @@ -3,7 +3,13 @@ import { expect } from "chai"; import hre from "hardhat"; import { parseEventLogs } from "viem"; import { deploySingleBid } from "./fixtures"; -import { expectError, getTxTimestamp } from "./utils"; +import { + catchError, + expectError, + getTxTimestamp, + randomAddress, + randomBytes32, +} from "./utils"; describe("Marketplace", function () { describe("bid actions", function () { @@ -21,35 +27,53 @@ describe("Marketplace", function () { }); }); - it("Should create a bid and query by id", async function () { + it("Should error if provider doesn't exist", async function () { const { marketplace, expectedBid } = await loadFixture(deploySingleBid); - const data = await marketplace.read.bidMap([expectedBid.id]); + const unknownProvider = randomAddress(); - expect(data).to.be.deep.equal({ - provider: expectedBid.providerAddr, - modelAgentId: expectedBid.modelId, - pricePerSecond: expectedBid.pricePerSecond, - nonce: expectedBid.nonce, - createdAt: expectedBid.createdAt, - deletedAt: expectedBid.deletedAt, + await catchError(marketplace.abi, "ProviderNotFound", async () => { + await marketplace.simulate.postModelBid( + [unknownProvider, expectedBid.modelId, expectedBid.pricePerSecond], + { account: unknownProvider }, + ); + }); + }); + + it("Should error if model doesn't exist", async function () { + const { marketplace, expectedBid } = await loadFixture(deploySingleBid); + const unknownModel = randomBytes32(); + + await catchError(marketplace.abi, "ModelOrAgentNotFound", async () => { + await marketplace.simulate.postModelBid( + [expectedBid.providerAddr, unknownModel, expectedBid.pricePerSecond], + { account: expectedBid.providerAddr }, + ); }); }); it("Should create second bid", async function () { - const { marketplace, expectedBid: expBid, publicClient } = await loadFixture(deploySingleBid); + const { + marketplace, + expectedBid: expBid, + publicClient, + } = await loadFixture(deploySingleBid); // create new bid with same provider and modelId const client = await hre.viem.getWalletClient(expBid.providerAddr); const postModelBid = await marketplace.simulate.postModelBid( [expBid.providerAddr, expBid.modelId, expBid.pricePerSecond], - { account: expBid.providerAddr } + { account: expBid.providerAddr }, ); const txHash = await client.writeContract(postModelBid.request); const timestamp = await getTxTimestamp(publicClient, txHash); // check indexes are updated - const newBids1 = await marketplace.read.getActiveBidsByProvider([expBid.providerAddr]); - const newBids2 = await marketplace.read.getActiveBidsByModelAgent([expBid.modelId]); + const newBids1 = await marketplace.read.getActiveBidsByProvider([ + expBid.providerAddr, + ]); + const newBids2 = await marketplace.read.getActiveBidsByModelAgent([ + expBid.modelId, + ]); expect(newBids1).to.be.deep.equal(newBids2); expect(newBids1.length).to.be.equal(1); @@ -74,11 +98,19 @@ describe("Marketplace", function () { }); // check old bid is still queried - const oldBids1 = await marketplace.read.getBidsByProvider([expBid.providerAddr, 0n, 100]); - const oldBids2 = await marketplace.read.getBidsByModelAgent([expBid.modelId, 0n, 100]); + const oldBids1 = await marketplace.read.getBidsByProvider([ + expBid.providerAddr, + 0n, + 100, + ]); + const oldBids2 = await marketplace.read.getBidsByModelAgent([ + expBid.modelId, + 0n, + 100, + ]); expect(oldBids1).to.be.deep.equal(oldBids2); expect(oldBids1.length).to.be.equal(2); - expect(oldBids1[1]).to.be.deep.equal({ + expect(oldBids1[1][1]).to.be.deep.equal({ provider: expBid.providerAddr, modelAgentId: expBid.modelId, pricePerSecond: expBid.pricePerSecond, @@ -90,7 +122,9 @@ describe("Marketplace", function () { it("Should query by provider", async function () { const { marketplace, expectedBid } = await loadFixture(deploySingleBid); - const data = await marketplace.read.getActiveBidsByProvider([expectedBid.providerAddr]); + const data = await marketplace.read.getActiveBidsByProvider([ + expectedBid.providerAddr, + ]); expect(data.length).to.equal(1); expect(data[0]).to.deep.equal({ @@ -105,7 +139,9 @@ describe("Marketplace", function () { it("Should query by provider with pagination", async function () { const { marketplace, expectedBid } = await loadFixture(deploySingleBid); - const data = await marketplace.read.getActiveBidsByProvider([expectedBid.providerAddr]); + const data = await marketplace.read.getActiveBidsByProvider([ + expectedBid.providerAddr, + ]); expect(data.length).to.equal(1); expect(data[0]).to.deep.equal({ @@ -120,7 +156,9 @@ describe("Marketplace", function () { it("Should query by modelId", async function () { const { marketplace, expectedBid } = await loadFixture(deploySingleBid); - const data = await marketplace.read.getActiveBidsByModelAgent([expectedBid.modelId]); + const data = await marketplace.read.getActiveBidsByModelAgent([ + expectedBid.modelId, + ]); expect(data.length).to.equal(1); expect(data[0]).to.deep.equal({ @@ -136,12 +174,15 @@ describe("Marketplace", function () { describe("bid fee", function () { it("should set bid fee", async function () { - const { marketplace, owner, publicClient } = await loadFixture(deploySingleBid); + const { marketplace, owner, publicClient } = + await loadFixture(deploySingleBid); const newFee = 100n; const txHash = await marketplace.write.setBidFee([newFee], { account: owner.account.address, }); - const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash }); + const receipt = await publicClient.waitForTransactionReceipt({ + hash: txHash, + }); const events = parseEventLogs({ abi: marketplace.abi, logs: receipt.logs, @@ -156,8 +197,14 @@ describe("Marketplace", function () { }); it("should collect bid fee", async function () { - const { marketplace, owner, expectedBid, publicClient, provider, tokenMOR } = - await loadFixture(deploySingleBid); + const { + marketplace, + owner, + expectedBid, + publicClient, + provider, + tokenMOR, + } = await loadFixture(deploySingleBid); const newFee = 100n; await marketplace.write.setBidFee([newFee], { account: owner.account.address, @@ -168,15 +215,24 @@ describe("Marketplace", function () { }); // check balance before - const balanceBefore = await tokenMOR.read.balanceOf([marketplace.address]); + const balanceBefore = await tokenMOR.read.balanceOf([ + marketplace.address, + ]); // add bid - await tokenMOR.write.approve([marketplace.address, expectedBid.pricePerSecond + newFee], { - account: expectedBid.providerAddr, - }); + await tokenMOR.write.approve( + [marketplace.address, expectedBid.pricePerSecond + newFee], + { + account: expectedBid.providerAddr, + }, + ); const postModelBid = await marketplace.simulate.postModelBid( - [expectedBid.providerAddr, expectedBid.modelId, expectedBid.pricePerSecond], - { account: expectedBid.providerAddr } + [ + expectedBid.providerAddr, + expectedBid.modelId, + expectedBid.pricePerSecond, + ], + { account: expectedBid.providerAddr }, ); const txHash = await provider.writeContract(postModelBid.request); await publicClient.waitForTransactionReceipt({ hash: txHash }); @@ -187,8 +243,14 @@ describe("Marketplace", function () { }); it("should allow withdrawal by owner", async function () { - const { marketplace, owner, expectedBid, publicClient, provider, tokenMOR } = - await loadFixture(deploySingleBid); + const { + marketplace, + owner, + expectedBid, + publicClient, + provider, + tokenMOR, + } = await loadFixture(deploySingleBid); const newFee = 100n; await marketplace.write.setBidFee([newFee], { account: owner.account.address, @@ -198,29 +260,46 @@ describe("Marketplace", function () { }); // add bid - await tokenMOR.write.approve([marketplace.address, expectedBid.pricePerSecond + newFee], { - account: expectedBid.providerAddr, - }); + await tokenMOR.write.approve( + [marketplace.address, expectedBid.pricePerSecond + newFee], + { + account: expectedBid.providerAddr, + }, + ); const postModelBid = await marketplace.simulate.postModelBid( - [expectedBid.providerAddr, expectedBid.modelId, expectedBid.pricePerSecond], - { account: expectedBid.providerAddr } + [ + expectedBid.providerAddr, + expectedBid.modelId, + expectedBid.pricePerSecond, + ], + { account: expectedBid.providerAddr }, ); const txHash = await provider.writeContract(postModelBid.request); await publicClient.waitForTransactionReceipt({ hash: txHash }); // check balance after - const balanceBefore = await tokenMOR.read.balanceOf([owner.account.address]); + const balanceBefore = await tokenMOR.read.balanceOf([ + owner.account.address, + ]); await marketplace.write.withdraw([owner.account.address, newFee], { account: owner.account.address, }); - const balanceAfter = await tokenMOR.read.balanceOf([owner.account.address]); + const balanceAfter = await tokenMOR.read.balanceOf([ + owner.account.address, + ]); expect(balanceAfter - balanceBefore).to.be.equal(newFee); }); it("should not allow withdrawal by any other account except owner", async function () { - const { marketplace, owner, expectedBid, publicClient, provider, tokenMOR } = - await loadFixture(deploySingleBid); + const { + marketplace, + owner, + expectedBid, + publicClient, + provider, + tokenMOR, + } = await loadFixture(deploySingleBid); const newFee = 100n; await marketplace.write.setBidFee([newFee], { account: owner.account.address, @@ -231,42 +310,44 @@ describe("Marketplace", function () { }); // add bid - await tokenMOR.write.approve([marketplace.address, expectedBid.pricePerSecond + newFee], { - account: expectedBid.providerAddr, - }); + await tokenMOR.write.approve( + [marketplace.address, expectedBid.pricePerSecond + newFee], + { + account: expectedBid.providerAddr, + }, + ); const postModelBid = await marketplace.simulate.postModelBid( - [expectedBid.providerAddr, expectedBid.modelId, expectedBid.pricePerSecond], - { account: expectedBid.providerAddr } + [ + expectedBid.providerAddr, + expectedBid.modelId, + expectedBid.pricePerSecond, + ], + { account: expectedBid.providerAddr }, ); const txHash = await provider.writeContract(postModelBid.request); await publicClient.waitForTransactionReceipt({ hash: txHash }); // check balance after - try { - await marketplace.write.withdraw([expectedBid.providerAddr, newFee], { - account: expectedBid.providerAddr, - }); - expect.fail("Should have thrown an error"); - } catch (e) { - expectError( - e, - (await hre.artifacts.readArtifact("OwnershipFacet")).abi, - "NotContractOwner" - ); - } + await catchError( + (await hre.artifacts.readArtifact("OwnershipFacet")).abi, + "NotContractOwner", + async () => { + await marketplace.write.withdraw([expectedBid.providerAddr, newFee], { + account: expectedBid.providerAddr, + }); + }, + ); }); it("should not allow withdrawal if not enough balance", async function () { - const { marketplace, owner, tokenMOR } = await loadFixture(deploySingleBid); + const { marketplace, owner, tokenMOR } = + await loadFixture(deploySingleBid); - try { + await catchError(marketplace.abi, "NotEnoughBalance", async () => { await marketplace.write.withdraw([owner.account.address, 100000000n], { account: owner.account.address, }); - expect.fail("Should have thrown an error"); - } catch (e) { - expectError(e, marketplace.abi, "NotEnoughBalance"); - } + }); }); }); }); diff --git a/smart-contracts/test/ModelRegistry.test.ts b/smart-contracts/test/ModelRegistry.test.ts index 27c0743f..97470fe1 100644 --- a/smart-contracts/test/ModelRegistry.test.ts +++ b/smart-contracts/test/ModelRegistry.test.ts @@ -3,7 +3,13 @@ import { expect } from "chai"; import hre from "hardhat"; import { getAddress } from "viem"; import { deployDiamond, deploySingleModel } from "./fixtures"; -import { expectError, getHex, getTxTimestamp, randomAddress, randomBytes32 } from "./utils"; +import { + catchError, + getHex, + getTxTimestamp, + randomAddress, + randomBytes32, +} from "./utils"; describe("Model registry", function () { describe("Actions", function () { @@ -31,7 +37,7 @@ describe("Model registry", function () { owner: getAddress(expectedModel.owner), name: expectedModel.name, tags: expectedModel.tags, - timestamp: expectedModel.timestamp, + createdAt: expectedModel.createdAt, isDeleted: expectedModel.isDeleted, }); expect(events.length).eq(1); @@ -41,7 +47,8 @@ describe("Model registry", function () { const { modelRegistry, owner } = await loadFixture(deployDiamond); const minStake = 100n; await modelRegistry.write.modelSetMinStake([minStake]); - try { + + await catchError(modelRegistry.abi, "StakeTooLow", async () => { await modelRegistry.simulate.modelRegister([ randomBytes32(), randomBytes32(), @@ -51,16 +58,14 @@ describe("Model registry", function () { "a", [], ]); - expect.fail("Expected error"); - } catch (e) { - expectError(e, modelRegistry.abi, "StakeTooLow"); - } + }); }); it("Should error when registering with insufficient allowance", async function () { const { modelRegistry, owner, tokenMOR } = await loadFixture(deployDiamond); - try { + + await catchError(tokenMOR.abi, "ERC20InsufficientAllowance", async () => { await modelRegistry.simulate.modelRegister([ randomBytes32(), randomBytes32(), @@ -70,10 +75,7 @@ describe("Model registry", function () { "a", [], ]); - expect.fail("Expected error"); - } catch (e) { - expectError(e, tokenMOR.abi, "ERC20InsufficientAllowance"); - } + }); }); it("Should error when register account doesnt match sender account", async function () { @@ -81,7 +83,8 @@ describe("Model registry", function () { const { modelRegistry, tokenMOR } = await loadFixture(deployDiamond); await tokenMOR.write.approve([modelRegistry.address, 100n]); - try { + + await catchError(modelRegistry.abi, "NotSenderOrOwner", async () => { await modelRegistry.simulate.modelRegister( [ randomBytes32(), @@ -96,10 +99,7 @@ describe("Model registry", function () { account: user.account.address, }, ); - expect.fail("Expected error"); - } catch (e) { - expectError(e, modelRegistry.abi, "NotSenderOrOwner"); - } + }); }); it("Should deregister by owner", async function () { @@ -144,14 +144,11 @@ describe("Model registry", function () { it("Should error if model not known by admin", async function () { const { modelRegistry, owner } = await loadFixture(deploySingleModel); - try { + await catchError(modelRegistry.abi, "KeyNotFound", async () => { await modelRegistry.write.modelDeregister([randomBytes32()], { account: owner.account, }); - expect.fail("Expected error"); - } catch (e) { - expectError(e, modelRegistry.abi, "KeyNotFound"); - } + }); }); it("Should return stake on deregister", async function () { @@ -209,7 +206,7 @@ describe("Model registry", function () { owner: getAddress(updates.owner), name: updates.name, tags: updates.tags, - timestamp: timestamp, + createdAt: timestamp, isDeleted: expectedModel.isDeleted, }); }); @@ -261,7 +258,7 @@ describe("Model registry", function () { owner: getAddress(expectedModel.owner), name: expectedModel.name, tags: expectedModel.tags, - timestamp: expectedModel.timestamp, + createdAt: expectedModel.createdAt, isDeleted: expectedModel.isDeleted, }); }); @@ -280,7 +277,7 @@ describe("Model registry", function () { owner: getAddress(expectedModel.owner), name: expectedModel.name, tags: expectedModel.tags, - timestamp: expectedModel.timestamp, + createdAt: expectedModel.createdAt, isDeleted: expectedModel.isDeleted, }); }); @@ -302,18 +299,11 @@ describe("Model registry", function () { it("Should error when not owner is setting min stake", async function () { const { modelRegistry, provider } = await loadFixture(deploySingleModel); - try { + await catchError(modelRegistry.abi, "NotContractOwner", async () => { await modelRegistry.write.modelSetMinStake([100n], { account: provider.account, }); - expect.fail("Expected error"); - } catch (e) { - expectError( - e, - (await hre.artifacts.readArtifact("OwnershipFacet")).abi, - "NotContractOwner", - ); - } + }); }); }); }); diff --git a/smart-contracts/test/ProviderRegistry.test.ts b/smart-contracts/test/ProviderRegistry.test.ts index 0e1d9632..38cca87e 100644 --- a/smart-contracts/test/ProviderRegistry.test.ts +++ b/smart-contracts/test/ProviderRegistry.test.ts @@ -2,7 +2,7 @@ import { loadFixture } from "@nomicfoundation/hardhat-toolbox-viem/network-helpe import { expect } from "chai"; import hre from "hardhat"; import { getAddress } from "viem"; -import { expectError, getTxTimestamp } from "./utils"; +import { catchError, expectError, getTxTimestamp } from "./utils"; import { deployDiamond, deploySingleProvider } from "./fixtures"; describe("Provider registry", function () { @@ -32,7 +32,7 @@ describe("Provider registry", function () { expect(data).deep.equal({ endpoint: expectedProvider.endpoint, stake: expectedProvider.stake, - timestamp: expectedProvider.timestamp, + createdAt: expectedProvider.createdAt, isDeleted: false, }); expect(events.length).eq(1); @@ -42,31 +42,27 @@ describe("Provider registry", function () { const { providerRegistry, provider } = await loadFixture(deployDiamond); const minStake = 100n; await providerRegistry.write.providerSetMinStake([minStake]); - try { + + await catchError(providerRegistry.abi, "StakeTooLow", async () => { await providerRegistry.simulate.providerRegister([ provider.account.address, minStake - 1n, "endpoint", ]); - expect.fail("Expected error"); - } catch (e) { - expectError(e, providerRegistry.abi, "StakeTooLow"); - } + }); }); it("Should error when registering with insufficient allowance", async function () { const { providerRegistry, provider, tokenMOR } = await loadFixture(deployDiamond); - try { + + await catchError(tokenMOR.abi, "ERC20InsufficientAllowance", async () => { await providerRegistry.simulate.providerRegister([ provider.account.address, 100n, "endpoint", ]); - expect.fail("Expected error"); - } catch (e) { - expectError(e, tokenMOR.abi, "ERC20InsufficientAllowance"); - } + }); }); it("Should error when register account doesnt match sender account", async function () { @@ -74,17 +70,15 @@ describe("Provider registry", function () { const { providerRegistry, provider, tokenMOR, owner } = await loadFixture(deployDiamond); - try { + + await catchError(providerRegistry.abi, "NotSenderOrOwner", async () => { await providerRegistry.simulate.providerRegister( [user.account.address, 100n, "endpoint"], { account: provider.account.address, }, ); - expect.fail("Expected error"); - } catch (e) { - expectError(e, providerRegistry.abi, "NotSenderOrOwner"); - } + }); }); it("Should deregister by provider", async function () { @@ -181,7 +175,7 @@ describe("Provider registry", function () { expect(providerData).deep.equal({ endpoint: updates.endpoint, stake: expectedProvider.stake + updates.addStake, - timestamp: timestamp, + createdAt: timestamp, isDeleted: expectedProvider.isDeleted, }); }); @@ -225,7 +219,7 @@ describe("Provider registry", function () { expect(providerData).deep.equal({ endpoint: expectedProvider.endpoint, stake: expectedProvider.stake, - timestamp: expectedProvider.timestamp, + createdAt: expectedProvider.createdAt, isDeleted: expectedProvider.isDeleted, }); }); @@ -240,7 +234,7 @@ describe("Provider registry", function () { expect(providerData).deep.equal({ endpoint: expectedProvider.endpoint, stake: expectedProvider.stake, - timestamp: expectedProvider.timestamp, + createdAt: expectedProvider.createdAt, isDeleted: expectedProvider.isDeleted, }); }); @@ -258,7 +252,7 @@ describe("Provider registry", function () { expect(providers[0]).deep.equal({ endpoint: expectedProvider.endpoint, stake: expectedProvider.stake, - timestamp: expectedProvider.timestamp, + createdAt: expectedProvider.createdAt, isDeleted: expectedProvider.isDeleted, }); }); @@ -282,18 +276,15 @@ describe("Provider registry", function () { const { providerRegistry, provider } = await loadFixture(deploySingleProvider); - try { - await providerRegistry.write.providerSetMinStake([100n], { - account: provider.account, - }); - expect.fail("Expected error"); - } catch (e) { - expectError( - e, - (await hre.artifacts.readArtifact("OwnershipFacet")).abi, - "NotContractOwner", - ); - } + await catchError( + (await hre.artifacts.readArtifact("OwnershipFacet")).abi, + "NotContractOwner", + async () => { + await providerRegistry.write.providerSetMinStake([100n], { + account: provider.account, + }); + }, + ); }); }); }); diff --git a/smart-contracts/test/SessionRouter.test.ts b/smart-contracts/test/SessionRouter.test.ts deleted file mode 100644 index 7230d1d1..00000000 --- a/smart-contracts/test/SessionRouter.test.ts +++ /dev/null @@ -1,313 +0,0 @@ -import { loadFixture, time } from "@nomicfoundation/hardhat-toolbox-viem/network-helpers"; -import { expect } from "chai"; -import hre from "hardhat"; -import { PublicClient, getAddress, keccak256, parseEventLogs } from "viem"; -import { deploySingleBid, encodedReport } from "./fixtures"; -import { expectError, getHex, getTxTimestamp, randomBytes32 } from "./utils"; -import { DAY, HOUR, MINUTE, SECOND } from "../utils/time"; -import { expectAlmostEqual } from "../utils/compare"; - -describe.skip("Session router", function () { - describe("session actions", function () { - it("should open session", async function () { - const { sessionRouter, expectedBid, user } = await loadFixture(deploySingleBid); - const budget = 100000n * 10n ** 18n; - console.log(budget); - - await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account, - }); - }); - - it("should verify session fields after opening", async function () { - const { sessionRouter, expectedBid, user, publicClient } = await loadFixture(deploySingleBid); - const budget = 100000n * 10n ** 18n; - - const txHash = await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account, - }); - const sessionId = await getSessionId(publicClient, txHash); - const session = await sessionRouter.read.getSession([sessionId]); - const createdAt = await getTxTimestamp(publicClient, txHash); - - expect(session).to.deep.equal({ - id: sessionId, - user: getAddress(user.account.address), - provider: getAddress(expectedBid.providerAddr), - modelAgentId: expectedBid.modelId, - bidID: expectedBid.id, - budget: budget, - price: expectedBid.pricePerSecond, - closeoutReceipt: getHex(Buffer.from(""), 0), - closeoutType: 0n, - openedAt: createdAt, - closedAt: 0n, - }); - }); - - it("should error with NotEnoughStipend when opening session with insufficient stipend", async function () { - const { sessionRouter, expectedBid, user, expectedStake } = await loadFixture( - deploySingleBid - ); - const stakeToKeep = 1n; - const stakeToUnstake = expectedStake.stakeAmount - stakeToKeep; - - await sessionRouter.write.unstake( - [user.account.address, stakeToUnstake, user.account.address], - { - account: user.account, - } - ); - - try { - await sessionRouter.write.openSession([expectedBid.id, stakeToKeep + 1n], { - account: user.account, - }); - expect.fail("Should have thrown an error"); - } catch (error) { - expectError(error, sessionRouter.abi, "NotEnoughStipend"); - } - }); - - it("should fail to open session with invalid bid", async function () { - const { sessionRouter, user } = await loadFixture(deploySingleBid); - - try { - await sessionRouter.write.openSession([randomBytes32(), 0n], { - account: user.account, - }); - expect.fail("Should have thrown an error"); - } catch (error) { - expectError(error, sessionRouter.abi, "BidNotFound"); - } - }); - - it("should fail to open session with duration less than minimum", async function () { - const { sessionRouter, expectedBid, expectedStake, user } = await loadFixture( - deploySingleBid - ); - - await sessionRouter.write.unstake( - [user.account.address, expectedStake.stakeAmount, user.account.address], - { - account: user.account, - } - ); - - try { - await sessionRouter.write.openSession([expectedBid.id, 0n], { - account: user.account, - }); - expect.fail("Should have thrown an error"); - } catch (error) { - expectError(error, sessionRouter.abi, "SessionTooShort"); - } - }); - - it("should not open session with same bid simultaneously", async function () { - const { sessionRouter, expectedBid, user } = await loadFixture(deploySingleBid); - const budget = expectedBid.pricePerSecond * BigInt(HOUR / SECOND); - - await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account.address, - }); - - try { - await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account.address, - }); - expect.fail("Should have thrown an error"); - } catch (error) { - expectError(error, sessionRouter.abi, "BidTaken"); - } - }); - - it("should open session with same bid after previous session is closed", async function () { - const { sessionRouter, expectedBid, user, publicClient, provider } = await loadFixture( - deploySingleBid - ); - const budget = expectedBid.pricePerSecond * BigInt(HOUR / SECOND); - - // first purchase - const openTx = await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account.address, - }); - const sessionId = await getSessionId(publicClient, openTx); - - // first closeout - const signature = await provider.signMessage({ - message: { raw: keccak256(encodedReport) }, - }); - await sessionRouter.write.closeSession([sessionId, encodedReport, signature], { - account: user.account, - }); - - // second purchase same bidId - const openTx2 = await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account.address, - }); - - // expect no purchase error - }); - - it("should emit session opened with session id", async function () { - const { sessionRouter, provider, expectedBid, user, publicClient, tokenMOR } = - await loadFixture(deploySingleBid); - - const budget = expectedBid.pricePerSecond * BigInt(HOUR / SECOND); - const openSession = await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account.address, - }); - const receipt = await publicClient.waitForTransactionReceipt({ hash: openSession }); - const events = parseEventLogs({ - abi: sessionRouter.abi, - logs: receipt.logs, - eventName: "SessionOpened", - }); - const [event] = events; - - expect(events.length).to.equal(1); - expect(event.args.userAddress).to.equal(getAddress(user.account.address)); - expect(event.args.providerId).to.equal(getAddress(provider.account.address)); - - const sessionId = await getSessionId(publicClient, openSession); - expect(sessionId).to.equal(event.args.sessionId); - }); - - it("should open and close early", async function () { - const { sessionRouter, provider, expectedBid, user, publicClient, tokenMOR } = - await loadFixture(deploySingleBid); - const budget = expectedBid.pricePerSecond * BigInt(HOUR / SECOND); - - // save balance before opening session - const balanceBeforeOpen = await sessionRouter.read.balanceOfDailyStipend([ - user.account.address, - ]); - const providerBalanceBefore = await tokenMOR.read.balanceOf([provider.account.address]); - - // open session - const openTx = await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account.address, - }); - const sessionId = await getSessionId(publicClient, openTx); - - await time.increase((30 * MINUTE) / SECOND); - const balanceBeforeClose = await sessionRouter.read.balanceOfDailyStipend([ - user.account.address, - ]); - - // close session - const signature = await provider.signMessage({ - message: { raw: keccak256(encodedReport) }, - }); - await sessionRouter.write.closeSession([sessionId, encodedReport, signature], { - account: user.account, - }); - - // verify session is closed without dispute - const session = await sessionRouter.read.getSession([sessionId]); - expect(session.closeoutType).to.equal(0n); - - // verify balances - const balanceAfterClose = await sessionRouter.read.balanceOfDailyStipend([ - user.account.address, - ]); - const providerBalanceAfter = await tokenMOR.read.balanceOf([provider.account.address]); - - const stipendLocked = balanceBeforeOpen - balanceBeforeClose; - const stipendSpent = balanceBeforeOpen - balanceAfterClose; - const providerEarned = providerBalanceAfter - providerBalanceBefore; - - expect(stipendSpent).to.equal(providerEarned); - expectAlmostEqual(stipendLocked / 2n, stipendSpent, 0.05); - }); - - it("should open and close with user report - dispute", async function () { - const { sessionRouter, provider, expectedBid, user, publicClient, tokenMOR } = - await loadFixture(deploySingleBid); - const budget = expectedBid.pricePerSecond * BigInt(HOUR / SECOND); - - // save balance before opening session - const balanceBeforeOpen = await sessionRouter.read.balanceOfDailyStipend([ - user.account.address, - ]); - const providerBalanceBefore = await tokenMOR.read.balanceOf([provider.account.address]); - - // open session - const openTx = await sessionRouter.write.openSession([expectedBid.id, budget], { - account: user.account.address, - }); - const sessionId = await getSessionId(publicClient, openTx); - - await time.increase((30 * MINUTE) / SECOND); - const balanceBeforeClose = await sessionRouter.read.balanceOfDailyStipend([ - user.account.address, - ]); - - // close session with invalid signature - const signature = getHex(Buffer.from(""), 0); - await sessionRouter.write.closeSession([sessionId, encodedReport, signature], { - account: user.account, - }); - - // verify session is closed with dispute - const session = await sessionRouter.read.getSession([sessionId]); - expect(session.closeoutType).to.equal(1n); - - // verify balances - const balanceAfterClose = await sessionRouter.read.balanceOfDailyStipend([ - user.account.address, - ]); - const providerBalanceAfter = await tokenMOR.read.balanceOf([provider.account.address]); - const [total, onHold] = await sessionRouter.read.getProviderBalance([ - provider.account.address, - ]); - - const stipendLocked = balanceBeforeOpen - balanceBeforeClose; - const stipendSpent = balanceBeforeOpen - balanceAfterClose; - const providerEarned = providerBalanceAfter - providerBalanceBefore; - - expect(providerEarned).to.equal(0n); - expect(onHold).to.equal(stipendSpent); - expectAlmostEqual(stipendLocked / 2n, stipendSpent, 0.05); - - // verify provider balance after dispute is released - await time.increase((1 * DAY) / SECOND); - const [total2, onHold2] = await sessionRouter.read.getProviderBalance([ - provider.account.address, - ]); - expect(total2).to.equal(total); - expect(onHold2).to.equal(0n); - - // verify user balance after dispute is claimable - await sessionRouter.write.claimProviderBalance([total2, provider.account.address], { - account: provider.account.address, - }); - - const [total3, onHold3] = await sessionRouter.read.getProviderBalance([ - provider.account.address, - ]); - expect(total3).to.equal(0n); - expect(onHold3).to.equal(0n); - - // verify provider balance after claim - const providerBalanceAfterClaim = await tokenMOR.read.balanceOf([provider.account.address]); - const providerClaimed = providerBalanceAfterClaim - providerBalanceAfter; - expect(providerClaimed).to.equal(total2); - }); - }); -}); - -async function getSessionId( - publicClient: PublicClient, - txHash: `0x${string}` -): Promise<`0x${string}`> { - const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash }); - const artifact = await hre.artifacts.readArtifact("SessionRouter"); - const [event] = parseEventLogs({ - abi: artifact.abi, - logs: receipt.logs, - eventName: "SessionOpened", - }); - return event.args.sessionId; -} \ No newline at end of file diff --git a/smart-contracts/test/SessionRouter/closeSession.test.ts b/smart-contracts/test/SessionRouter/closeSession.test.ts new file mode 100644 index 00000000..569a5261 --- /dev/null +++ b/smart-contracts/test/SessionRouter/closeSession.test.ts @@ -0,0 +1,248 @@ +import { + loadFixture, + time, +} from "@nomicfoundation/hardhat-toolbox-viem/network-helpers"; +import { expect } from "chai"; +import hre from "hardhat"; +import { keccak256 } from "viem"; +import { deploySingleBid, getProviderApproval, getReport } from "../fixtures"; +import { getSessionId } from "../utils"; +import { DAY, HOUR, SECOND } from "../../utils/time"; +import { expectAlmostEqual } from "../../utils/compare"; + +describe("session closeout", function () { + it("should open short (<1D) session and close later", async function () { + const { + sessionRouter, + provider, + expectedSession: exp, + user, + publicClient, + tokenMOR, + } = await loadFixture(deploySingleBid); + + // open session + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const openTx = await sessionRouter.write.openSession( + [exp.stake, msg, signature], + { + account: user.account.address, + }, + ); + const sessionId = await getSessionId(publicClient, hre, openTx); + + await time.increase(exp.durationSeconds * 2n); + + const userBalanceBefore = await tokenMOR.read.balanceOf([ + user.account.address, + ]); + const providerBalanceBefore = await tokenMOR.read.balanceOf([ + provider.account.address, + ]); + + // close session + const report = await getReport(provider, sessionId, 10); + await sessionRouter.write.closeSession([report.msg, report.sig], { + account: user.account, + }); + + // verify session is closed without dispute + const session = await sessionRouter.read.getSession([sessionId]); + expect(session.closeoutType).to.equal(0n); + + // verify balances + const userBalanceAfter = await tokenMOR.read.balanceOf([ + user.account.address, + ]); + const providerBalanceAfter = await tokenMOR.read.balanceOf([ + provider.account.address, + ]); + + const userStakeReturned = userBalanceAfter - userBalanceBefore; + const providerEarned = providerBalanceAfter - providerBalanceBefore; + + expect(userStakeReturned).to.equal(0n); + expectAlmostEqual(providerEarned, exp.totalCost, 0.0001); + }); + + it("should open short (<1D) session and close early", async function () { + const { + sessionRouter, + provider, + expectedSession: exp, + user, + publicClient, + tokenMOR, + } = await loadFixture(deploySingleBid); + + // open session + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const openTx = await sessionRouter.write.openSession( + [exp.stake, msg, signature], + { + account: user.account.address, + }, + ); + const sessionId = await getSessionId(publicClient, hre, openTx); + + await time.increase(exp.durationSeconds / 2n - 1n); + + const userBalanceBefore = await tokenMOR.read.balanceOf([ + user.account.address, + ]); + const providerBalanceBefore = await tokenMOR.read.balanceOf([ + provider.account.address, + ]); + + // close session + const report = await getReport(provider, sessionId, 10); + await sessionRouter.write.closeSession([report.msg, report.sig], { + account: user.account, + }); + + // verify session is closed without dispute + const session = await sessionRouter.read.getSession([sessionId]); + expect(session.closeoutType).to.equal(0n); + + // verify balances + const userBalanceAfter = await tokenMOR.read.balanceOf([ + user.account.address, + ]); + const providerBalanceAfter = await tokenMOR.read.balanceOf([ + provider.account.address, + ]); + + const userStakeReturned = userBalanceAfter - userBalanceBefore; + const providerEarned = providerBalanceAfter - providerBalanceBefore; + + expectAlmostEqual(userStakeReturned, exp.stake / 2n, 0.0001); + expectAlmostEqual(providerEarned, exp.totalCost / 2n, 0.0001); + }); + + it("should open and close early with user report - dispute", async function () { + const { + sessionRouter, + provider, + expectedSession: exp, + user, + publicClient, + tokenMOR, + } = await loadFixture(deploySingleBid); + + // open session + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const openTx = await sessionRouter.write.openSession( + [exp.stake, msg, signature], + { account: user.account.address }, + ); + const sessionId = await getSessionId(publicClient, hre, openTx); + + // wait half of the session + await time.increase(exp.durationSeconds / 2n - 1n); + + const userBalanceBefore = await tokenMOR.read.balanceOf([ + user.account.address, + ]); + const providerBalanceBefore = await tokenMOR.read.balanceOf([ + provider.account.address, + ]); + + // close session with user signature + const report = await getReport(user, sessionId, 10); + await sessionRouter.write.closeSession([report.msg, report.sig], { + account: user.account, + }); + + // verify session is closed with dispute + const session = await sessionRouter.read.getSession([sessionId]); + + // verify balances + const userBalanceAfter = await tokenMOR.read.balanceOf([ + user.account.address, + ]); + const providerBalanceAfter = await tokenMOR.read.balanceOf([ + provider.account.address, + ]); + + const claimableProvider = + await sessionRouter.read.getProviderClaimableBalance([session.id]); + + const [userAvail, userHold] = + await sessionRouter.read.withdrawableUserStake([session.user]); + + expect(session.closeoutType).to.equal(1n); + expect(providerBalanceAfter - providerBalanceBefore).to.equal(0n); + expect(claimableProvider).to.equal(0n); + expectAlmostEqual( + exp.stake / 2n, + userBalanceAfter - userBalanceBefore, + 0.05, + ); + expect(userAvail).to.equal(0n); + expectAlmostEqual(userHold, userBalanceAfter - userBalanceBefore, 0.05); + + // verify provider balance after dispute is released + await time.increase((1 * DAY) / SECOND); + const claimableProvider2 = + await sessionRouter.read.getProviderClaimableBalance([sessionId]); + expect(claimableProvider2).to.equal(exp.totalCost); + + return; + // verify user balance after dispute is claimable + await sessionRouter.write.claimProviderBalance( + [total2, provider.account.address], + { + account: provider.account.address, + }, + ); + + const [total3, onHold3] = await sessionRouter.read.getProviderBalance([ + provider.account.address, + ]); + expect(total3).to.equal(0n); + expect(onHold3).to.equal(0n); + + // verify provider balance after claim + const providerBalanceAfterClaim = await tokenMOR.read.balanceOf([ + provider.account.address, + ]); + const providerClaimed = providerBalanceAfterClaim - providerBalanceAfter; + expect(providerClaimed).to.equal(total2); + }); + + it.skip("should open session with same bid after previous session is closed", async function () { + const { sessionRouter, expectedBid, user, publicClient, provider } = + await loadFixture(deploySingleBid); + const budget = expectedBid.pricePerSecond * BigInt(HOUR / SECOND); + + // first purchase + const openTx = await sessionRouter.write.openSession( + [expectedBid.id, budget], + { + account: user.account.address, + }, + ); + const sessionId = await getSessionId(publicClient, hre, openTx); + + // first closeout + const signature = await provider.signMessage({ + message: { raw: keccak256(encodedReport) }, + }); + await sessionRouter.write.closeSession( + [sessionId, encodedReport, signature], + { + account: user.account, + }, + ); + + // second purchase same bidId + const openTx2 = await sessionRouter.write.openSession( + [expectedBid.id, budget], + { + account: user.account.address, + }, + ); + + // expect no purchase error + }); +}); diff --git a/smart-contracts/test/SessionRouter/openSession.test.ts b/smart-contracts/test/SessionRouter/openSession.test.ts new file mode 100644 index 00000000..31a1adc1 --- /dev/null +++ b/smart-contracts/test/SessionRouter/openSession.test.ts @@ -0,0 +1,471 @@ +import { + loadFixture, + time, +} from "@nomicfoundation/hardhat-toolbox-viem/network-helpers"; +import { expect } from "chai"; +import hre from "hardhat"; +import { deploySingleBid, getProviderApproval } from "../fixtures"; +import { + NewDate, + catchError, + getHex, + getSessionId, + getTxTimestamp, + now, + now2, + randomBytes, + randomBytes32, + startOfTheDay, +} from "../utils"; +import { DAY, HOUR, SECOND } from "../../utils/time"; +import { UnknownRpcError } from "viem"; + +describe("session actions", function () { + describe("positive cases", function () { + it("should open session without error", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + publicClient, + provider, + } = await loadFixture(deploySingleBid); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const openTx = await sessionRouter.write.openSession( + [exp.stake, msg, signature], + { account: user.account }, + ); + + const sessionId = await getSessionId(publicClient, hre, openTx); + expect(sessionId).to.be.a("string"); + }); + + it("should emit SessionOpened event", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + provider, + publicClient, + } = await loadFixture(deploySingleBid); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const hash = await sessionRouter.write.openSession( + [exp.stake, msg, signature], + { account: user.account }, + ); + + await publicClient.waitForTransactionReceipt({ hash }); + const ev = await sessionRouter.getEvents.SessionOpened({ + providerId: exp.provider, + userAddress: exp.user, + }); + expect(ev.length).to.eq(1); + }); + + it("should verify session fields after opening", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + publicClient, + provider, + } = await loadFixture(deploySingleBid); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const openTx = await sessionRouter.write.openSession( + [exp.stake, msg, signature], + { account: user.account }, + ); + + const sessionId = await getSessionId(publicClient, hre, openTx); + const session = await sessionRouter.read.getSession([sessionId]); + const createdAt = await getTxTimestamp(publicClient, openTx); + + expect(session).to.deep.include({ + id: sessionId, + user: exp.user, + provider: exp.provider, + modelAgentId: exp.modelAgentId, + bidID: exp.bidID, + stake: exp.stake, + pricePerSecond: exp.pricePerSecond, + closeoutReceipt: getHex(Buffer.from(""), 0), + closeoutType: 0n, + providerWithdrawnAmount: 0n, + openedAt: createdAt, + // endsAt: verified in session end time tests + closedAt: 0n, + }); + }); + + it("should verify balances after opening", async function () { + const { + sessionRouter, + expectedSession: exp, + publicClient, + user, + tokenMOR, + provider, + } = await loadFixture(deploySingleBid); + + const srBefore = await tokenMOR.read.balanceOf([sessionRouter.address]); + const userBefore = await tokenMOR.read.balanceOf([user.account.address]); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const txHash = await sessionRouter.write.openSession( + [exp.stake, msg, signature], + { account: user.account }, + ); + await publicClient.waitForTransactionReceipt({ hash: txHash }); + + const srAfter = await tokenMOR.read.balanceOf([sessionRouter.address]); + const userAfter = await tokenMOR.read.balanceOf([user.account.address]); + + expect(srAfter - srBefore).to.equal(exp.stake); + expect(userBefore - userAfter).to.equal(exp.stake); + }); + }); + + describe("negative cases", function () { + it("should error when approval bytes is invalid abi data", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + provider, + } = await loadFixture(deploySingleBid); + try { + await sessionRouter.write.openSession([exp.stake, "0x0", "0x0"], { + account: user.account, + }); + } catch (e) { + expect((e as Error).cause).to.be.an.instanceOf(UnknownRpcError); + } + }); + + it("should error when approval expired", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + provider, + } = await loadFixture(deploySingleBid); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const ttl = await sessionRouter.read.SIGNATURE_TTL(); + await time.increase(ttl + 1); + + await catchError(sessionRouter.abi, "SignatureExpired", async () => { + await sessionRouter.write.openSession([exp.stake, msg, signature], { + account: user.account, + }); + }); + }); + + it("should error when bid not exist", async function () { + const { + sessionRouter, + user, + expectedSession: exp, + provider, + } = await loadFixture(deploySingleBid); + + const { msg, signature } = await getProviderApproval( + provider, + randomBytes32(), + ); + await catchError(sessionRouter.abi, "BidNotFound", async () => { + await sessionRouter.write.openSession([exp.stake, msg, signature], { + account: user.account, + }); + }); + }); + + it("should error when bid is deleted", async function () { + const { + sessionRouter, + user, + expectedSession: exp, + marketplace, + provider, + } = await loadFixture(deploySingleBid); + + await marketplace.write.deleteModelAgentBid([exp.bidID], { + account: provider.account, + }); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + await catchError(sessionRouter.abi, "BidNotFound", async () => { + await sessionRouter.write.openSession([exp.stake, msg, signature], { + account: user.account, + }); + }); + }); + + it("should error when signature has invalid length", async function () { + const { + sessionRouter, + user, + expectedSession: exp, + provider, + } = await loadFixture(deploySingleBid); + + const { msg } = await getProviderApproval(provider, exp.bidID); + await catchError( + sessionRouter.abi, + "ECDSAInvalidSignatureLength", + async () => { + await sessionRouter.write.openSession([exp.stake, msg, "0x0"], { + account: user.account, + }); + }, + ); + }); + + it("should error when signature is invalid", async function () { + const { + sessionRouter, + user, + expectedSession: exp, + provider, + } = await loadFixture(deploySingleBid); + + const { msg } = await getProviderApproval(provider, exp.bidID); + const sig = randomBytes(65); + + await catchError( + sessionRouter.abi, + ["ECDSAInvalidSignatureS", "ECDSAInvalidSignature"], + async () => { + await sessionRouter.write.openSession([exp.stake, msg, sig], { + account: user.account, + }); + }, + ); + }); + + it("should error when opening two bids with same signature", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + provider, + approveUserFunds, + } = await loadFixture(deploySingleBid); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + await sessionRouter.write.openSession([exp.stake, msg, signature], { + account: user.account.address, + }); + + await approveUserFunds(exp.stake); + + await catchError(sessionRouter.abi, "DuplicateApproval", async () => { + await sessionRouter.write.openSession([exp.stake, msg, signature], { + account: user.account.address, + }); + }); + }); + + it("should not error when opening two bids same time", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + provider, + approveUserFunds, + } = await loadFixture(deploySingleBid); + + const appr1 = await getProviderApproval(provider, exp.bidID); + await sessionRouter.write.openSession( + [exp.stake, appr1.msg, appr1.signature], + { + account: user.account.address, + }, + ); + + await approveUserFunds(exp.stake); + const appr2 = await getProviderApproval(provider, exp.bidID); + await sessionRouter.write.openSession( + [exp.stake, appr2.msg, appr2.signature], + { + account: user.account.address, + }, + ); + }); + + it("should error with insufficient allowance", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + provider, + tokenMOR, + } = await loadFixture(deploySingleBid); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + await catchError(tokenMOR.abi, "ERC20InsufficientAllowance", async () => { + await sessionRouter.write.openSession( + [exp.stake * 2n, msg, signature], + { + account: user.account, + }, + ); + }); + }); + + it("should error with insufficient allowance", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + provider, + tokenMOR, + } = await loadFixture(deploySingleBid); + + const stake = + (await tokenMOR.read.balanceOf([user.account.address])) + 1n; + await tokenMOR.write.approve([sessionRouter.address, stake], { + account: user.account, + }); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + await catchError(tokenMOR.abi, "ERC20InsufficientBalance", async () => { + await sessionRouter.write.openSession([stake, msg, signature], { + account: user.account, + }); + }); + }); + }); +}); + +describe("verify session end time", function () { + it("session that doesn't span across midnight (1h)", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + publicClient, + getStake, + provider, + } = await loadFixture(deploySingleBid); + + const durationSeconds = BigInt(HOUR / SECOND); + const stake = await getStake(durationSeconds, exp.pricePerSecond); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const txHash = await sessionRouter.write.openSession( + [stake, msg, signature], + { + account: user.account, + }, + ); + + const sessionId = await getSessionId(publicClient, hre, txHash); + const session = await sessionRouter.read.getSession([sessionId]); + const createdAt = await getTxTimestamp(publicClient, txHash); + + expect(session.endsAt).to.equal(createdAt + exp.durationSeconds); + }); + + it("session that spans across midnight (6h)", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + publicClient, + getStake, + getDuration, + approveUserFunds, + provider, + } = await loadFixture(deploySingleBid); + + const tomorrow9pm = + startOfTheDay(await now2()) + + BigInt(DAY / SECOND) + + 21n * BigInt(HOUR / SECOND); + await time.increaseTo(tomorrow9pm); // 9pm + + // the stake is enough to cover the first day (3h till midnight) and the next day (< 6h) + const durationSeconds = 6n * BigInt(HOUR / SECOND); + const stake = await getStake(durationSeconds, exp.pricePerSecond); + await approveUserFunds(stake); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const txHash = await sessionRouter.write.openSession( + [stake, msg, signature], + { account: user.account }, + ); + + await time.increase((3 * HOUR) / SECOND + 1); + const durarion2ndDay = await getDuration(stake, exp.pricePerSecond); + const effectiveDuration = 3n * BigInt(HOUR / SECOND) + durarion2ndDay; + + const sessionId = await getSessionId(publicClient, hre, txHash); + const session = await sessionRouter.read.getSession([sessionId]); + const createdAt = await getTxTimestamp(publicClient, txHash); + + const endsAt = NewDate(session.endsAt); + const expEndsAt = NewDate(createdAt + effectiveDuration); + + expect(endsAt.getTime()).approximately(expEndsAt.getTime(), 10 * SECOND); + }); + + it.skip("session that lasts multiple days", async function () { + const { + sessionRouter, + expectedSession: exp, + user, + publicClient, + getStake, + getDuration, + approveUserFunds, + provider, + } = await loadFixture(deploySingleBid); + + for (let i = 0; i < 100; i++) { + console.log( + await sessionRouter.read.getTodaysBudget([ + now() + BigInt((i * DAY) / SECOND), + ]), + ); + } + return; + + const midnight = startOfTheDay(await now2()) + BigInt(DAY / SECOND); + await time.increaseTo(midnight); // 9pm + + // the stake is enough to cover the whole day + extra 6h + const durationSeconds = 25n * BigInt(HOUR / SECOND); + const stake = await getStake(durationSeconds, exp.pricePerSecond); + await approveUserFunds(stake); + + const { msg, signature } = await getProviderApproval(provider, exp.bidID); + const txHash = await sessionRouter.write.openSession( + [stake, msg, signature], + { account: user.account }, + ); + + const sessionId = await getSessionId(publicClient, hre, txHash); + const session = await sessionRouter.read.getSession([sessionId]); + + const endsAt = NewDate(session.endsAt); + // const expEndsAt = NewDate(createdAt + effectiveDuration); + + console.log("start", NewDate(session.openedAt)); + console.log("actual", endsAt); + console.log("duration", session.endsAt - session.openedAt, "seconds"); + + const lastDay = session.endsAt - BigInt(DAY / SECOND); + + await time.increaseTo(lastDay); + const dd = await sessionRouter.read.stakeToStipend([stake, lastDay]); + console.log("stipend last day\t", dd); + console.log( + "stipend needed for 24h\t", + Number(session.pricePerSecond) * 24 * 3600, + ); + }); +}); diff --git a/smart-contracts/test/SessionRouter/readFunctions.test.ts b/smart-contracts/test/SessionRouter/readFunctions.test.ts new file mode 100644 index 00000000..dd826231 --- /dev/null +++ b/smart-contracts/test/SessionRouter/readFunctions.test.ts @@ -0,0 +1,35 @@ +import { loadFixture } from "@nomicfoundation/hardhat-toolbox-viem/network-helpers"; +import { expect } from "chai"; +import { deploySingleBid } from "../fixtures"; + +describe("Session router", function () { + describe("session read functions", function () { + it("should get compute balance equal to one on L1", async function () { + const { sessionRouter } = await loadFixture(deploySingleBid); + const exp = { + initialReward: 3456000000000000000000n, + rewardDecrease: 592558728240000000n, + payoutStart: 1707393600n, + decreaseInterval: 86400n, + blockTimeEpochSeconds: + BigInt(new Date("2024-05-02T09:19:57Z").getTime()) / 1000n, + balance: 3406521346191960000000n, + }; + + await sessionRouter.write.setPoolConfig([ + { + initialReward: exp.initialReward, + rewardDecrease: exp.rewardDecrease, + payoutStart: exp.payoutStart, + decreaseInterval: exp.decreaseInterval, + }, + ]); + + const balance = await sessionRouter.read.getComputeBalance([ + exp.blockTimeEpochSeconds, + ]); + + expect(balance).to.equal(exp.balance); + }); + }); +}); diff --git a/smart-contracts/test/Staking.test.ts b/smart-contracts/test/Staking.test.ts index fd8cc117..015ca28a 100644 --- a/smart-contracts/test/Staking.test.ts +++ b/smart-contracts/test/Staking.test.ts @@ -1,4 +1,7 @@ -import { loadFixture, time } from "@nomicfoundation/hardhat-toolbox-viem/network-helpers"; +import { + loadFixture, + time, +} from "@nomicfoundation/hardhat-toolbox-viem/network-helpers"; import { expect } from "chai"; import { deployDiamond } from "./fixtures"; import { expectError } from "./utils"; @@ -9,11 +12,13 @@ describe.skip("Staking", function () { const { sessionRouter, expectedStake } = await loadFixture(deployDiamond); expect(await sessionRouter.read.userStake([expectedStake.account])).equal( - expectedStake.stakeAmount - ); - expect(await sessionRouter.read.withdrawableStakeBalance([expectedStake.account])).equal( - expectedStake.stakeAmount + expectedStake.stakeAmount, ); + expect( + await sessionRouter.read.withdrawableStakeBalance([ + expectedStake.account, + ]), + ).equal(expectedStake.stakeAmount); }); it("should unstake", async function () { @@ -23,10 +28,12 @@ describe.skip("Staking", function () { [expectedStake.account, expectedStake.stakeAmount, expectedStake.account], { account: expectedStake.account, - } + }, ); - expect(await sessionRouter.read.userStake([expectedStake.account])).equal(0n); + expect(await sessionRouter.read.userStake([expectedStake.account])).equal( + 0n, + ); }); // rewrite with real purchases @@ -34,12 +41,15 @@ describe.skip("Staking", function () { it("should return daily stipend", async function () { const { sessionRouter, expectedStake } = await loadFixture(deployDiamond); - const balance = await sessionRouter.read.balanceOfDailyStipend([expectedStake.account]); + const balance = await sessionRouter.read.balanceOfDailyStipend([ + expectedStake.account, + ]); expect(balance).eq(expectedStake.expectedStipend); }); it("should spend daily stipend", async function () { - const { sessionRouter, expectedStake, tokenMOR } = await loadFixture(deployDiamond); + const { sessionRouter, expectedStake, tokenMOR } = + await loadFixture(deployDiamond); // await sessionRouter.write.transferDailyStipend( // [expectedStake.account, expectedStake.transferTo, expectedStake.spendAmount], @@ -47,37 +57,38 @@ describe.skip("Staking", function () { // ); expect(await tokenMOR.read.balanceOf([expectedStake.transferTo])).eq( - expectedStake.spendAmount - ); - expect(await sessionRouter.read.balanceOfDailyStipend([expectedStake.account])).eq( - expectedStake.expectedStipend - expectedStake.spendAmount + expectedStake.spendAmount, ); + expect( + await sessionRouter.read.balanceOfDailyStipend([expectedStake.account]), + ).eq(expectedStake.expectedStipend - expectedStake.spendAmount); }); it("should count spend amount correctly when spent second time same day", async function () { - const { sessionRouter, expectedStake, tokenMOR } = await loadFixture(deployDiamond); + const { sessionRouter, expectedStake, tokenMOR } = + await loadFixture(deployDiamond); // await sessionRouter.write.transferDailyStipend( // [expectedStake.account, expectedStake.transferTo, expectedStake.spendAmount], // { account: expectedStake.account } // ); expect(await tokenMOR.read.balanceOf([expectedStake.transferTo])).eq( - expectedStake.spendAmount - ); - expect(await sessionRouter.read.balanceOfDailyStipend([expectedStake.account])).eq( - expectedStake.expectedStipend - expectedStake.spendAmount + expectedStake.spendAmount, ); + expect( + await sessionRouter.read.balanceOfDailyStipend([expectedStake.account]), + ).eq(expectedStake.expectedStipend - expectedStake.spendAmount); // await sessionRouter.write.transferDailyStipend( // [expectedStake.account, expectedStake.transferTo, expectedStake.spendAmount], // { account: expectedStake.account } // ); expect(await tokenMOR.read.balanceOf([expectedStake.transferTo])).eq( - expectedStake.spendAmount * 2n - ); - expect(await sessionRouter.read.balanceOfDailyStipend([expectedStake.account])).eq( - expectedStake.expectedStipend - expectedStake.spendAmount * 2n + expectedStake.spendAmount * 2n, ); + expect( + await sessionRouter.read.balanceOfDailyStipend([expectedStake.account]), + ).eq(expectedStake.expectedStipend - expectedStake.spendAmount * 2n); }); it("should error when spending more than daily stipend", async function () { @@ -87,14 +98,14 @@ describe.skip("Staking", function () { // [expectedStake.account, expectedStake.transferTo, expectedStake.expectedStipend + 1n], // { account: expectedStake.account } // ); - expect.fail("Should have thrown an error"); } catch (e) { expectError(e, sessionRouter.abi, "NotEnoughStipend"); } }); it("should reset daily stipend value on the next day", async function () { - const { sessionRouter, expectedStake, tokenMOR } = await loadFixture(deployDiamond); + const { sessionRouter, expectedStake, tokenMOR } = + await loadFixture(deployDiamond); // await sessionRouter.write.transferDailyStipend( // [expectedStake.account, expectedStake.transferTo, expectedStake.spendAmount], @@ -102,20 +113,21 @@ describe.skip("Staking", function () { // ); expect(await tokenMOR.read.balanceOf([expectedStake.transferTo])).eq( - expectedStake.spendAmount - ); - expect(await sessionRouter.read.balanceOfDailyStipend([expectedStake.account])).eq( - expectedStake.expectedStipend - expectedStake.spendAmount + expectedStake.spendAmount, ); + expect( + await sessionRouter.read.balanceOfDailyStipend([expectedStake.account]), + ).eq(expectedStake.expectedStipend - expectedStake.spendAmount); await time.increase(DAY / SECOND); - expect(await sessionRouter.read.balanceOfDailyStipend([expectedStake.account])).eq( - expectedStake.expectedStipend - ); + expect( + await sessionRouter.read.balanceOfDailyStipend([expectedStake.account]), + ).eq(expectedStake.expectedStipend); }); it("should lock unstaking till next day after using stipend", async function () { - const { sessionRouter, expectedStake, tokenMOR } = await loadFixture(deployDiamond); + const { sessionRouter, expectedStake, tokenMOR } = + await loadFixture(deployDiamond); // await sessionRouter.write.transferDailyStipend( // [expectedStake.account, expectedStake.transferTo, expectedStake.spendAmount], @@ -123,61 +135,80 @@ describe.skip("Staking", function () { // ); expect(await sessionRouter.read.userStake([expectedStake.account])).eq( - expectedStake.stakeAmount + expectedStake.stakeAmount, ); - const withdrawableStakeBefore = await sessionRouter.read.withdrawableStakeBalance([ - expectedStake.account, - ]); + const withdrawableStakeBefore = + await sessionRouter.read.withdrawableStakeBalance([ + expectedStake.account, + ]); await time.increase(DAY / SECOND); - const withdrawableStakeAfter = await sessionRouter.read.withdrawableStakeBalance([ - expectedStake.account, - ]); + const withdrawableStakeAfter = + await sessionRouter.read.withdrawableStakeBalance([ + expectedStake.account, + ]); expect(withdrawableStakeBefore < withdrawableStakeAfter).eq(true); expect(withdrawableStakeAfter).eq(expectedStake.stakeAmount); - const balanceBefore = await tokenMOR.read.balanceOf([expectedStake.account]); + const balanceBefore = await tokenMOR.read.balanceOf([ + expectedStake.account, + ]); await sessionRouter.write.unstake( - [expectedStake.account, expectedStake.stakeAmount, expectedStake.account], + [ + expectedStake.account, + expectedStake.stakeAmount, + expectedStake.account, + ], { account: expectedStake.account, - } + }, ); - const balanceAfter = await tokenMOR.read.balanceOf([expectedStake.account]); + const balanceAfter = await tokenMOR.read.balanceOf([ + expectedStake.account, + ]); - expect(await sessionRouter.read.userStake([expectedStake.account])).eq(0n); + expect(await sessionRouter.read.userStake([expectedStake.account])).eq( + 0n, + ); expect(balanceAfter - balanceBefore).eq(expectedStake.stakeAmount); }); it("should return stipend to the staking contract and increase daily stipend", async function () { - const { sessionRouter, expectedStake, tokenMOR } = await loadFixture(deployDiamond); + const { sessionRouter, expectedStake, tokenMOR } = + await loadFixture(deployDiamond); - const stipendBeforeTransfer = await sessionRouter.read.balanceOfDailyStipend([ - expectedStake.account, - ]); + const stipendBeforeTransfer = + await sessionRouter.read.balanceOfDailyStipend([expectedStake.account]); // await sessionRouter.write.transferDailyStipend( // [expectedStake.account, expectedStake.transferTo, expectedStake.spendAmount], // { account: expectedStake.account } // ); - const stipendAfterTransfer = await sessionRouter.read.balanceOfDailyStipend([ - expectedStake.account, - ]); + const stipendAfterTransfer = + await sessionRouter.read.balanceOfDailyStipend([expectedStake.account]); - await tokenMOR.write.approve([sessionRouter.address, expectedStake.spendAmount], { - account: expectedStake.transferTo, - }); - await sessionRouter.write.returnStipend([expectedStake.account, expectedStake.spendAmount], { - account: expectedStake.transferTo, - }); + await tokenMOR.write.approve( + [sessionRouter.address, expectedStake.spendAmount], + { + account: expectedStake.transferTo, + }, + ); + await sessionRouter.write.returnStipend( + [expectedStake.account, expectedStake.spendAmount], + { + account: expectedStake.transferTo, + }, + ); - const stipendAfterRefund = await sessionRouter.read.balanceOfDailyStipend([ - expectedStake.account, - ]); + const stipendAfterRefund = await sessionRouter.read.balanceOfDailyStipend( + [expectedStake.account], + ); - expect(stipendAfterTransfer).eq(stipendBeforeTransfer - expectedStake.spendAmount); + expect(stipendAfterTransfer).eq( + stipendBeforeTransfer - expectedStake.spendAmount, + ); expect(stipendBeforeTransfer).eq(stipendAfterRefund); }); }); diff --git a/smart-contracts/test/fixtures.ts b/smart-contracts/test/fixtures.ts index bb89b89b..b8cfc586 100644 --- a/smart-contracts/test/fixtures.ts +++ b/smart-contracts/test/fixtures.ts @@ -1,8 +1,20 @@ import hre from "hardhat"; -import { encodeFunctionData, encodePacked, getAddress, parseUnits } from "viem/utils"; -import { getHex, getTxTimestamp, randomBytes32 } from "./utils"; -import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; +import { + encodeAbiParameters, + encodeFunctionData, + encodePacked, + getAddress, + keccak256, + parseUnits, +} from "viem/utils"; +import { getHex, getTxTimestamp, now, now2, randomBytes32 } from "./utils"; +import { loadFixture, time } from "@nomicfoundation/hardhat-network-helpers"; import { FacetCutAction, getSelectors } from "../libraries/diamond"; +import { HOUR, MINUTE, SECOND } from "../utils/time"; +import { + GetContractReturnType, + WalletClient, +} from "@nomicfoundation/hardhat-viem/types"; export async function deployMORtoken() { const [owner] = await hre.viem.getWalletClients(); @@ -21,12 +33,50 @@ export async function deployMORtoken() { export async function deployDiamond() { // deploy provider registry and deps const { tokenMOR, owner, decimalsMOR } = await loadFixture(deployMORtoken); - - const [, provider, user] = await hre.viem.getWalletClients(); + const [_, provider, user] = await hre.viem.getWalletClients(); const publicClient = await hre.viem.getPublicClient(); + const { diamond } = await onlyDeployDiamond(tokenMOR.address, owner); + + const modelRegistry = await hre.viem.getContractAt( + "contracts/facets/ModelRegistry.sol:ModelRegistry", + diamond.address, + ); + const providerRegistry = await hre.viem.getContractAt( + "contracts/facets/ProviderRegistry.sol:ProviderRegistry", + diamond.address, + ); + const marketplace = await hre.viem.getContractAt( + "contracts/facets/Marketplace.sol:Marketplace", + diamond.address, + ); + const sessionRouter = await hre.viem.getContractAt( + "contracts/facets/SessionRouter.sol:SessionRouter", + diamond.address, + ); + + return { + tokenMOR, + decimalsMOR, + diamond, + owner, + user, + provider, + publicClient, + modelRegistry, + providerRegistry, + marketplace, + sessionRouter, + }; +} + +export async function onlyDeployDiamond( + morAddress: string, + owner: WalletClient, +) { // 1. deploy diamont init const diamondInit = await hre.viem.deployContract("DiamondInit", [], {}); + console.log("diamond init deployed at address", diamondInit.address); // 2. deploy faucets const FacetNames = [ @@ -39,11 +89,17 @@ export async function deployDiamond() { "SessionRouter", ] as const; - const facetContracts = await Promise.all( - FacetNames.map((name) => { - return hre.viem.deployContract(name as any, [], {}); - }) - ); + const facetContracts: GetContractReturnType[] = []; + for (const name of FacetNames) { + try { + const data = await hre.viem.deployContract(name as any, [], {}); + console.log("faucet ", name, " deployed at address", data.address); + facetContracts.push(data); + } catch (e) { + console.log(`error deploying ${name}`); + throw e; + } + } // 3. deploy diamond const facetCuts = facetContracts.map((facetContract) => ({ @@ -56,77 +112,86 @@ export async function deployDiamond() { owner: owner.account.address, init: diamondInit.address, initCalldata: encodeFunctionData({ - abi: diamondInit.abi, + abi: hre.artifacts.readArtifactSync("DiamondInit").abi, functionName: "init", - args: [tokenMOR.address, owner.account.address], + args: [morAddress as any, owner.account.address], }), }; - const diamond = await hre.viem.deployContract("Diamond", [facetCuts, diamondArgs]); - const modelRegistry = await hre.viem.getContractAt( - "contracts/facets/ModelRegistry.sol:ModelRegistry", - diamond.address - ); - const providerRegistry = await hre.viem.getContractAt( - "contracts/facets/ProviderRegistry.sol:ProviderRegistry", - diamond.address - ); - const marketplace = await hre.viem.getContractAt( - "contracts/facets/Marketplace.sol:Marketplace", - diamond.address - ); - const sessionRouter = await hre.viem.getContractAt( - "contracts/facets/SessionRouter.sol:SessionRouter", - diamond.address - ); + const diamond = await hre.viem.deployContract("Diamond", [ + facetCuts, + diamondArgs, + ]); return { - tokenMOR, - decimalsMOR, diamond, + facets: facetContracts.map((f) => ({ + name: f.constructor.name, + address: f.address, + })), + constructorArgs: [facetCuts, diamondArgs], owner, - user, - provider, - publicClient, - modelRegistry, - providerRegistry, - marketplace, - sessionRouter, }; } export async function deploySingleProvider() { - const { sessionRouter, providerRegistry, owner, provider, publicClient, decimalsMOR, tokenMOR } = - await loadFixture(deployDiamond); + const { + sessionRouter, + providerRegistry, + owner, + provider, + publicClient, + decimalsMOR, + tokenMOR, + modelRegistry, + user, + marketplace, + } = await loadFixture(deployDiamond); const expectedProvider = { address: getAddress(provider.account.address), stake: parseUnits("100", decimalsMOR), - endpoint: "https://bestprovider.com", - timestamp: 0n, + endpoint: "localhost:3334", + createdAt: 0n, isDeleted: false, }; - await tokenMOR.write.transfer([provider.account.address, expectedProvider.stake * 100n], { - account: owner.account, - }); + await tokenMOR.write.transfer( + [provider.account.address, expectedProvider.stake * 100n], + { + account: owner.account, + }, + ); - await tokenMOR.write.approve([sessionRouter.address, expectedProvider.stake], { - account: provider.account, - }); + await tokenMOR.write.approve( + [sessionRouter.address, expectedProvider.stake], + { + account: provider.account, + }, + ); const addProviderHash = await providerRegistry.write.providerRegister( - [expectedProvider.address, expectedProvider.stake, expectedProvider.endpoint], - { account: provider.account } + [ + expectedProvider.address, + expectedProvider.stake, + expectedProvider.endpoint, + ], + { account: provider.account }, + ); + expectedProvider.createdAt = await getTxTimestamp( + publicClient, + addProviderHash, ); - expectedProvider.timestamp = await getTxTimestamp(publicClient, addProviderHash); return { expectedProvider, providerRegistry, + modelRegistry, sessionRouter, + marketplace, owner, provider, + user, publicClient, tokenMOR, decimalsMOR, @@ -134,9 +199,8 @@ export async function deploySingleProvider() { } export async function deploySingleModel() { - const { owner, provider, publicClient, tokenMOR, modelRegistry } = await loadFixture( - deployDiamond - ); + const { owner, provider, publicClient, tokenMOR, modelRegistry } = + await loadFixture(deployDiamond); const expectedModel = { modelId: randomBytes32(), @@ -145,7 +209,7 @@ export async function deploySingleModel() { stake: 100n, owner: owner.account.address, name: "Llama 2.0", - timestamp: 0n, + createdAt: 0n, tags: ["llama", "animal", "cute"], isDeleted: false, }; @@ -162,7 +226,7 @@ export async function deploySingleModel() { expectedModel.tags, ]); - expectedModel.timestamp = await getTxTimestamp(publicClient, addProviderHash); + expectedModel.createdAt = await getTxTimestamp(publicClient, addProviderHash); return { expectedModel, @@ -184,15 +248,8 @@ export async function deploySingleBid() { decimalsMOR, marketplace, sessionRouter, - } = await loadFixture(deployDiamond); - - const expectedProvider = { - address: getAddress(provider.account.address), - stake: parseUnits("100", decimalsMOR), - endpoint: "https://bestprovider.com", - timestamp: 0n, - isDeleted: false, - }; + expectedProvider, + } = await loadFixture(deploySingleProvider); // add single model const expectedModel = { @@ -220,35 +277,82 @@ export async function deploySingleBid() { expectedModel.timestamp = await getTxTimestamp(publicClient, addProviderHash); - await tokenMOR.write.approve([modelRegistry.address, 10000n * 10n ** 18n]); - await tokenMOR.write.transfer([user.account.address, 100000n * 10n ** 18n]); - await tokenMOR.write.approve([modelRegistry.address, 10000000n * 10n ** 18n], { - account: user.account, - }); - // expected bid const expectedBid = { id: "" as `0x${string}`, providerAddr: getAddress(expectedProvider.address), modelId: expectedModel.modelId, - pricePerSecond: 1n, + pricePerSecond: parseUnits("0.0001", decimalsMOR), nonce: 0n, createdAt: 0n, deletedAt: 0n, }; + await tokenMOR.write.approve([modelRegistry.address, 10000n * 10n ** 18n]); + // add single bid const postBidtx = await marketplace.simulate.postModelBid( [expectedBid.providerAddr, expectedBid.modelId, expectedBid.pricePerSecond], - { account: provider.account.address } + { account: provider.account.address }, ); const txHash = await provider.writeContract(postBidtx.request); expectedBid.id = postBidtx.result; expectedBid.createdAt = await getTxTimestamp(publicClient, txHash); + // generating data for sample session + const durationSeconds = BigInt(HOUR / SECOND); + const totalCost = expectedBid.pricePerSecond * durationSeconds; + const totalSupply = await tokenMOR.read.totalSupply(); + const todaysBudget = await sessionRouter.read.getTodaysBudget([await now2()]); + + const expectedSession = { + durationSeconds, + totalCost, + pricePerSecond: expectedBid.pricePerSecond, + user: getAddress(user.account.address), + provider: expectedBid.providerAddr, + modelAgentId: expectedBid.modelId, + bidID: expectedBid.id, + stake: (totalCost * totalSupply) / todaysBudget, + }; + + async function getStake( + durationSeconds: bigint, + pricePerSecond: bigint, + ): Promise { + const totalCost = pricePerSecond * durationSeconds; + const totalSupply = await tokenMOR.read.totalSupply(); + const todaysBudget = await sessionRouter.read.getTodaysBudget([ + await now2(), + ]); + return (totalCost * totalSupply) / todaysBudget; + } + + async function getDuration( + stake: bigint, + pricePerSecond: bigint, + ): Promise { + const totalSupply = await tokenMOR.read.totalSupply(); + const todaysBudget = await sessionRouter.read.getTodaysBudget([ + await now2(), + ]); + const totalCost = (stake * todaysBudget) / totalSupply; + return totalCost / pricePerSecond; + } + + async function approveUserFunds(amount: bigint) { + await tokenMOR.write.transfer([user.account.address, amount]); + await tokenMOR.write.approve([modelRegistry.address, amount], { + account: user.account, + }); + } + + await approveUserFunds(expectedSession.stake); + return { expectedBid, + expectedSession, marketplace, owner, provider, @@ -256,6 +360,9 @@ export async function deploySingleBid() { tokenMOR, decimalsMOR, sessionRouter, + getStake, + getDuration, + approveUserFunds, user, }; } @@ -264,8 +371,43 @@ export const providerReport = { ips: 128, timestamp: 10000, }; -export const reportAbi = ["uint32", "uint32"] as const; -export const encodedReport = encodePacked(reportAbi, [ - providerReport.ips, - providerReport.timestamp, -]); +export const reportAbi = [ + { type: "bytes32" }, + { type: "uint128" }, + { type: "uint32" }, +]; + +export const approvalAbi = [{ type: "bytes32" }, { type: "uint128" }]; + +export const getProviderApproval = async ( + provider: WalletClient, + bidId: `0x${string}`, +) => { + const timestampMs = (await time.latest()) * 1000; + const msg = encodeAbiParameters(approvalAbi, [bidId, BigInt(timestampMs)]); + const signature = await provider.signMessage({ + message: { raw: keccak256(msg) }, + }); + + return { + msg, + signature, + }; +}; + +export const getReport = async ( + reporter: WalletClient, + sessionId: `0x${string}`, + ips: number, +) => { + const timestampMs = (await time.latest()) * 1000; + const msg = encodeAbiParameters(reportAbi, [sessionId, timestampMs, ips]); + const sig = await reporter.signMessage({ + message: { raw: keccak256(msg) }, + }); + + return { + msg, + sig, + }; +}; diff --git a/smart-contracts/test/utils.ts b/smart-contracts/test/utils.ts index bb0ddc82..1ef3ecf5 100644 --- a/smart-contracts/test/utils.ts +++ b/smart-contracts/test/utils.ts @@ -4,6 +4,7 @@ import { BaseError, ContractFunctionRevertedError, UnknownRpcError, + parseEventLogs, } from "viem"; import { DecodeErrorResultReturnType, @@ -11,6 +12,9 @@ import { padHex, } from "viem/utils"; import crypto from "crypto"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DAY, SECOND } from "../utils/time"; +import { time } from "@nomicfoundation/hardhat-toolbox-viem/network-helpers"; export async function getTxTimestamp( client: PublicClient, @@ -24,23 +28,73 @@ export async function getTxTimestamp( return block.timestamp; } +export async function getSessionId( + publicClient: PublicClient, + hre: HardhatRuntimeEnvironment, + txHash: `0x${string}`, +): Promise<`0x${string}`> { + const receipt = await publicClient.waitForTransactionReceipt({ + hash: txHash, + }); + const artifact = await hre.artifacts.readArtifact("SessionRouter"); + const events = parseEventLogs({ + abi: artifact.abi, + logs: receipt.logs, + eventName: "SessionOpened", + }); + if (events.length === 0) { + throw new Error("SessionOpened event not found"); + } + if (events.length > 1) { + throw new Error("Multiple SessionOpened events found"); + } + return events[0].args.sessionId; +} + +/** helper function to catch errors and check if the error is the expected one + * @example + * await catchError(abi, "ErrorName", async () => { + * await contract.method(); + * }); + **/ +export async function catchError( + abi: TAbi | undefined, + error: + | DecodeErrorResultReturnType["errorName"] + | DecodeErrorResultReturnType["errorName"][], + cb: () => Promise, +) { + try { + await cb(); + throw new Error(`No error was thrown, expected error "${error}"`); + } catch (err) { + if (Array.isArray(error)) { + return expectError(err, abi, error); + } else { + return expectError(err, abi, [error]); + } + } +} + export function expectError( err: any, abi: TAbi | undefined, - error: DecodeErrorResultReturnType["errorName"], + errors: DecodeErrorResultReturnType["errorName"][], ) { - if (!catchErr(err, abi, error)) { - console.error(err); - throw new Error( - `Expected blockchain custom error "${error}" was not thrown\n\n${err}`, - { - cause: err, - }, - ); + for (const error of errors) { + if (isErr(err, abi, error)) { + return; + } } + + console.error(err); + throw new Error( + `Expected one of blockchain custom errors "${errors.join(" | ")}" was not thrown\n\n${err}`, + { cause: err }, + ); } -export function catchErr( +export function isErr( err: any, abi: TAbi | undefined, error: DecodeErrorResultReturnType["errorName"], @@ -87,6 +141,26 @@ export const randomBytes32 = (): `0x${string}` => { return getHex(crypto.randomBytes(32)); }; +export const randomBytes = (nBytes: number): `0x${string}` => { + return getHex(crypto.randomBytes(nBytes), nBytes); +}; + export const randomAddress = (): `0x${string}` => { return getHex(crypto.randomBytes(20), 20); -}; \ No newline at end of file +}; + +export const now = (): bigint => { + return BigInt(Math.floor(Date.now() / 1000)); +}; + +export const now2 = async (): Promise => { + return BigInt(await time.latest()); +}; + +export const startOfTheDay = (timestamp: bigint): bigint => { + return timestamp - (timestamp % BigInt(DAY / SECOND)); +}; + +export const NewDate = (timestamp: bigint): Date => { + return new Date(Number(timestamp) * 1000); +}; diff --git a/smart-contracts/yarn.lock b/smart-contracts/yarn.lock index 48393d45..0ff106c2 100644 --- a/smart-contracts/yarn.lock +++ b/smart-contracts/yarn.lock @@ -67,6 +67,29 @@ dependencies: tslib "^2.3.1" +"@babel/code-frame@^7.0.0": + version "7.24.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" + integrity sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ== + dependencies: + "@babel/highlight" "^7.24.2" + picocolors "^1.0.0" + +"@babel/helper-validator-identifier@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz#918b1a7fa23056603506370089bd990d8720db62" + integrity sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA== + +"@babel/highlight@^7.24.2": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.5.tgz#bc0613f98e1dd0720e99b2a9ee3760194a704b6e" + integrity sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw== + dependencies: + "@babel/helper-validator-identifier" "^7.24.5" + chalk "^2.4.2" + js-tokens "^4.0.0" + picocolors "^1.0.0" + "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -716,18 +739,18 @@ "@nomicfoundation/ethereumjs-rlp" "5.0.4" ethereum-cryptography "0.1.3" -"@nomicfoundation/hardhat-ignition-viem@^0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ignition-viem/-/hardhat-ignition-viem-0.15.0.tgz#7456bb399f12aa82c1d029608b305ba1ac713493" - integrity sha512-st6W+WTyqnHc3bs039/H5Du1+CNvLinwJ86O0yp5h4QWKTn0gfpojY7nWn9RjqSkMdpzsKVdifqzywfgXsGZlQ== +"@nomicfoundation/hardhat-ignition-viem@^0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ignition-viem/-/hardhat-ignition-viem-0.15.2.tgz#17102000def82f038db5fc6d7e8e322a5f30002d" + integrity sha512-iYmw9vJLXY1Tum0idnNsrsEmuvHsRDVJcudgzaMY6sA2nLLhJDSReK2gVZdtx3rdfJz4QRhG2+h2s3T+Rzv0TQ== -"@nomicfoundation/hardhat-ignition@^0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ignition/-/hardhat-ignition-0.15.0.tgz#f5c01f311d54b44764c2c99d4766b82f2d9d49ad" - integrity sha512-GbAe90O22uM67U/JnffXX+mBMn0HqCKSH+D98Tb5uWqR1N/M00cB3yY8OdqzVai7I6SuIKTc91mPdvtWt8R3MA== +"@nomicfoundation/hardhat-ignition@^0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ignition/-/hardhat-ignition-0.15.2.tgz#74c1ce93e7838a020b8a532ba1e5018bf250300f" + integrity sha512-tdI+D+GwP8qBt3/sq0hGKk46lAfKnNj3ZtqxrNinOnQUfc3f9qXgZDFqWT2JudsmuQcuHFbn1FQ1zoDvjUVjRA== dependencies: - "@nomicfoundation/ignition-core" "^0.15.0" - "@nomicfoundation/ignition-ui" "^0.15.0" + "@nomicfoundation/ignition-core" "^0.15.2" + "@nomicfoundation/ignition-ui" "^0.15.2" chalk "^4.0.0" debug "^4.3.2" fs-extra "^10.0.0" @@ -747,10 +770,10 @@ dependencies: chai-as-promised "^7.1.1" -"@nomicfoundation/hardhat-verify@^2.0.0": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.5.tgz#dcc2cb5e5c55a39704c7d492436f80f05a4ca5a3" - integrity sha512-Tg4zu8RkWpyADSFIgF4FlJIUEI4VkxcvELsmbJn2OokbvH2SnUrqKmw0BBfDrtvP0hhmx8wsnrRKP5DV/oTyTA== +"@nomicfoundation/hardhat-verify@^2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.6.tgz#02623c431244c92a852c524008239fc616e1c658" + integrity sha512-oKUI5fl8QC8jysE2LUBHE6rObzEmccJcc4b43Ov7LFMlCBZJE27qoqGIsg/++wX7L8Jdga+bkejPxl8NvsecpQ== dependencies: "@ethersproject/abi" "^5.1.2" "@ethersproject/address" "^5.0.2" @@ -762,20 +785,21 @@ table "^6.8.0" undici "^5.14.0" -"@nomicfoundation/hardhat-viem@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-viem/-/hardhat-viem-2.0.0.tgz#4f5de792028a5607984ea9fd1e17727a71e3cdb8" - integrity sha512-ilXQKTc1jWHqJ66fAN6TIyCRyormoChOn1yQTCGoBQ+G6QcVCu5FTaGL2r0KUOY4IkTohtphK+UXQrKcxQX5Yw== +"@nomicfoundation/hardhat-viem@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-viem/-/hardhat-viem-2.0.1.tgz#8942cd68f2d619b9ccd087b2e5d28de349535285" + integrity sha512-C7mSg2MiJekWY2xZYYOdbGmA1+hRKIHoSsh/SeY97mPO6nTha7OEeeg+seecxTekLJW1kqryjCdU8ul+L29v3w== dependencies: abitype "^0.9.8" lodash.memoize "^4.1.2" -"@nomicfoundation/ignition-core@^0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ignition-core/-/ignition-core-0.15.0.tgz#28ad7da61d4c1e50d6ead09e8c92881b59c176cf" - integrity sha512-d/h8jgJHY4xIroHqdaGeTkTqjQeuzmU759AOn1Fg88cuxVhS7JM22ZI0bQWyLNSMsVstHBIo+lSMIsvm9jBF2w== +"@nomicfoundation/ignition-core@^0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ignition-core/-/ignition-core-0.15.2.tgz#e294c2faee231f0e95875ae551a91b609aa70c47" + integrity sha512-6kchZOBh6zSl0BgG1bs6+ZbNYlGjeH22yi72mgeOa0oNOYFqCpka9a4FEYv0gfcphsMMmKTMlxadanf02ZoE4w== dependencies: "@ethersproject/address" "5.6.1" + "@nomicfoundation/solidity-analyzer" "^0.1.1" cbor "^9.0.0" debug "^4.3.2" ethers "^6.7.0" @@ -784,10 +808,10 @@ lodash "4.17.21" ndjson "2.0.0" -"@nomicfoundation/ignition-ui@^0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ignition-ui/-/ignition-ui-0.15.0.tgz#0c1bd3e0d673fe44a48a5a30b8f43f7d8395b8ff" - integrity sha512-RBvvQ0e8RcEc/LoSzNTPVKZZ5vEwlmxt7PXG278+6DqCrOqxqmh6W9PtK/4mwwvnTeBqds+8j81jDf6vJbOVBQ== +"@nomicfoundation/ignition-ui@^0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ignition-ui/-/ignition-ui-0.15.2.tgz#234d43be06b85546e6b7a9118576e981fb6b6996" + integrity sha512-NEX2prbfLEm45KbnBS0imvSgQgwLTgmT8zD3rAPmcIFZx+tLG4lKKw99k6EgEwmKwBiaO2zQMmt+FNoF7xGaiQ== "@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.1": version "0.1.1" @@ -839,7 +863,7 @@ resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.1.tgz#c9a44f7108646f083b82e851486e0f6aeb785836" integrity sha512-HrVJr6+WjIXGnw3Q9u6KQcbZCtk0caVWhCdFADySvRyUxJ8PnzlaP+MhwNE8oyT8OZ6ejHBRrrgjSqDCFXGirw== -"@nomicfoundation/solidity-analyzer@^0.1.0": +"@nomicfoundation/solidity-analyzer@^0.1.0", "@nomicfoundation/solidity-analyzer@^0.1.1": version "0.1.1" resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz#f5f4d36d3f66752f59a57e7208cd856f3ddf6f2d" integrity sha512-1LMtXj1puAxyFusBgUIy5pZk3073cNXYnXUpuNKFghHbIit/xZgbk0AokpUADbNm3gyD6bFWl3LRFh3dhVdREg== @@ -986,6 +1010,27 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@pnpm/config.env-replace@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz#ab29da53df41e8948a00f2433f085f54de8b3a4c" + integrity sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w== + +"@pnpm/network.ca-file@^1.0.1": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz#2ab05e09c1af0cdf2fcf5035bea1484e222f7983" + integrity sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA== + dependencies: + graceful-fs "4.2.10" + +"@pnpm/npm-conf@^2.1.0": + version "2.2.2" + resolved "https://registry.yarnpkg.com/@pnpm/npm-conf/-/npm-conf-2.2.2.tgz#0058baf1c26cbb63a828f0193795401684ac86f0" + integrity sha512-UA91GwWPhFExt3IizW6bOeY/pQ0BkuNwKjk9iQW9KqxluGCrg4VenZ0/L+2Y0+ZOtme72EVvg6v0zo3AMQRCeA== + dependencies: + "@pnpm/config.env-replace" "^1.1.0" + "@pnpm/network.ca-file" "^1.0.1" + config-chain "^1.1.11" + "@scure/base@~1.1.0", "@scure/base@~1.1.2", "@scure/base@~1.1.4": version "1.1.5" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.5.tgz#1d85d17269fe97694b9c592552dd9e5e33552157" @@ -1110,6 +1155,11 @@ "@sentry/types" "5.30.0" tslib "^1.9.3" +"@sindresorhus/is@^5.2.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-5.6.0.tgz#41dd6093d34652cddb5d5bdeee04eafc33826668" + integrity sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g== + "@smithy/types@^2.12.0": version "2.12.0" resolved "https://registry.yarnpkg.com/@smithy/types/-/types-2.12.0.tgz#c44845f8ba07e5e8c88eda5aed7e6a0c462da041" @@ -1149,6 +1199,13 @@ resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.18.0.tgz#8e77a02a09ecce957255a2f48c9a7178ec191908" integrity sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA== +"@szmarczak/http-timer@^5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" + integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== + dependencies: + defer-to-connect "^2.0.1" + "@tsconfig/node10@^1.0.7": version "1.0.9" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" @@ -1224,6 +1281,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/http-cache-semantics@^4.0.2": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" + integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== + "@types/lru-cache@^5.1.0": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.1.tgz#c48c2e27b65d2a153b19bfc1a317e30872e01eef" @@ -1381,6 +1443,16 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" +ajv@^6.12.6: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ajv@^8.0.1: version "8.12.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" @@ -1465,6 +1537,11 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== +antlr4@^4.13.1-patch-1: + version "4.13.1-patch-1" + resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.13.1-patch-1.tgz#946176f863f890964a050c4f18c47fd6f7e57602" + integrity sha512-OjFLWWLzDMV9rdFhpvroCWR4ooktNg9/nvVYSA5z28wuVpU36QUNuioR1XLnQtcjVlf8npjyz593PxnU/f/Cow== + antlr4ts@^0.5.0-alpha.4: version "0.5.0-alpha.4" resolved "https://registry.yarnpkg.com/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz#71702865a87478ed0b40c0709f422cf14d51652a" @@ -1559,6 +1636,11 @@ assertion-error@^1.1.0: resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== +ast-parents@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/ast-parents/-/ast-parents-0.0.1.tgz#508fd0f05d0c48775d9eccda2e174423261e8dd3" + integrity sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA== + astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -1764,6 +1846,24 @@ bytes@3.1.2: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== +cacheable-lookup@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz#3476a8215d046e5a3202a9209dd13fec1f933a27" + integrity sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w== + +cacheable-request@^10.2.8: + version "10.2.14" + resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-10.2.14.tgz#eb915b665fda41b79652782df3f553449c406b9d" + integrity sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ== + dependencies: + "@types/http-cache-semantics" "^4.0.2" + get-stream "^6.0.1" + http-cache-semantics "^4.1.1" + keyv "^4.5.3" + mimic-response "^4.0.0" + normalize-url "^8.0.0" + responselike "^3.0.0" + call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" @@ -1775,6 +1875,11 @@ call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7: get-intrinsic "^1.2.4" set-function-length "^1.2.1" +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + camelcase@^6.0.0, camelcase@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" @@ -1995,6 +2100,11 @@ commander@3.0.2: resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== +commander@^10.0.0: + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== + compare-versions@^6.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-6.1.0.tgz#3f2131e3ae93577df111dba133e6db876ffe127a" @@ -2015,6 +2125,14 @@ concat-stream@^1.6.0, concat-stream@^1.6.2: readable-stream "^2.2.2" typedarray "^0.0.6" +config-chain@^1.1.11: + version "1.1.13" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" + integrity sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ== + dependencies: + ini "^1.3.4" + proto-list "~1.2.1" + cookie@^0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" @@ -2025,6 +2143,16 @@ core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== +cosmiconfig@^8.0.0: + version "8.3.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.3.6.tgz#060a2b871d66dba6c8538ea1118ba1ac16f5fae3" + integrity sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA== + dependencies: + import-fresh "^3.3.0" + js-yaml "^4.1.0" + parse-json "^5.2.0" + path-type "^4.0.0" + create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" @@ -2122,6 +2250,13 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== +decompress-response@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" + integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== + dependencies: + mimic-response "^3.1.0" + deep-eql@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" @@ -2129,7 +2264,7 @@ deep-eql@^4.1.3: dependencies: type-detect "^4.0.0" -deep-extend@~0.6.0: +deep-extend@^0.6.0, deep-extend@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== @@ -2139,6 +2274,11 @@ deep-is@~0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== +defer-to-connect@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" + integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== + define-data-property@^1.0.1, define-data-property@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" @@ -2265,6 +2405,13 @@ erc721a@^4.2.3: resolved "https://registry.yarnpkg.com/erc721a/-/erc721a-4.3.0.tgz#d4590030f7c60deee45db1dc4e43fc4c93218353" integrity sha512-JneTLVEH5I/rJMArAwwJ26CX4HvL3ql9Q3egpQ4QB7sz7vIGZbMdMmqHLBIIKhBlfToZKewtC7OZtdr3qU6jsA== +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.2: version "1.23.3" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.3.tgz#8f0c5a35cd215312573c5a27c87dfd6c881a0aa0" @@ -2590,6 +2737,11 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + fast-glob@^3.0.3: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -2601,6 +2753,11 @@ fast-glob@^3.0.3: merge2 "^1.3.0" micromatch "^4.0.4" +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" @@ -2681,6 +2838,11 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" +form-data-encoder@^2.1.2: + version "2.1.4" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5" + integrity sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw== + form-data@^2.2.0: version "2.5.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" @@ -2818,6 +2980,11 @@ get-port@^3.1.0: resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc" integrity sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg== +get-stream@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + get-symbol-description@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.2.tgz#533744d5aa20aca4e079c8e5daf7fd44202821f5" @@ -2866,7 +3033,7 @@ glob@7.2.0: once "^1.3.0" path-is-absolute "^1.0.0" -glob@8.1.0: +glob@8.1.0, glob@^8.0.3: version "8.1.0" resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== @@ -2955,6 +3122,28 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" +got@^12.1.0: + version "12.6.1" + resolved "https://registry.yarnpkg.com/got/-/got-12.6.1.tgz#8869560d1383353204b5a9435f782df9c091f549" + integrity sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ== + dependencies: + "@sindresorhus/is" "^5.2.0" + "@szmarczak/http-timer" "^5.0.1" + cacheable-lookup "^7.0.0" + cacheable-request "^10.2.8" + decompress-response "^6.0.0" + form-data-encoder "^2.1.2" + get-stream "^6.0.1" + http2-wrapper "^2.1.10" + lowercase-keys "^3.0.0" + p-cancelable "^3.0.0" + responselike "^3.0.0" + +graceful-fs@4.2.10: + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.4: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" @@ -3239,6 +3428,11 @@ http-basic@^8.1.1: http-response-object "^3.0.1" parse-cache-control "^1.0.1" +http-cache-semantics@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" + integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== + http-errors@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" @@ -3257,6 +3451,14 @@ http-response-object@^3.0.1: dependencies: "@types/node" "^10.0.3" +http2-wrapper@^2.1.10: + version "2.2.1" + resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.1.tgz#310968153dcdedb160d8b72114363ef5fce1f64a" + integrity sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ== + dependencies: + quick-lru "^5.1.1" + resolve-alpn "^1.2.0" + https-proxy-agent@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" @@ -3277,7 +3479,7 @@ ieee754@^1.1.4: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^5.1.1: +ignore@^5.1.1, ignore@^5.2.4: version "5.3.1" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== @@ -3292,6 +3494,14 @@ immutable@^4.0.0-rc.12: resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.5.tgz#f8b436e66d59f99760dc577f5c99a4fd2a5cc5a0" integrity sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw== +import-fresh@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + imul@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/imul/-/imul-1.0.1.tgz#9d5867161e8b3de96c2c38d5dc7cb102f35e2ac9" @@ -3315,7 +3525,7 @@ inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, i resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -ini@^1.3.5: +ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: version "1.3.8" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== @@ -3349,6 +3559,11 @@ is-array-buffer@^3.0.4: call-bind "^1.0.2" get-intrinsic "^1.2.1" +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== + is-bigint@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" @@ -3560,6 +3775,11 @@ js-sha3@0.8.0, js-sha3@^0.8.0: resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + js-yaml@3.x: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" @@ -3568,13 +3788,28 @@ js-yaml@3.x: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@4.1.0: +js-yaml@4.1.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + json-schema-traverse@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" @@ -3622,6 +3857,13 @@ keccak@^3.0.0, keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" +keyv@^4.5.3: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + kind-of@^6.0.2: version "6.0.3" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" @@ -3646,6 +3888,13 @@ kleur@^3.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== +latest-version@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-7.0.0.tgz#843201591ea81a4d404932eeb61240fe04e9e5da" + integrity sha512-KvNT4XqAMzdcL6ka6Tl3i2lYeFDgXNCuIX+xNx6ZMVR1dFq+idXd9FLKNMOIx0t9mJ9/HudyX4oZWXZQ0UJHeg== + dependencies: + package-json "^8.1.0" + levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -3654,6 +3903,11 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -3709,6 +3963,11 @@ loupe@^2.3.6: dependencies: get-func-name "^2.0.1" +lowercase-keys@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" + integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== + lru-cache@^10.2.0: version "10.2.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" @@ -3792,6 +4051,16 @@ mime-types@^2.1.12: dependencies: mime-db "1.52.0" +mimic-response@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" + integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== + +mimic-response@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-4.0.0.tgz#35468b19e7c75d10f5165ea25e75a5ceea7cf70f" + integrity sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg== + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -3830,7 +4099,7 @@ minimatch@^9.0.1: dependencies: brace-expansion "^2.0.1" -minimist@^1.2.5, minimist@^1.2.6, minimist@^1.2.7: +minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6, minimist@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -3983,6 +4252,11 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +normalize-url@^8.0.0: + version "8.0.1" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-8.0.1.tgz#9b7d96af9836577c58f5883e939365fa15623a4a" + integrity sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w== + number-to-bn@1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" @@ -4053,6 +4327,11 @@ os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== +p-cancelable@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" + integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== + p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" @@ -4093,11 +4372,38 @@ p-try@^1.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww== +package-json@^8.1.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-8.1.1.tgz#3e9948e43df40d1e8e78a85485f1070bf8f03dc8" + integrity sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA== + dependencies: + got "^12.1.0" + registry-auth-token "^5.0.1" + registry-url "^6.0.0" + semver "^7.3.7" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parse-cache-control@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/parse-cache-control/-/parse-cache-control-1.0.1.tgz#8eeab3e54fa56920fe16ba38f77fa21aacc2d74e" integrity sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg== +parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + patch-package@^6.4.7: version "6.5.1" resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.5.1.tgz#3e5d00c16997e6160291fee06a521c42ac99b621" @@ -4177,6 +4483,11 @@ pbkdf2@^3.0.17: safe-buffer "^5.0.1" sha.js "^2.4.8" +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -4187,6 +4498,11 @@ pify@^4.0.1: resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== +pluralize@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" + integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== + possible-typed-array-names@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f" @@ -4206,7 +4522,7 @@ prettier-plugin-solidity@^1.3.1: semver "^7.5.4" solidity-comments-extractor "^0.0.8" -prettier@^2.3.1: +prettier@^2.3.1, prettier@^2.8.3: version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== @@ -4245,6 +4561,11 @@ proper-lockfile@^4.1.1: retry "^0.12.0" signal-exit "^3.0.2" +proto-list@~1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA== + proxy-from-env@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" @@ -4267,6 +4588,11 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== +quick-lru@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" + integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== + randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -4284,6 +4610,16 @@ raw-body@^2.4.1: iconv-lite "0.4.24" unpipe "1.0.0" +rc@1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.6.0: version "3.6.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" @@ -4342,6 +4678,20 @@ regexp.prototype.flags@^1.5.2: es-errors "^1.3.0" set-function-name "^2.0.1" +registry-auth-token@^5.0.1: + version "5.0.2" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-5.0.2.tgz#8b026cc507c8552ebbe06724136267e63302f756" + integrity sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ== + dependencies: + "@pnpm/npm-conf" "^2.1.0" + +registry-url@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-6.0.1.tgz#056d9343680f2f64400032b1e199faa692286c58" + integrity sha512-+crtS5QjFRqFCoQmvGduwYWEBng99ZvmFvF+cUJkGYF1L1BfU8C6Zp9T7f5vPAwyLkUExpvK+ANVZmGU49qi4Q== + dependencies: + rc "1.2.8" + repeat-string@^1.0.0: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" @@ -4371,11 +4721,21 @@ require-from-string@^2.0.0, require-from-string@^2.0.2: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== +resolve-alpn@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" + integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== + resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" integrity sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw== +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" @@ -4397,6 +4757,13 @@ resolve@^1.1.6: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +responselike@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/responselike/-/responselike-3.0.0.tgz#20decb6c298aff0dbee1c355ca95461d42823626" + integrity sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg== + dependencies: + lowercase-keys "^3.0.0" + retry@0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" @@ -4519,13 +4886,18 @@ semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.4, semver@^7.5.4: +semver@^7.3.4, semver@^7.3.7, semver@^7.5.2: version "7.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== dependencies: lru-cache "^6.0.0" +semver@^7.5.4: + version "7.6.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" + integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== + serialize-javascript@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" @@ -4673,6 +5045,32 @@ solc@0.7.3: semver "^5.5.0" tmp "0.0.33" +solhint@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/solhint/-/solhint-4.5.4.tgz#171cf33f46c36b8499efe60c0e425f6883a54e50" + integrity sha512-Cu1XiJXub2q1eCr9kkJ9VPv1sGcmj3V7Zb76B0CoezDOB9bu3DxKIFFH7ggCl9fWpEPD6xBmRLfZrYijkVmujQ== + dependencies: + "@solidity-parser/parser" "^0.18.0" + ajv "^6.12.6" + antlr4 "^4.13.1-patch-1" + ast-parents "^0.0.1" + chalk "^4.1.2" + commander "^10.0.0" + cosmiconfig "^8.0.0" + fast-diff "^1.2.0" + glob "^8.0.3" + ignore "^5.2.4" + js-yaml "^4.1.0" + latest-version "^7.0.0" + lodash "^4.17.21" + pluralize "^8.0.0" + semver "^7.5.2" + strip-ansi "^6.0.1" + table "^6.8.1" + text-table "^0.2.0" + optionalDependencies: + prettier "^2.8.3" + solidity-ast@^0.4.51: version "0.4.56" resolved "https://registry.yarnpkg.com/solidity-ast/-/solidity-ast-0.4.56.tgz#94fe296f12e8de1a3bed319bc06db8d05a113d7a" @@ -4860,6 +5258,11 @@ strip-json-comments@3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== + supports-color@8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" @@ -4930,6 +5333,22 @@ table@^6.8.0: string-width "^4.2.3" strip-ansi "^6.0.1" +table@^6.8.1: + version "6.8.2" + resolved "https://registry.yarnpkg.com/table/-/table-6.8.2.tgz#c5504ccf201213fa227248bdc8c5569716ac6c58" + integrity sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA== + dependencies: + ajv "^8.0.1" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + then-request@^6.0.0: version "6.0.2" resolved "https://registry.yarnpkg.com/then-request/-/then-request-6.0.2.tgz#ec18dd8b5ca43aaee5cb92f7e4c1630e950d4f0c" @@ -5134,10 +5553,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@~5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@^5.4.5: + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== typical@^4.0.0: version "4.0.0" @@ -5237,10 +5656,10 @@ viem@2.7.14: isows "1.0.3" ws "8.13.0" -viem@^2.9.21: - version "2.9.21" - resolved "https://registry.yarnpkg.com/viem/-/viem-2.9.21.tgz#a7dd3d4c827088e5336e5a6b35ec0283d2938595" - integrity sha512-8GtxPjPGpiN5cmr19zSX9mb1LX/eON3MPxxAd3QmyUFn69Rp566zlREOqE7zM35y5yX59fXwnz6O3X7e9+C9zg== +viem@^2.10.1: + version "2.10.1" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.10.1.tgz#0dffc8e4c7a03dd06de098931b3666b68a040964" + integrity sha512-sfbcFdzlMHSZI+4RpqidxOqPu6xwWtmqDBWSVml2XV+n21dgQFmVRN0nHhZoyMDSo4mTSKtWwW9sHHu9vUF2mw== dependencies: "@adraffy/ens-normalize" "1.10.0" "@noble/curves" "1.2.0" diff --git a/ui-core/package.json b/ui-core/package.json index 3b23f485..f6f33a9c 100644 --- a/ui-core/package.json +++ b/ui-core/package.json @@ -46,6 +46,7 @@ "ip": "^1.1.8", "json-stringify-safe": "^5.0.1", "lodash": "4.17.15", + "openai": "^4.38.2", "p-all": "3.0.0", "p-retry": "4.6.0", "p-timeout": "4.1.0", diff --git a/ui-core/src/index.js b/ui-core/src/index.js index 1b2de0d9..ff76a57e 100644 --- a/ui-core/src/index.js +++ b/ui-core/src/index.js @@ -12,7 +12,6 @@ const pluginCreators = [ require('./plugins/token'), require('./plugins/lumerin'), require('./plugins/proxy-router'), - require('./plugins/contracts'), require('./plugins/devices'), ] diff --git a/ui-core/src/plugins/contracts/api.js b/ui-core/src/plugins/contracts/api.js deleted file mode 100644 index 77f8dd92..00000000 --- a/ui-core/src/plugins/contracts/api.js +++ /dev/null @@ -1,464 +0,0 @@ -// const debug = require('debug')('lmr-wallet:core:contracts:api') -const logger = require('../../logger') -const { encrypt } = require('ecies-geth') -const { Implementation } = require('contracts-js') -const { remove0xPrefix, add65BytesPrefix } = require('./helpers') -const { ContractEventsListener } = require('./events-listener') -const ethereumWallet = require('ethereumjs-wallet').default - -/** - * @param {import('web3').default} web3 - * @param {string} implementationAddress - * @param {string} [walletAddress] - */ -async function _loadContractInstance( - web3, - implementationAddress, - walletAddress -) { - try { - const implementationContract = Implementation(web3, implementationAddress) - const contract = await implementationContract.methods - .getPublicVariablesV2() - .call() - const stats = await implementationContract.methods.getStats().call() - - const history = await implementationContract.methods - .getHistory('0', '100') - .call() - const buyerHistory = history - .filter((h) => { - return h[6] === walletAddress - }) - .map((h) => ({ - ...h, - id: implementationAddress, - })) - - const { _successCount: successCount, _failCount: failCount } = stats - - const { - _state: state, - _terms: { - _price: price, // cost to purchase the contract - _limit: limit, // max th provided - _speed: speed, // th/s of contract - _length: length, // duration of the contract in seconds - _version: version, - _profitTarget: profitTarget - }, - _startingBlockTimestamp: timestamp, // timestamp of the block at moment of purchase - _buyer: buyer, // wallet address of the purchasing party - _seller: seller, // wallet address of the selling party - _encryptedPoolData: encryptedPoolData, // encrypted data for pool target info, - _isDeleted: isDead, // check if contract is dead - _balance: balance, - _hasFutureTerms: hasFutureTerms, - } = contract - - let futureTerms = null - if (walletAddress && hasFutureTerms && seller === walletAddress) { - const data = await implementationContract.methods.futureTerms().call() - futureTerms = { - price: data._price, - speed: data._speed, - length: data._length, - limit: data._limit, - version: data._version, - profitTarget: data._profitTarget - } - } - - return { - data: { - id: implementationAddress, - price, - speed, - length, - buyer, - seller, - timestamp, - state, - encryptedPoolData, - limit, - isDead, - balance, - stats: { - successCount, - failCount, - }, - hasFutureTerms, - futureTerms, - history: buyerHistory, - version, - profitTarget - }, - } - } catch (err) { - logger.error(err) - logger.error( - 'Error when trying to load Contracts by address in the Implementation contract: ', - err - ) - throw err - } -} - -/** - * @param {import('web3').default} web3 - * @param {import('web3').default} web3Subscriptionable - * @param {import('contracts-js').LumerinContext} lumerin - * @param {import('contracts-js').CloneFactoryContext} cloneFactory - * @param {string[]} addresses - * @param {string} walletAddress - */ -async function getContracts( - web3, - web3Subscriptionable, - lumerin, - cloneFactory, - addresses, - walletAddress, - eventBus -) { - const chunkSize = 5 - const result = [] - for (let i = 0; i < addresses.length; i += chunkSize) { - const contracts = await Promise.all( - addresses - .slice(i, i + chunkSize) - .map((address) => - getContract( - web3, - web3Subscriptionable, - lumerin, - cloneFactory, - address, - walletAddress - ) - ) - ) - eventBus.emit('contract-updated', { - actives: contracts, - }) - result.push(...contracts) - } - return result -} - -/** - * @param {import('web3').default} web3 - * @param {import('web3').default} web3Subscriptionable - * @param {import('contracts-js').LumerinContext} lumerin - * @param {string} contractId - * @param {string} walletAddress - */ -async function getContract( - web3, - web3Subscriptionable, - lumerin, - cloneFactory, - contractId, - walletAddress -) { - const contractEventsListener = ContractEventsListener.getInstance() - const contractInfo = await _loadContractInstance( - web3, - contractId, - walletAddress - ) - - contractEventsListener.addContract( - contractInfo.data.id, - Implementation(web3Subscriptionable, contractId), - walletAddress - ) - return contractInfo.data -} - -/** - * @param {import('contracts-js').CloneFactoryContext} cloneFactory - */ -const getMarketplaceFee = (cloneFactory) => async () => { - return await cloneFactory.methods.marketplaceFee().call() -} - -/** - * @param {import('web3').default} web3 - * @param {import('contracts-js').CloneFactoryContext} cloneFactory - */ -function createContract(web3, cloneFactory) { - if (!web3) { - logger.error('Not a valid Web3 instance') - return - } - - return async function (params) { - let { - price, - limit = 0, - speed, - duration, - sellerAddress, - profit = 0, - validatorAddress = '0x0000000000000000000000000000000000000000', - privateKey, - } = params - - const isWhitelisted = await cloneFactory.methods - .checkWhitelist(sellerAddress) - .call() - if (!isWhitelisted) { - throw new Error('seller is not whitelisted') - } - - const tempWallet = ethereumWallet.fromPrivateKey( - Buffer.from(remove0xPrefix(privateKey), 'hex') - ) - const pubKey = tempWallet.getPublicKey() - - const account = web3.eth.accounts.privateKeyToAccount(privateKey) - web3.eth.accounts.wallet.create(0).add(account) - const marketplaceFee = await cloneFactory.methods.marketplaceFee().call() - - const gas = await cloneFactory.methods - .setCreateNewRentalContractV2( - price, - limit, - speed, - duration, - +profit, - validatorAddress, - pubKey.toString('hex') - ) - .estimateGas({ - from: sellerAddress, - value: marketplaceFee, - }) - - return cloneFactory.methods - .setCreateNewRentalContractV2( - price, - limit, - speed, - duration, - +profit, - validatorAddress, - pubKey.toString('hex') - ) - .send({ from: sellerAddress, gas, value: marketplaceFee }) - } -} - -/** - * @param {import('web3').default} web3 - */ -function cancelContract(web3, cloneFactory) { - if (!web3) { - logger.error('Not a valid Web3 instance') - return - } - - return async function (params) { - const { - walletAddress, - contractId, - privateKey, - closeOutType, - } = params - - const account = web3.eth.accounts.privateKeyToAccount(privateKey) - web3.eth.accounts.wallet.create(0).add(account) - - const marketplaceFee = await cloneFactory.methods.marketplaceFee().call() - - const gas = await Implementation(web3, contractId) - .methods.setContractCloseOut(closeOutType) - .estimateGas({ - from: walletAddress, - value: marketplaceFee, - }) - - return await Implementation(web3, contractId) - .methods.setContractCloseOut(closeOutType) - .send({ - from: walletAddress, - gas, - value: marketplaceFee, - }) - } -} - -/** - * @param {import('web3').default} web3 - * @param {import('contracts-js').CloneFactoryContext} cloneFactory - */ -function setContractDeleteStatus(web3, cloneFactory, onUpdate) { - if (!web3) { - logger.error('Not a valid Web3 instance') - return - } - - return async function (params) { - const { - walletAddress, - contractId, - privateKey, - deleteContract, - } = params - - const account = web3.eth.accounts.privateKeyToAccount(privateKey) - web3.eth.accounts.wallet.create(0).add(account) - - const { - data: { isDead }, - } = await _loadContractInstance(web3, contractId) - if (Boolean(isDead) === Boolean(deleteContract)) { - return true - } - - const gas = await cloneFactory.methods - .setContractDeleted(contractId, deleteContract) - .estimateGas({ - from: walletAddress, - }) - - const result = await cloneFactory.methods - .setContractDeleted(contractId, deleteContract) - .send({ - from: walletAddress, - gas, - }) - onUpdate(contractId, walletAddress).catch((err) => - logger.error(`Failed to refresh after setContractDeadStatus: ${err}`) - ) - return result - } -} - -/** - * - * @param {import('web3').default} web3 - * @param {import('contracts-js').CloneFactoryContext} cloneFactory - * @param {import('contracts-js').LumerinContext} lumerin - * @returns - */ -function purchaseContract(web3, cloneFactory, lumerin) { - return async (params) => { - const { walletId, contractId, url, privateKey, price, version } = params - const sendOptions = { from: walletId } - - //getting pubkey from contract to be purchased - const implementationContract = Implementation(web3, contractId) - - const pubKey = await implementationContract.methods.pubKey().call() - - //encrypting plaintext url parameter - const ciphertext = await encrypt( - Buffer.from(add65BytesPrefix(pubKey), 'hex'), - Buffer.from(url) - ) - - const account = web3.eth.accounts.privateKeyToAccount(privateKey) - web3.eth.accounts.wallet.create(0).add(account) - - const { - data: { isDead, price: p }, - } = await _loadContractInstance(web3, contractId) - if (isDead) { - throw new Error('Contract is deleted already') - } - - const increaseAllowanceEstimate = await lumerin.methods - .increaseAllowance(cloneFactory.options.address, price) - .estimateGas({ - from: walletId, - }) - - await lumerin.methods - .increaseAllowance(cloneFactory.options.address, price) - .send({ - from: walletId, - gas: increaseAllowanceEstimate, - }) - - const marketplaceFee = await cloneFactory.methods.marketplaceFee().call() - - const purchaseGas = await cloneFactory.methods - .setPurchaseRentalContract( - contractId, - ciphertext.toString('hex'), - version - ) - .estimateGas({ - from: sendOptions.from, - value: marketplaceFee, - }) - - const purchaseResult = await cloneFactory.methods - .setPurchaseRentalContract( - contractId, - ciphertext.toString('hex'), - version - ) - .send({ - ...sendOptions, - gas: purchaseGas, - value: marketplaceFee, - }) - - logger.debug('Finished puchase transaction', purchaseResult) - } -} - -/** - * - * @param {import('web3').default} web3 - * @param {import('contracts-js').CloneFactoryContext} cloneFactory - * @param {import('contracts-js').LumerinContext} lumerin - * @returns - */ -function editContract(web3, cloneFactory, lumerin) { - return async (params) => { - const { - walletId, - contractId, - privateKey, - price, - limit = 0, - speed, - duration, - profit = 0 - } = params - const sendOptions = { from: walletId } - - const account = web3.eth.accounts.privateKeyToAccount(privateKey) - web3.eth.accounts.wallet.create(0).add(account) - - const editGas = await cloneFactory.methods - .setUpdateContractInformationV2(contractId, price, limit, speed, duration, +profit) - .estimateGas({ - from: sendOptions.from, - }); - - const editResult = await cloneFactory.methods - .setUpdateContractInformationV2(contractId, price, limit, speed, duration, +profit) - .send({ - ...sendOptions, - gas: editGas, - }) - - logger.debug('Finished edit contract transaction', editResult) - } -} - -module.exports = { - getContracts, - getContract, - createContract, - cancelContract, - purchaseContract, - setContractDeleteStatus, - editContract, - getMarketplaceFee, -} diff --git a/ui-core/src/plugins/contracts/events-listener.js b/ui-core/src/plugins/contracts/events-listener.js deleted file mode 100644 index 52b2e457..00000000 --- a/ui-core/src/plugins/contracts/events-listener.js +++ /dev/null @@ -1,98 +0,0 @@ -//@ts-check -// const debug = require('debug')('lmr-wallet:core:contracts:event-listener') -const logger = require('../../logger'); - -class ContractEventsListener { - /** - * @param {import('contracts-js').CloneFactoryContext} cloneFactory - */ - constructor(cloneFactory) { - this.cloneFactory = cloneFactory - this.cloneFactoryListener = null - this.contracts = {} - this.walletAddress = null; - } - - /** - * @param {(contractId?: string, walletAddress?: string) => void} onUpdate - */ - setOnUpdate(onUpdate) { - this.onUpdate = onUpdate - } - - /** - * - * @param {string} id - * @param {import('contracts-js').ImplementationContext} instance - * @param {string} walletAddress - */ - addContract(id, instance, walletAddress) { - if (!this.contracts[id]) { - this.contracts[id] = instance.events.allEvents() - this.contracts[id] - .on('connected', () => { - logger.debug(`Start listen contract (${id}) events`) - }) - .on('data', async () => { - logger.debug(`Contract (${id}) updated`) - if (this.onUpdate){ - await new Promise((resolve) => setTimeout(resolve, 1000)) - this.onUpdate(id, this.walletAddress || walletAddress) - } - }) - } - } - - listenCloneFactory() { - if (!this.cloneFactoryListener) { - this.cloneFactoryListener = this.cloneFactory.events.contractCreated() - this.cloneFactoryListener - .on('connected', () => { - logger.debug('Start listen clone factory events') - }) - .on('data', async (event) => { - const contractId = event.returnValues._address - logger.debug('New contract created', contractId) - await new Promise((resolve) => setTimeout(resolve, 1000)) - this.onUpdate(contractId, this.walletAddress) - }) - } - } - - /** - * @static - * @param {import('contracts-js').CloneFactoryContext} cloneFactory - * @param {boolean} [debugEnabled=false] - * @returns {ContractEventsListener} - */ - static create(cloneFactory, debugEnabled = false) { - if (ContractEventsListener.instance) { - return ContractEventsListener.instance - } - - const instance = new ContractEventsListener(cloneFactory) - ContractEventsListener.instance = instance - instance.listenCloneFactory() - return instance - } - - /** - * @returns {ContractEventsListener} - */ - static getInstance() { - if (!ContractEventsListener.instance) { - throw new Error("ContractEventsListener instance not created") - } - return ContractEventsListener.instance - } - - /** - * @static - * @param {(contractId?: string) => void} onUpdate - */ - static setOnUpdate(onUpdate) { - ContractEventsListener.getInstance().onUpdate = onUpdate - } -} - -module.exports = { ContractEventsListener } diff --git a/ui-core/src/plugins/contracts/events.js b/ui-core/src/plugins/contracts/events.js deleted file mode 100644 index dad70e4e..00000000 --- a/ui-core/src/plugins/contracts/events.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict' - -const { utils: { hexToUtf8 } } = require('web3') -// const LumerinContracts = require('metronome-contracts') -// const LumerinContracts = require('@lumerin/contracts') - -const exportMetaParser = ({ returnValues }) => ({ - lumerin: { - export: { - blockTimestamp: returnValues.blockTimestamp, - burnSequence: returnValues.burnSequence, - currentBurnHash: returnValues.currentBurnHash, - currentTick: returnValues.currentTick, - dailyAuctionStartTime: returnValues.dailyAuctionStartTime, - dailyMintable: returnValues.dailyMintable, - destinationChain: hexToUtf8(returnValues.destinationChain), - extraData: returnValues.extraData, - fee: returnValues.fee, - genesisTime: returnValues.genesisTime, - previousBurnHash: returnValues.prevBurnHash, - supply: returnValues.supplyOnChain, - to: returnValues.destinationRecipientAddr, - value: returnValues.amountToBurn - } - } -}) - -const importRequestMetaParser = ({ returnValues }) => ({ - lumerin: { - importRequest: { - currentBurnHash: returnValues.currentBurnHash, - fee: returnValues.fee, - originChain: hexToUtf8(returnValues.originChain), - to: returnValues.destinationRecipientAddr, - value: returnValues.amountToImport - } - } -}) - -const importMetaParser = ({ returnValues }) => ({ - lumerin: { - import: { - currentBurnHash: returnValues.currentHash, - fee: returnValues.fee, - originChain: hexToUtf8(returnValues.originChain), - to: returnValues.destinationRecipientAddr, - value: returnValues.amountImported - } - } -}) - -// function getEventDataCreator (chain) { -// const { -// abi, -// address: contractAddress, -// birthblock: minBlock -// } = LumerinContracts[chain].TokenPorter - -// return [ -// address => ({ -// contractAddress, -// abi, -// eventName: 'LogExportReceipt', -// filter: { exporter: address }, -// metaParser: exportMetaParser, -// minBlock -// }), -// address => ({ -// contractAddress, -// abi, -// eventName: 'LogExportReceipt', -// filter: { destinationRecipientAddr: address }, -// metaParser: exportMetaParser, -// minBlock -// }), -// address => ({ -// contractAddress, -// abi, -// eventName: 'LogImportRequest', -// filter: { destinationRecipientAddr: address }, -// metaParser: importRequestMetaParser, -// minBlock -// }), -// address => ({ -// contractAddress, -// abi, -// eventName: 'LogImport', -// filter: { destinationRecipientAddr: address }, -// metaParser: importMetaParser, -// minBlock -// }) -// ] -// } - -module.exports = { - // getEventDataCreator, - exportMetaParser, - importMetaParser, - importRequestMetaParser -} diff --git a/ui-core/src/plugins/contracts/helpers.js b/ui-core/src/plugins/contracts/helpers.js deleted file mode 100644 index a30e43af..00000000 --- a/ui-core/src/plugins/contracts/helpers.js +++ /dev/null @@ -1,11 +0,0 @@ -//@ts-check - -const remove0xPrefix = privateKey => privateKey.replace('0x', ''); - -// https://superuser.com/a/1465498 -const add65BytesPrefix = key => `04${key}`; - -module.exports = { - remove0xPrefix, - add65BytesPrefix, -} \ No newline at end of file diff --git a/ui-core/src/plugins/contracts/index.js b/ui-core/src/plugins/contracts/index.js deleted file mode 100644 index 4e1c4f18..00000000 --- a/ui-core/src/plugins/contracts/index.js +++ /dev/null @@ -1,132 +0,0 @@ -//@ts-check -'use strict' - -// const debug = require('debug')('lmr-wallet:core:contracts') -const logger = require('../../logger'); -const { Lumerin, CloneFactory } = require('contracts-js') - -/** - * @type {typeof import('web3').default} - */ -//@ts-ignore -const Web3 = require('web3') - -const { - getContracts, - createContract, - cancelContract, - purchaseContract, - setContractDeleteStatus, - editContract, - getMarketplaceFee -} = require('./api') -const { ContractEventsListener } = require('./events-listener') - -/** - * Create a plugin instance. - * - * @returns {({ start: Function, stop: () => void})} The plugin instance. - */ -function createPlugin() { - /** - * Start the plugin instance. - * - * @param {object} options Start options. - * @returns {{ api: {[key: string]:any}, events: string[], name: string }} The instance details. - */ - function start({ config, eventBus, plugins }) { - const { lmrTokenAddress, cloneFactoryAddress } = config - const { eth } = plugins - - const web3 = eth.web3 - const web3Subscriptionable = new Web3(plugins.eth.web3SubscriptionProvider) - - const lumerin = Lumerin(web3, lmrTokenAddress) - const cloneFactory = CloneFactory(web3, cloneFactoryAddress) - const cloneFactorySubscriptionable = CloneFactory( - web3Subscriptionable, - cloneFactoryAddress - ) - - const refreshContracts = - (web3, lumerin, cloneFactory) => async (contractId, walletAddress) => { - eventBus.emit('contracts-scan-started', {}) - ContractEventsListener.getInstance().walletAddress = walletAddress; - const addresses = contractId - ? [contractId] - : await cloneFactory.methods - .getContractList() - .call() - .catch((error) => { - logger.error('cannot get list of contract addresses:', error) - throw error - }) - - return getContracts( - web3, - web3Subscriptionable, - lumerin, - cloneFactory, - addresses, - walletAddress, - eventBus, - ) - .then((contracts) => { - eventBus.emit('contracts-scan-finished', { - actives: contracts, - }) - }) - .catch(function (error) { - logger.error('Could not sync contracts/events', error) - throw error - }) - } - - const contractEventsListener = ContractEventsListener.create( - cloneFactorySubscriptionable, - config.debug - ) - - const onUpdate = refreshContracts(web3, lumerin, cloneFactory) - contractEventsListener.setOnUpdate(onUpdate) - - const refreshContractsFn = refreshContracts(web3, lumerin, cloneFactory) - const purchaseContractFn = purchaseContract(web3, cloneFactory, lumerin) - const cancelContractFn = cancelContract(web3, cloneFactory) - return { - api: { - refreshContracts: refreshContractsFn, - createContract: createContract(web3, cloneFactory), - cancelContract: cancelContractFn, - purchaseContract: purchaseContractFn, - editContract: editContract(web3, cloneFactory, lumerin), - getMarketplaceFee: getMarketplaceFee(cloneFactory), - setContractDeleteStatus: setContractDeleteStatus( - web3, - cloneFactory, - onUpdate, - ), - }, - events: [ - 'contracts-scan-started', - 'contracts-scan-finished', - 'contract-updated', - ], - name: 'contracts', - } - } - - /** - * Stop the plugin instance. - */ - function stop() { - logger.debug('Plugin stopping') - } - - return { - start, - stop, - } -} - -module.exports = createPlugin diff --git a/ui-core/src/plugins/contracts/status.js b/ui-core/src/plugins/contracts/status.js deleted file mode 100644 index 5c7c1044..00000000 --- a/ui-core/src/plugins/contracts/status.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -// const LumerinContracts = require('metronome-contracts'); -// const LumerinContracts = require('@lumerin/contracts'); - -/** - * Get the chain hop start time. - * - * @param {object} web3 A Web3.js instance. - * @param {string} chain The chain name. - * @returns {Promise<{chainHopStartTime:object}>} The start time in ms. - */ -// function getChainHopStartTime (web3, chain) { -// const { TokenPorter } = new LumerinContracts(web3, chain) - -// return TokenPorter.methods -// .chainHopStartTime() -// .call() -// .then(chainHopStartTime => ({ -// chainHopStartTime: Number.parseInt(chainHopStartTime, 10) * 1000 -// })) -// } - -// module.exports = getChainHopStartTime; diff --git a/ui-core/src/plugins/contracts/stream.js b/ui-core/src/plugins/contracts/stream.js deleted file mode 100644 index 0b14911b..00000000 --- a/ui-core/src/plugins/contracts/stream.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -// const debug = require('debug')('lmr-wallet:core:contracts-stream'); -const logger = require('../../logger'); - -/** - * Create a "classic" stream that connects to Lumerin Contracts. - * - * @param {Web3} web3 The function to poll. - * @returns {object} The stream instance. - */ -function createStream (web3) { - const subscription = web3.eth.subscribe('newBlockHeaders'); - - web3.eth.getBlock('latest') - .then(function (block) { - subscription.emit('data', block); - }) - .catch(function (err) { - subscription.emit('error', err); - }) - // const emitTickerValue = () => - // Promise.resolve() - // .then(fn) - // .then(function (data) { - // stream.emit('data', data); - // }) - // .catch(function (err) { - // stream.emit('error', err); - // }) - // .then(function () { - // if (!stop) { - // setTimeout(emitTickerValue, minInterval); - // } - // }); - - // emitTickerValue(); - - subscription.unsubscribe(function(error, success) { - success || logger.error('Could not successfully unsubscribe from web3 block-stream'); - }); - - - return subscription; -} - -module.exports = createStream; diff --git a/ui-core/src/plugins/explorer/explorer.js b/ui-core/src/plugins/explorer/explorer.js index 539e5a35..add3c607 100644 --- a/ui-core/src/plugins/explorer/explorer.js +++ b/ui-core/src/plugins/explorer/explorer.js @@ -6,49 +6,68 @@ const { createExplorerApis } = require('./api/factory'); /** * - * @param {string[]} explorerApiURLs + * @param {*} config * @param {*} web3 - * @param {*} lumerin * @param {*} eventBus * @returns */ -const createExplorer = (explorerApiURLs, web3, lumerin, eventBus) => { +const createExplorer = (config, web3, eventBus) => { + const explorerApiURLs = config.explorerApiURLs; const apis = createExplorerApis(explorerApiURLs); - return new Explorer({ apis, lumerin, web3, eventBus }) + return new Explorer({ apis, web3, eventBus, config }) } class Explorer { /** @type {import('contracts-js').LumerinContext} */ lumerin = null; - constructor({ apis, lumerin, web3, eventBus }) { + constructor({ apis, web3, eventBus, config }) { this.apis = apis - this.lumerin = lumerin this.web3 = web3 this.eventBus = eventBus + this.config = config } /** * Returns list of transactions for ETH and LMR token - * @param {string} from start block - * @param {string} to end block - * @param {string} address wallet address * @returns {Promise} */ - async getTransactions(from, to, address, page, pageSize) { - const lmrTransactions = await this.invoke('getTokenTransactions', from, to, address, this.lumerin._address, page, pageSize) - const ethTransactions = await this.invoke('getEthTransactions', from, to, address, page, pageSize) - - if (page && pageSize) { - const hasNextPage = lmrTransactions.length || ethTransactions.length; - this.eventBus.emit('transactions-next-page', { - hasNextPage: Boolean(hasNextPage), - page: page + 1, - }) + async getTransactions(page, pageSize) { + try { + const transactions = await this.getTransactionsGateway(page, pageSize); + + // OLD CALL TO BLOCKCHAIN + // const lmrTransactions = await this.invoke('getTokenTransactions', from, to, address, this.lumerin._address, page, pageSize) + // const ethTransactions = await this.invoke('getEthTransactions', from, to, address, page, pageSize) + + if (page && pageSize) { + const hasNextPage = transactions.length; + this.eventBus.emit('transactions-next-page', { + hasNextPage: Boolean(hasNextPage), + page: page + 1, + }) + } + return [...transactions] + } + catch(e) { + console.log("Error", e); + return []; } - return [...lmrTransactions, ...ethTransactions] } + async getTransactionsGateway(page = 1, size = 15) { + try { + const path = `${this.config.chain.localProxyRouterUrl}/blockchain/transactions?page=${page}&limit=${size}` + const response = await fetch(path); + const data = await response.json(); + return data?.transactions || []; + } + catch (e) { + console.log("Error", e) + return []; + } +} + /** * Returns list of transactions for LMR token * @param {string} from start block @@ -60,52 +79,6 @@ class Explorer { return await this.invoke('getEthTransactions', from, to, address) } - /** - * Create a stream that will emit an event each time a transaction for the - * specified address is indexed. - * - * The stream will emit `data` for each transaction. If the connection is lost - * or an error occurs, an `error` event will be emitted. - * - * @param {string} address The address. - * @returns {object} The event emitter. - */ - getTransactionStream = (address) => { - const stream = new EventEmitter() - - this.lumerin.events - .Transfer({ - filter: { - to: address, - }, - }) - .on('data', (data) => { - stream.emit('data', data) - }) - .on('error', (err) => { - stream.emit('error', err) - }) - - this.lumerin.events - .Transfer({ - filter: { - from: address, - }, - }) - .on('data', (data) => { - stream.emit('data', data) - }) - .on('error', (err) => { - stream.emit('error', err) - }) - - setInterval(() => { - stream.emit('resync') - }, 60000) - - return stream - } - getLatestBlock() { return this.web3.eth.getBlock('latest').then((block) => { return { diff --git a/ui-core/src/plugins/explorer/index.js b/ui-core/src/plugins/explorer/index.js index 1ee5fc36..37548d44 100644 --- a/ui-core/src/plugins/explorer/index.js +++ b/ui-core/src/plugins/explorer/index.js @@ -20,7 +20,7 @@ function createPlugin() { function start({ config, eventBus, plugins }) { // debug.enabled = config.debug; - const { lmrTokenAddress } = config; + const { mainTokenAddress } = config; const web3 = new Web3(plugins.eth.web3Provider); @@ -28,9 +28,9 @@ function createPlugin() { const eventsRegistry = createEventsRegistry(); const queue = createQueue(config, eventBus, web3); - const lumerin = Lumerin(web3Subscribable, lmrTokenAddress); + // const lumerin = Lumerin(web3Subscribable, mainTokenAddress); - const explorer = createExplorer(config.explorerApiURLs, web3, lumerin, eventBus); + const explorer = createExplorer(config, web3, eventBus); syncer = createTransactionSyncer( config, diff --git a/ui-core/src/plugins/explorer/queue.js b/ui-core/src/plugins/explorer/queue.js index 919b76d4..0cef7d35 100644 --- a/ui-core/src/plugins/explorer/queue.js +++ b/ui-core/src/plugins/explorer/queue.js @@ -10,9 +10,10 @@ const { Lumerin, CloneFactory } = require('contracts-js') function createQueue(config, eventBus, web3) { // debug.enabled = config.debug - const lumerin = Lumerin(web3, config.lmrTokenAddress) + //const lumerin = Lumerin(web3, config.mainTokenAddress) + //abiDecoder.addABI(lumerin.options.jsonInterface) + const cloneFactory = CloneFactory(web3, config.cloneFactoryAddress) - abiDecoder.addABI(lumerin.options.jsonInterface) abiDecoder.addABI(cloneFactory.options.jsonInterface) const metasCache = {} diff --git a/ui-core/src/plugins/explorer/sync-transactions.js b/ui-core/src/plugins/explorer/sync-transactions.js index f00432aa..1dee1ade 100644 --- a/ui-core/src/plugins/explorer/sync-transactions.js +++ b/ui-core/src/plugins/explorer/sync-transactions.js @@ -84,6 +84,7 @@ function createSyncer (config, eventBus, web3, queue, eventsRegistry, indexer) { gasPrice: trx.gasPrice, hash: trx.hash, nonce: trx.nonce, + isMor: Boolean(trx.contractAddress), logIndex: trx.logIndex, // emitted only in events, used to differentiate between LMR transfers within one transaction // maxFeePerGas: params.maxFeePerGas, // maxPriorityFeePerGas: params.maxPriorityFeePerGas, @@ -108,6 +109,7 @@ function createSyncer (config, eventBus, web3, queue, eventsRegistry, indexer) { cumulativeGasUsed: trx.cumulativeGasUsed, gasUsed: trx.gasUsed, tokenSymbol: trx.tokenSymbol, + isMor: Boolean(trx.contractAddress), } if (trx.returnValues){ @@ -115,7 +117,7 @@ function createSyncer (config, eventBus, web3, queue, eventsRegistry, indexer) { receipt.to = trx.returnValues.to; receipt.value = trx.returnValues.value; receipt.transactionHash = trx.transactionHash; - receipt.tokenSymbol = trx.address === config.chain.lmrTokenAddress ? 'LMR' : undefined; + receipt.tokenSymbol = trx.address === config.chain.mainTokenAddress ? 'MOR' : undefined; } return {transaction, receipt} @@ -130,7 +132,7 @@ function createSyncer (config, eventBus, web3, queue, eventsRegistry, indexer) { async function getPastCoinTransactions (fromBlock, toBlock, address, page, pageSize) { const { symbol } = config; - const transactions = await indexer.getTransactions(fromBlock, toBlock || bestBlock, address, page, pageSize) + const transactions = await indexer.getTransactions(page, pageSize) logger.debug(`${transactions.length} past ${symbol} transactions retrieved`); queue.addTxs(address, null)(transactions.map(mapApiResponseToTrxReceipt)) @@ -215,7 +217,8 @@ function createSyncer (config, eventBus, web3, queue, eventsRegistry, indexer) { gotBestBlockPromise .then(function () { logger.debug('Syncing', fromBlock, bestBlock); - subscribeCoinTransactions(bestBlock, address); + // SUBCRIPTION FOR TRANSACTIONS + // subscribeCoinTransactions(bestBlock, address); subscribeEvents(bestBlock, address); return getPastCoinTransactions(fromBlock, bestBlock, address, page, pageSize) }) diff --git a/ui-core/src/plugins/llm/ollama/index.js b/ui-core/src/plugins/llm/ollama/index.js index fe66806d..9821d5f1 100644 --- a/ui-core/src/plugins/llm/ollama/index.js +++ b/ui-core/src/plugins/llm/ollama/index.js @@ -1,45 +1,47 @@ const axios = require('axios') +const OpenAI = require('openai') +let openai let modelName = 'llama2:latest', modelUrl = '' function init(config) { - axios.defaults.baseURL = modelUrl = config.modelUrl + modelUrl = config.modelUrl modelName = config.modelName || modelName + + openai = new OpenAI({ baseUrl: modelUrl, apiKey: config.apiKey || '' }) } const chat = { //TODO: map images between ollama api and openai api async createChatCompletion(chat, message) { try { - const response = await axios.post('/v1/chat/completions', { - model: modelName, - messages: [ - ...chat, - { - role: 'user', - content: message, - }, - ], - }) - console.log("response.data: ", response.data) - return response.data.choices + return streamChatCompletions(chat, { role: 'user', content: message }) } catch (error) { console.log(error) throw error } }, } -function jsonStringToArray(jsonString) { - // Split the input string by newlines to get an array of strings, each representing a JSON object - const lines = jsonString.trim().split('\n'); - // Map over each line, parsing it as JSON, and return the resulting array of objects - const jsonArray = lines.map(line => JSON.parse(line)); - - return jsonArray; + +async function streamChatCompletions(chat, message) { + try { + const stream = await openai.beta.chat.completions.stream({ + model: modelName, + messages: [...chat, message] + }); + + const chatCompletion = await stream.finalChatCompletion() + + return chatCompletion.choices + } catch (error) { + console.log('chat completion error: ', error) + throw error + } } + module.exports = { init, chat, - modelName + modelName, } diff --git a/ui-core/src/plugins/llm/ollama/index.spec.js b/ui-core/src/plugins/llm/ollama/index.spec.js index 91fff83f..d69b5674 100644 --- a/ui-core/src/plugins/llm/ollama/index.spec.js +++ b/ui-core/src/plugins/llm/ollama/index.spec.js @@ -2,19 +2,21 @@ const sinon = require('sinon') const axios = require('axios') const ollama = require('./index') const chai = require('chai') - const { expect } = chai const modelName = 'llama2:latest' const config = { - modelUrl: 'http://localhost:8082', + modelUrl: 'http://localhost:8082/v1', + // modelUrl: "http://localhost:11434/v1", modelName: modelName, } // TODO: fix other tests so they can be run reliably describe.only('test ollama', function () { - this.timeout(15000) + this.timeout(20000) describe('api integration', () => { before('should init with config', () => { + + process.env.OPENAI_BASE_URL = config.modelUrl ollama.init(config) expect(ollama.chat.createChatCompletion).is.a('function') @@ -24,7 +26,17 @@ describe.only('test ollama', function () { const chat = [] const message = 'how are you?' const response = await ollama.chat.createChatCompletion(chat, message) + // concatenate the values of all of the content fields in all of the response elements + const contents = response.map(({ message }) => message.content) + + expect(contents.join('')).to.contain("I'm just an AI") + }) + it('should create chat completion stream', async () => { + const chat = [] + const message = 'how are you?' + const response = await ollama.chat.createChatCompletion(chat, message) + // concatenate the values of all of the content fields in all of the response elements const contents = response.map(({ message }) => message.content) @@ -80,4 +92,4 @@ describe.only('test ollama', function () { expect(response[0].message.content).to.contain("I'm just an AI") }) }) -}) +}) \ No newline at end of file diff --git a/ui-core/src/plugins/lumerin/index.js b/ui-core/src/plugins/lumerin/index.js index 47b94d47..b0af5643 100644 --- a/ui-core/src/plugins/lumerin/index.js +++ b/ui-core/src/plugins/lumerin/index.js @@ -24,17 +24,17 @@ function createPlugin () { function start ({ config, eventBus, plugins }) { // debug.enabled = config.debug; - const { lmrTokenAddress } = config; + const { mainTokenAddress } = config; const { eth, explorer, token } = plugins; const web3 = new Web3(eth.web3Provider); - const lumerin = Lumerin(web3, lmrTokenAddress) + // const lumerin = Lumerin(web3, mainTokenAddress) // Register LMR token - token.registerToken(lumerin.address, { - decimals: 8, - name: 'Lumerin', - symbol: 'LMR' + token.registerToken(mainTokenAddress, { + decimals: 18, + name: 'Morpheus', + symbol: 'MOR' }); // eventBus.on('coin-block', emitLumerinStatus); @@ -54,13 +54,13 @@ function createPlugin () { // Build and return API return { api: { - sendLmr: sendLmr( - web3, - lumerin, - explorer.logTransaction, - metaParsers - ), - estimateGasTransfer: estimateGasTransfer(lumerin), + // sendLmr: sendLmr( + // web3, + // lumerin, + // explorer.logTransaction, + // metaParsers + // ), + // estimateGasTransfer: estimateGasTransfer(lumerin), }, events: [ 'wallet-error' diff --git a/ui-core/src/plugins/token/index.js b/ui-core/src/plugins/token/index.js index a98d668c..154ec190 100644 --- a/ui-core/src/plugins/token/index.js +++ b/ui-core/src/plugins/token/index.js @@ -11,42 +11,43 @@ function createPlugin () { function start ({ config, eventBus, plugins }) { // debug.enabled = config.debug; - const { lmrTokenAddress, faucetAddress, faucetUrl } = config; + const { mainTokenAddress, faucetAddress, faucetUrl } = config; const web3 = new Web3(plugins.eth.web3Provider); - const lumerin = Lumerin(web3, lmrTokenAddress) + // const lumerin = Lumerin(web3, mainTokenAddress) - function emitLmrBalance (walletAddress) { - getTokenBalance(lumerin, walletAddress) - .then(function (balance) { - eventBus.emit('token-balance-changed', { - lmrBalance: balance, - }); - }) - .catch(function (err) { - eventBus.emit('wallet-error', { - inner: err, - message: `Could not get LMR token balance`, - meta: { plugin: 'token' } - }); - }); - } + // HERE GET LMR BALANCE + // function emitLmrBalance (walletAddress) { + // getTokenBalance(lumerin, walletAddress) + // .then(function (balance) { + // eventBus.emit('token-balance-changed', { + // lmrBalance: balance, + // }); + // }) + // .catch(function (err) { + // eventBus.emit('wallet-error', { + // inner: err, + // message: `Could not get LMR token balance`, + // meta: { plugin: 'token' } + // }); + // }); + // } - eventBus.on('open-wallet', function ({ address }) { - walletAddress = address; - emitLmrBalance(address); - }); + // eventBus.on('open-wallet', function ({ address }) { + // walletAddress = address; + // emitLmrBalance(address); + // }); - eventBus.on('lmr-tx', function () { - if (walletAddress) { - emitLmrBalance(walletAddress); - } - }); + // eventBus.on('lmr-tx', function () { + // if (walletAddress) { + // emitLmrBalance(walletAddress); + // } + // }); return { api: { - getTokenGasLimit: getTokenGasLimit(lumerin), + // getTokenGasLimit: getTokenGasLimit(lumerin), registerToken: registerToken(plugins), metaParsers: { approval: events.approvalMetaParser, diff --git a/ui-core/yarn.lock b/ui-core/yarn.lock index 1c6fdfa2..e39b6612 100644 --- a/ui-core/yarn.lock +++ b/ui-core/yarn.lock @@ -823,6 +823,14 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== +"@types/node-fetch@^2.6.4": + version "2.6.11" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.11.tgz#9b39b78665dae0e82a08f02f4967d62c66f95d24" + integrity sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + "@types/node@*": version "20.12.3" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.3.tgz#d6658c2c7776c1cad93534bb45428195ed840c65" @@ -835,6 +843,13 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== +"@types/node@^18.11.18": + version "18.19.31" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.31.tgz#b7d4a00f7cb826b60a543cebdbda5d189aaecdcd" + integrity sha512-ArgCD39YpyyrtFKIqMDvjz79jto5fcI/SVUs2HwB+f0dAzq68yqOdyaSivLiLugSziTpNXLQrVb7RZFmdZzbhA== + dependencies: + undici-types "~5.26.4" + "@types/pbkdf2@^3.0.0": version "3.1.2" resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.2.tgz#2dc43808e9985a2c69ff02e2d2027bd4fe33e8dc" @@ -874,6 +889,13 @@ abi-decoder@^2.4.0: web3-eth-abi "^1.2.1" web3-utils "^1.2.1" +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + abortcontroller-polyfill@^1.7.5: version "1.7.5" resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed" @@ -926,6 +948,13 @@ after@0.8.2: resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" integrity sha512-QbJ0NTQ/I9DI3uSJA4cbexiwQeRAfjPScqIbSjUDd9TOrcg6pTkdgziesOqxBMBzit8vFCTwrP27t13vFOORRA== +agentkeepalive@^4.2.1: + version "4.5.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" + integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== + dependencies: + humanize-ms "^1.2.1" + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -1843,7 +1872,7 @@ colors@^1.4.0: resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== -combined-stream@^1.0.6, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -3183,6 +3212,11 @@ event-emitter@^0.3.5: d "1" es5-ext "~0.10.14" +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + eventemitter3@4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384" @@ -3480,6 +3514,20 @@ form-data-encoder@1.7.1: resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== +form-data-encoder@1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040" + integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A== + +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -3489,6 +3537,14 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" +formdata-node@^4.3.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.4.1.tgz#23f6a5cb9cb55315912cbec4ff7b0f59bbd191e2" + integrity sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ== + dependencies: + node-domexception "1.0.0" + web-streams-polyfill "4.0.0-beta.3" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -4058,6 +4114,13 @@ http2-wrapper@^2.1.10: quick-lru "^5.1.1" resolve-alpn "^1.2.0" +humanize-ms@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== + dependencies: + ms "^2.0.0" + husky@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e" @@ -5108,7 +5171,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.1.1: +ms@2.1.3, ms@^2.0.0, ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -5214,6 +5277,11 @@ node-addon-api@^5.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== +node-domexception@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + node-emoji@^1.0.3: version "1.11.0" resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c" @@ -5221,7 +5289,7 @@ node-emoji@^1.0.3: dependencies: lodash "^4.17.21" -node-fetch@^2.6.12: +node-fetch@^2.6.12, node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -5465,6 +5533,20 @@ onetime@^1.0.0: resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" integrity sha512-GZ+g4jayMqzCRMgB2sol7GiCLjKfS1PINkjmx8spcKce1LiVqcbQreXwqs2YAFXC6R03VIG28ZS31t8M866v6A== +openai@^4.38.2: + version "4.38.2" + resolved "https://registry.yarnpkg.com/openai/-/openai-4.38.2.tgz#4c5335260b819a0f89fd8f922fac6aa942f540e7" + integrity sha512-M16ehj0D84Gjq5cjvBzXRb5X+UvtWlxPDRAWAWMC0EN+6nHqnULIn5fWWeiexDPup25FeSZYv/ldp8KefcZVJQ== + dependencies: + "@types/node" "^18.11.18" + "@types/node-fetch" "^2.6.4" + abort-controller "^3.0.0" + agentkeepalive "^4.2.1" + form-data-encoder "1.7.2" + formdata-node "^4.3.2" + node-fetch "^2.6.7" + web-streams-polyfill "^3.2.1" + optionator@^0.9.1: version "0.9.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" @@ -7368,6 +7450,16 @@ walkdir@^0.3.2: resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.3.2.tgz#ac8437a288c295656848ebc19981ebc677a5f590" integrity sha512-0Twghia4Z5wDGDYWURlhZmI47GvERMCsXIu0QZWVVZyW9ZjpbbZvD9Zy9M6cWiQQRRbAcYajIyKNavaZZDt1Uw== +web-streams-polyfill@4.0.0-beta.3: + version "4.0.0-beta.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz#2898486b74f5156095e473efe989dcf185047a38" + integrity sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug== + +web-streams-polyfill@^3.2.1: + version "3.3.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" + integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== + web3-bzz@1.10.4: version "1.10.4" resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.10.4.tgz#dcc787970767d9004c73d11d0eeef774ce16b880" diff --git a/ui-desktop/.env b/ui-desktop/.env index cf2d697e..0de59d07 100644 --- a/ui-desktop/.env +++ b/ui-desktop/.env @@ -1,12 +1,18 @@ DISPLAY_NAME=Sepolia Arbitrum CHAIN_ID=421614 -SYMBOL_LMR=saLMR +SYMBOL_LMR=saMOR SYMBOL_ETH=saETH EXPLORER_URL=https://sepolia.arbiscan.io/tx/{{hash}} EXPLORER_API_URLS=["https://api-sepolia.arbiscan.io/api"] + + ETH_NODE_ADDRESS=wss://arb-sepolia.g.alchemy.com/v2/yigo5wrDsGyTjHq1fMeeLlH36FCYuyAr ETH_NODE_ADDRESS_HTTP=["https://arbitrum-sepolia.blockpi.network/v1/rpc/public","https://sepolia-rollup.arbitrum.io/rpc","https://arbitrum-sepolia.publicnode.com"] + +#ETH_NODE_ADDRESS_HTTP=["http://127.0.0.1:8545"] +#ETH_NODE_ADDRESS=ws://127.0.0.1:8545 + IP_LOOKUP_URL=https://ifconfig.io/ip COIN_DEFAULT_GAS_LIMIT=999999 @@ -14,20 +20,24 @@ LMR_DEFAULT_GAS_LIMIT=999999 DEFAULT_GAS_PRICE=1000000000 MAX_GAS_PRICE=20000000000000000 -SENTRY_DSN= -TRACKING_ID= -RECAPTCHA_SITE_KEY= -FAUCET_URL=https://faucet.dev.lumerin.io/ SHOW_FAUCET=false -LUMERIN_TOKEN_ADDRESS=0xC27DafaD85F199FD50dD3FD720654875D6815871 + +TOKEN_ADDRESS=0xc1664f994fd3991f98ae944bc16b9aed673ef5fd + CLONE_FACTORY_ADDRESS=0x15437978300786aDe37f61e02Be1C061e51353D3 TITAN_LIGHTNING_POOL=pplp.titan.io:4141 DEFAULT_SELLER_CURRENCY=BTC +#DIAMOND_ADDRESS=0x8a791620dd6260079bf849dc5567adc3f2fdc318 + +DIAMOND_ADDRESS=0x70768f0ff919e194e11abfc3a2edf43213359dc1 + # 15 minutes AUTO_ADJUST_PRICE_INTERVAL=900000 # 24 hours AUTO_ADJUST_CONTRACT_PRICE_TIMEOUT=86400000 -BYPASS_AUTH=true \ No newline at end of file +BYPASS_AUTH=true + +PROXY_WEB_DEFAULT_PORT=8082 \ No newline at end of file diff --git a/ui-desktop/electron.vite.config.ts b/ui-desktop/electron.vite.config.ts index dcae5f5d..eec889b6 100644 --- a/ui-desktop/electron.vite.config.ts +++ b/ui-desktop/electron.vite.config.ts @@ -10,6 +10,7 @@ const envsToInject = [ 'BYPASS_AUTH', 'CHAIN_ID', 'CLONE_FACTORY_ADDRESS', + 'DIAMOND_ADDRESS', 'COIN_DEFAULT_GAS_LIMIT', 'DEFAULT_GAS_PRICE', 'DEFAULT_SELLER_CURRENCY', diff --git a/ui-desktop/package.json b/ui-desktop/package.json index f9b94403..74446a81 100644 --- a/ui-desktop/package.json +++ b/ui-desktop/package.json @@ -16,9 +16,9 @@ "build": "npm run typecheck && electron-vite build", "postinstall": "patch-package && electron-builder install-app-deps", "build:unpack": "npm run build && electron-builder --dir", - "build:win": "npm run build && electron-builder --win", + "build:win": "electron-vite build && electron-builder --win portable", "build:mac": "electron-vite build && electron-builder --mac", - "build:linux": "electron-vite build && electron-builder --linux" + "build:linux": "electron-vite build && electron-builder --linux AppImage" }, "dependencies": { "@electron-toolkit/preload": "^3.0.0", @@ -28,6 +28,7 @@ "@reach/menu-button": "^0.18.0", "@tabler/icons-react": "^3.1.0", "bip39": "^3.1.0", + "bootstrap": "^5.3.3", "chalk": "^5.3.0", "credential-plus": "^2.0.7", "credential-plus-pbkdf2": "^2.0.4", @@ -47,6 +48,7 @@ "nedb": "^1.8.0", "qrcode.react": "^3.1.0", "raven-js": "^3.27.2", + "react-bootstrap": "^2.10.2", "react-hint": "^3.2.1", "react-hook-form": "^7.51.0", "react-modal": "^3.16.1", diff --git a/ui-desktop/public/analytics.js b/ui-desktop/public/analytics.js deleted file mode 100644 index fd97656b..00000000 --- a/ui-desktop/public/analytics.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const { app } = require('electron') -const ua = require('universal-analytics') -const { noop } = require('lodash') -const settings = require('electron-settings') -const isDev = import('electron-is-dev') - -let visitor -const analytics = {} - -analytics.screenview = function (...args) { - if (!visitor) return - visitor.screenview(...args).send() -} - -analytics.event = function (...args) { - if (!visitor) return - visitor.event(...args).send() -} - -analytics.init = function (userAgent) { - visitor = ua(settings.getSync('app.trackingId')) - visitor.set('ds', 'app') - visitor.set('an', app.getName()) - visitor.set('av', app.getVersion()) - visitor.set('ua', userAgent) - analytics.event('App', 'App initiated') -} - -const analyticsDev = { - init: noop, - event: noop, - screenview: noop -} - -module.exports = isDev ? analyticsDev : analytics diff --git a/ui-desktop/public/config/index.js b/ui-desktop/public/config/index.js deleted file mode 100644 index 1196cd79..00000000 --- a/ui-desktop/public/config/index.js +++ /dev/null @@ -1,75 +0,0 @@ -const { parseJSONArray } = require('./utils') - -let httpApiUrls, explorerApiURLs - -try { - httpApiUrls = parseJSONArray(process.env.ETH_NODE_ADDRESS_HTTP) -} catch (err) { - throw new Error(`Invalid ETH_NODE_ADDRESS_HTTP: ${err?.message}`); -} - -try { - explorerApiURLs = parseJSONArray(process.env.EXPLORER_API_URLS) -} catch (err) { - throw new Error(`Invalid EXPLORER_API_URLS: ${err?.message}`); -} - - -const chain = { - displayName: process.env.DISPLAY_NAME, - chainId: process.env.CHAIN_ID, - symbol: process.env.SYMBOL_LMR || 'LMR', - symbolEth: process.env.SYMBOL_ETH || 'ETH', - - lmrTokenAddress: process.env.LUMERIN_TOKEN_ADDRESS, - cloneFactoryAddress: process.env.CLONE_FACTORY_ADDRESS, - - proxyRouterUrl: process.env.PROXY_ROUTER_URL, - explorerUrl: process.env.EXPLORER_URL, - explorerApiURLs: explorerApiURLs, - - wsApiUrl: process.env.ETH_NODE_ADDRESS, - httpApiUrls: httpApiUrls, - ipLookupUrl: process.env.IP_LOOKUP_URL, - - coinDefaultGasLimit: process.env.COIN_DEFAULT_GAS_LIMIT, - lmrDefaultGasLimit: process.env.LMR_DEFAULT_GAS_LIMIT, - defaultGasPrice: process.env.DEFAULT_GAS_PRICE, - maxGasPrice: process.env.MAX_GAS_PRICE, - - proxyPort: process.env.PROXY_DEFAULT_PORT || 3333, - proxyWebPort: process.env.PROXY_WEB_DEFAULT_PORT || 8081, - - portCheckerUrl: process.env.PORT_CHECKER_URL || 'https://portchecker.io/api/v1/query', - portCheckErrorLink: process.env.PORT_CHECK_ERROR_LINK || 'https://gitbook.lumerin.io/lumerin-hashpower-marketplace/buyer/2.-network-changes-for-receiving-hashrate', - - localProxyRouterUrl: `http://localhost:${process.env - .PROXY_WEB_DEFAULT_PORT || 8081}`, - - faucetUrl: process.env.FAUCET_URL, - showFaucet: process.env.SHOW_FAUCET === "true", - - titanLightningPool: process.env.TITAN_LIGHTNING_POOL, - titanLightningDashboard: process.env.TITAN_LIGHTNING_DASHBOARD || "https://lightning.titan.io", - defaultSellerCurrency: process.env.DEFAULT_SELLER_CURRENCY || 'BTC', - - bypassAuth: process.env.BYPASS_AUTH === "true", - sellerWhitelistUrl: process.env.SELLER_WHITELIST_URL || 'https://forms.gle/wEcAgppfK2p9YZ3g7' -}; - -module.exports = { - chain, - dbAutocompactionInterval: 30000, - debug: process.env.DEBUG === "true" && process.env.IGNORE_DEBUG_LOGS !== "true", - devTools: process.env.DEV_TOOLS === "true", - explorerDebounce: 2000, - ratesUpdateMs: 30000, - scanTransactionTimeout: 240000, - sentryDsn: process.env.SENTRY_DSN, - statePersistanceDebounce: 2000, - trackingId: process.env.TRACKING_ID, - web3Timeout: 120000, - autoAdjustPriceInterval: +process.env.AUTO_ADJUST_PRICE_INTERVAL || 15 * 60 * 1000, - autoAdjustContractPriceTimeout: +process.env.AUTO_ADJUST_CONTRACT_PRICE_TIMEOUT || 24 * 60 * 60 * 1000, - recaptchaSiteKey: process.env.RECAPTCHA_SITE_KEY, -}; diff --git a/ui-desktop/public/config/utils.js b/ui-desktop/public/config/utils.js deleted file mode 100644 index 6a2cc091..00000000 --- a/ui-desktop/public/config/utils.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Converts a stringified JSON array to a JS array - * @param {string} str - * @returns {string[]} - */ -function parseJSONArray(str) { - let parsed; - try { - parsed = JSON.parse(str); - if (!Array.isArray(parsed)) { - throw null - } - } catch (err) { - throw new Error('not a valid JSON array'); - } - return parsed; -} - -module.exports = { - parseJSONArray, -}; \ No newline at end of file diff --git a/ui-desktop/public/contextMenu.js b/ui-desktop/public/contextMenu.js deleted file mode 100644 index 22f62d6d..00000000 --- a/ui-desktop/public/contextMenu.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -const electronContextMenu = require('electron-context-menu'); - -// TODO pass i18n labels for context menu items -// @see https://github.com/sindresorhus/electron-context-menu#api -const config = {}; - -module.exports = function () { - electronContextMenu(config); -} diff --git a/ui-desktop/public/electron.js b/ui-desktop/public/electron.js deleted file mode 100644 index 186c2aea..00000000 --- a/ui-desktop/public/electron.js +++ /dev/null @@ -1,68 +0,0 @@ -const { app } = require('electron') -const remote = require('@electron/remote/main') -remote.initialize() -const path = require('path') - -require('dotenv').config({ path: path.resolve(__dirname, '../.env') }) - -const isDev = import('electron-is-dev') -const os = require('os') -const Raven = require('raven') - -const { createWindow } = require('./main/main-window.js') -const { createClient } = require('./main/client') -const config = require('./config') -const initContextMenu = require('./contextMenu') -const initMenu = require('./menu') -const errorHandler = require('./errorHandler') -const logger = require('./logger') -errorHandler({ logger: logger.error }) - -if (isDev) { - // Development - app.on('ready', function () { - require('electron-debug')({ isEnabled: true }) - - const { - default: installExtension, - REACT_DEVELOPER_TOOLS, - REDUX_DEVTOOLS - } = require('electron-devtools-installer') - - installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS]) - .then((extName) => logger.debug(`Added Extension: ${extName}`)) - .catch((err) => logger.debug('An error occurred: ', err)) - }) -} else { - // Production - if (config.sentryDsn) { - Raven.config(config.sentryDsn, { - captureUnhandledRejections: true, - release: app.getVersion(), - tags: { - process: process.type, - electron: process.versions.electron, - chrome: process.versions.chrome, - platform: os.platform(), - platform_release: os.release() - } - }).install() - } -} - -app.on('window-all-closed', function () { - if (process.platform !== 'darwin') { - app.quit() - } -}) - -createWindow(config) - -app.on('ready', function () { - logger.info('App ready, initializing...') - - initMenu() - initContextMenu() - - createClient(config) -}) diff --git a/ui-desktop/public/errorHandler.js b/ui-desktop/public/errorHandler.js deleted file mode 100644 index cfb0a6b8..00000000 --- a/ui-desktop/public/errorHandler.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; -const electron = require('electron'); -const debounce = require('lodash.debounce'); - -const dialog = electron.dialog || electron.remote.dialog; - -let installed = false; - -let options = { - logger: console.error, -}; - -const handleError = (error) => { - try { - options.logger("handle error: ", error?.message, error?.stack, error); - } catch (loggerError) { // eslint-disable-line unicorn/catch-error-name - dialog.showErrorBox('The `logger` option function in electron-unhandled threw an error', loggerError.stack); - return; - } -}; - -module.exports = inputOptions => { - if (installed) { - return; - } - - installed = true; - - options = { - ...options, - ...inputOptions - }; - - if (process.type === 'renderer') { - const errorHandler = debounce(error => { - handleError(error); - }, 200); - window.addEventListener('error', event => { - event.preventDefault(); - errorHandler(event.error || event); - }); - - const rejectionHandler = debounce(reason => { - handleError(reason); - }, 200); - window.addEventListener('unhandledrejection', event => { - event.preventDefault(); - rejectionHandler(event.reason); - }); - } else { - process.on('uncaughtException', error => { - handleError(error); - }); - - process.on('unhandledRejection', error => { - handleError(error); - }); - } -}; \ No newline at end of file diff --git a/ui-desktop/public/main/client/WalletError.js b/ui-desktop/public/main/client/WalletError.js deleted file mode 100644 index 6a4d902d..00000000 --- a/ui-desktop/public/main/client/WalletError.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -function WalletError (message, data) { - this.name = 'WalletError'; - this.message = message || 'Unknown error'; - - if (data) { - this.data = data; - } - if (data && data instanceof Error) { - this.stack = data.stack; - this.inner = data.message; - } -} - -module.exports = WalletError; diff --git a/ui-desktop/public/main/client/auth.js b/ui-desktop/public/main/client/auth.js deleted file mode 100644 index c2370e67..00000000 --- a/ui-desktop/public/main/client/auth.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -const { setSessionPassword, getSessionPassword } = require('./secure.js'); -const logger = require('../../logger.js'); -const { - getPasswordHash, - setPasswordHash -} = require('./settings'); -const { - pbkdf2: { hash, verify }, - sha256 -} = require('./crypto'); - -async function setPassword(password) { - await setSessionPassword(password); - - const passwordHash = getPasswordHash(); - if (!passwordHash) { - logger.info('No password set, using current as default'); - } - await hash(password).then(setPasswordHash); -} - -function isValidPassword(password) { - const passwordHash = getPasswordHash(); - - return verify(passwordHash, password) - .then(async function(isValid) { - if (isValid) { - await setSessionPassword(password); - logger.verbose('Supplied password is valid'); - } else { - logger.warn('Supplied password is invalid'); - } - return isValid; - }) - .catch(function(err) { - logger.warn('Could not verify password', err); - - - return false; - }); -} - -async function getHashedPassword() { - const hashString = await getPasswordHash(); - - const hash = JSON.parse(hashString, (key, val) => - key == 'hash' ? JSON.parse(val) : val - ); - - return hash.hash.secret; -} - -module.exports = { - isValidPassword, - setPassword, - setSessionPassword, - getSessionPassword, - getHashedPassword -}; diff --git a/ui-desktop/public/main/client/contractsHashrateSyncer.js b/ui-desktop/public/main/client/contractsHashrateSyncer.js deleted file mode 100644 index 643f0261..00000000 --- a/ui-desktop/public/main/client/contractsHashrateSyncer.js +++ /dev/null @@ -1,41 +0,0 @@ - -const { create: createAxios } = require('axios') -const { getDb } = require('./database'); -const logger = require("../../logger"); - -const startMonitoringHashrate = (url, period) => { - const interval = setInterval(async () => { - try { - const items = (await createAxios({ baseURL: url })('/contracts')).data; - persistData(items) - } - catch(e) { - logger.debug(e.message, 'Failed to poll hashrate'); - persistData(); - } - }, period) - return interval; -} - -const persistData = (data) => { - - const db = getDb(); - const collection = db.collection('hashrate'); - - if(!data) { - return; - } - - data.forEach((item) => { - const id = item.ID; - const currentHashrate = item.ResourceEstimatesActual['ema--5m']; - collection.insert( - { - id, - hashrate: currentHashrate, - timestamp: new Date().getTime() - }); - }) -} - -module.exports = { startMonitoringHashrate }; \ No newline at end of file diff --git a/ui-desktop/public/main/client/crypto/aes256cbc.js b/ui-desktop/public/main/client/crypto/aes256cbc.js deleted file mode 100644 index 7ad8714e..00000000 --- a/ui-desktop/public/main/client/crypto/aes256cbc.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -const crypto = require('crypto'); - -function decrypt (password, data) { - // eslint-disable-next-line node/no-deprecated-api - const decipher = crypto.createDecipher('aes-256-cbc', password); - - let decrypted = decipher.update(data, 'hex', 'utf-8'); - decrypted += decipher.final('utf-8'); - return decrypted; -} - -module.exports = { decrypt }; diff --git a/ui-desktop/public/main/client/crypto/aes256cbcIv.js b/ui-desktop/public/main/client/crypto/aes256cbcIv.js deleted file mode 100644 index 340c2752..00000000 --- a/ui-desktop/public/main/client/crypto/aes256cbcIv.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const crypto = require('crypto'); - -const sha256 = require('./sha256'); - -function encrypt (key, text) { - const iv = crypto.randomBytes(16).toString('hex'); // 128 bits - - const cipher = crypto.createCipheriv( - 'aes-256-cbc', - Buffer.from(sha256.hash(key), 'hex'), // 256 bits - Buffer.from(iv, 'hex') - ); - - return iv + cipher.update(text, 'utf-8', 'hex') + cipher.final('hex'); -} - -function decrypt (key, text) { - const iv = text.substr(0, 32); - const encrypted = text.substr(32); - - const decipher = crypto.createDecipheriv( - 'aes-256-cbc', - Buffer.from(sha256.hash(key), 'hex'), // 256 bits - Buffer.from(iv, 'hex') - ); - - return decipher.update(encrypted, 'hex', 'utf-8') + decipher.final('utf-8'); -} - -module.exports = { decrypt, encrypt }; diff --git a/ui-desktop/public/main/client/crypto/index.js b/ui-desktop/public/main/client/crypto/index.js deleted file mode 100644 index a4353358..00000000 --- a/ui-desktop/public/main/client/crypto/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -const aes256cbcIv = require('./aes256cbcIv'); -const aes256cbc = require('./aes256cbc'); -const pbkdf2 = require('./pbkdf2'); -const sha256 = require('./sha256'); - -module.exports = { - aes256cbcIv, - aes256cbc, - pbkdf2, - sha256 -}; diff --git a/ui-desktop/public/main/client/crypto/pbkdf2.js b/ui-desktop/public/main/client/crypto/pbkdf2.js deleted file mode 100644 index 340e3aff..00000000 --- a/ui-desktop/public/main/client/crypto/pbkdf2.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -const credential = require('credential-plus'); -const pbkdf2 = require('credential-plus-pbkdf2'); - -credential.install(pbkdf2); - -const config = { - digest: 'sha512', - func: 'pbkdf2', - iterations: 19997, - keylen: 128 -}; - -const hash = password => credential.hash(password, config); - -// eslint-disable-next-line no-shadow -const verify = (hash, password) => credential.verify(hash, password); - -module.exports = { hash, verify }; diff --git a/ui-desktop/public/main/client/crypto/sha256.js b/ui-desktop/public/main/client/crypto/sha256.js deleted file mode 100644 index f1119b3e..00000000 --- a/ui-desktop/public/main/client/crypto/sha256.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -const crypto = require('crypto'); - -const hash = data => - crypto - .createHash('sha256') - .update(data) - .digest('hex'); - -module.exports = { hash }; diff --git a/ui-desktop/public/main/client/database.js b/ui-desktop/public/main/client/database.js deleted file mode 100644 index 0967add5..00000000 --- a/ui-desktop/public/main/client/database.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; - -const { app } = require('electron'); -const { promisify } = require('util'); -const { sum, upperFirst } = require('lodash'); -const Datastore = require('nedb'); -const path = require('path'); - -const logger = require('../../logger'); -const config = require('../../config'); - -const promisifyMethods = methods => - function (obj) { - methods.forEach(function (method) { - obj[`${method}Async`] = promisify(obj[method].bind(obj)) - }); - return obj; - } - -const promisifyCollection = promisifyMethods([ - 'find', - 'insert', - 'findOne', - 'remove', - 'update' -]); - -const collections = {}; - -function addCollection (name) { - logger.verbose(`Creating database collection ${name}`); - - const newCollection = promisifyCollection( - new Datastore({ - filename: path.join( - app.getPath('userData'), - `Database/${upperFirst(name)}` - ), - autoload: true - }) - ); - - collections[name] = newCollection; - - if (config.dbAutocompactionInterval) { - newCollection.persistence.setAutocompactionInterval(config.dbAutocompactionInterval); - } - - return newCollection; -} - -function collection (name) { - return collections[name] || addCollection(name); -} - -function dropDatabase () { - logger.verbose('Dropping database'); - - return Promise.all( - Object.keys(collections).map(name => - collections[name].removeAsync({}, { multi: true }) - ) - ) - .then(sum) - .then(function (count) { - logger.verbose(`Database drop - removed ${count} documents`); - - return count; - }) - .catch(function (err) { - logger.error('Database drop failed', err); - - throw err; - }); -} - -const db = { - collection, - dropDatabase -}; - -const dbManager = { - getDb: () => db -}; - -module.exports = dbManager; diff --git a/ui-desktop/public/main/client/electron-restart.js b/ui-desktop/public/main/client/electron-restart.js deleted file mode 100644 index 5816a002..00000000 --- a/ui-desktop/public/main/client/electron-restart.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -const { app } = require('electron'); - -function restart (status = 0) { - app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) }); - app.exit(status); - return {}; -} - -module.exports = restart; diff --git a/ui-desktop/public/main/client/handlers/index.js b/ui-desktop/public/main/client/handlers/index.js deleted file mode 100644 index a9f31cac..00000000 --- a/ui-desktop/public/main/client/handlers/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - -const singleCore = require('./single-core'); -const noCore = require('./no-core'); - -module.exports = Object.assign({}, singleCore, noCore); diff --git a/ui-desktop/public/main/client/handlers/no-core.js b/ui-desktop/public/main/client/handlers/no-core.js deleted file mode 100644 index 59e47e0a..00000000 --- a/ui-desktop/public/main/client/handlers/no-core.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; - -const restart = require("../electron-restart"); -const dbManager = require("../database"); -const logger = require("../../../logger"); -const storage = require("../storage"); -const auth = require("../auth"); -const wallet = require("../wallet"); -const { - setProxyRouterConfig, - getProxyRouterConfig, - getDefaultCurrencySetting, - setDefaultCurrencySetting, - getKey, - setKey -} = require("../settings"); -const validatePassword = (data) => auth.isValidPassword(data); - -function clearCache() { - logger.verbose("Clearing database cache"); - return dbManager - .getDb() - .dropDatabase() - .then(restart); -} - -const persistState = (data) => storage.persistState(data).then(() => true); - -function changePassword({ oldPassword, newPassword }) { - return validatePassword(oldPassword).then(function (isValid) { - if (!isValid) { - return isValid; - } - return auth.setPassword(newPassword).then(function () { - const seed = wallet.getSeed(oldPassword); - wallet.setSeed(seed, newPassword); - - return true; - }); - }); -} - -const saveProxyRouterSettings = (data) => - Promise.resolve(setProxyRouterConfig(data)); - -const getProxyRouterSettings = async () => { - return getProxyRouterConfig(); -}; - -const handleClientSideError = (data) => { - logger.error("client-side error", data.message, data.stack); -} - -const getDefaultCurrency = async () => getDefaultCurrencySetting(); -const setDefaultCurrency = async (curr) => setDefaultCurrencySetting(curr); - -const getCustomEnvs = async () => getKey('customEnvs'); -const setCustomEnvs = async (value) => setKey('customEnvs', value); - -const getProfitSettings = async () => getKey('profitSettings') || { - deviation: 2, - target: 10, - adaptExisting: false, -}; -const setProfitSettings = async (value) => setKey('profitSettings', value); - -const getAutoAdjustPriceData = async () => getKey('autoAdjustPriceData'); -const setAutoAdjustPriceData = async (value) => { - const oldData = await getAutoAdjustPriceData(); - setKey('autoAdjustPriceData', { - ...oldData, - ...value, - }); -} - -/** - * - * @param {string} contractId - * @param {Date} fromDate - * @returns - */ -const getContractHashrate = async ({contractId, fromDate}) => { - const collection = await dbManager.getDb().collection('hashrate').findAsync({ id: contractId }); - // Uncomment to get a random data - // const data = [] - // const now = new Date().getTime(); - // for (let i = 10; i >= 0; i--) { - // const timestamp = now - i * 1000 * 60 * 5; - // const hashrate = Math.round(Math.random() * 50000) + 70000; - // data.push({ timestamp, hashrate }) - // } - // return data; - return collection - .filter(x => x.timestamp > fromDate.getTime()) - .sort((a, b) => a.timestamp - b.timestamp); -} - -const restartWallet = () => restart(1); - -module.exports = { - validatePassword, - changePassword, - persistState, - clearCache, - saveProxyRouterSettings, - getProxyRouterSettings, - handleClientSideError, - getDefaultCurrency, - setDefaultCurrency, - getCustomEnvs, - setCustomEnvs, - restartWallet, - getContractHashrate, - getProfitSettings, - setProfitSettings, - getAutoAdjustPriceData, - setAutoAdjustPriceData, -}; diff --git a/ui-desktop/public/main/client/handlers/single-core.js b/ui-desktop/public/main/client/handlers/single-core.js deleted file mode 100644 index d272a7eb..00000000 --- a/ui-desktop/public/main/client/handlers/single-core.js +++ /dev/null @@ -1,405 +0,0 @@ - - -const pTimeout = require("p-timeout"); -const logger = require("../../../logger"); -const auth = require("../auth"); -const keys = require("../keys"); -const config = require("../../../config"); -const wallet = require("../wallet"); -const noCore = require("./no-core"); -const WalletError = require("../WalletError"); -const { - setProxyRouterConfig, - cleanupDb, - getProxyRouterConfig, -} = require("../settings"); - -const withAuth = (fn) => (data, { api }) => { - if (typeof data.walletId !== "string") { - throw new WalletError("walletId is not defined"); - } - - return auth - .isValidPassword(data.password) - .then(() => { - return wallet.getSeed(data.password); - }) - .then((seed, index) => { - return api.wallet.createPrivateKey(seed, index); - }) - .then((privateKey) => fn(privateKey, data)); -}; - -const createContract = async function (data, { api }) { - data.walletId = wallet.getAddress().address; - data.password = await auth.getSessionPassword(); - - if (typeof data.walletId !== "string") { - throw new WalletError("WalletId is not defined"); - } - return withAuth((privateKey) => - api.contracts.createContract({ - price: data.price, - speed: data.speed, - duration: data.duration, - profit: data.profit, - sellerAddress: data.sellerAddress, - password: data.password, - privateKey, - }) - )(data, { api }); -}; - -const purchaseContract = async function (data, { api }) { - data.walletId = wallet.getAddress().address; - data.minerPassword = data.password; - data.password = await auth.getSessionPassword(); - - if (typeof data.walletId !== "string") { - throw new WalletError("WalletId is not defined"); - } - - return withAuth((privateKey) => - api.contracts.purchaseContract({ - ...data, - privateKey, - }) - )(data, { api }); -}; - -const editContract = async function (data, { api }) { - data.walletId = wallet.getAddress().address; - data.password = await auth.getSessionPassword(); - - if (typeof data.walletId !== "string") { - throw new WalletError("WalletId is not defined"); - } - return withAuth((privateKey) => - api.contracts.editContract({ - contractId: data.id, - price: data.price, - speed: data.speed, - duration: data.duration, - profit: data.profit, - password: data.password, - walletId: data.walletId, - privateKey, - }) - )(data, { api }); -}; - - -const claimFaucet = async function (data, { api }) { - data.walletId = wallet.getAddress().address; - data.password = await auth.getSessionPassword(); - - if (typeof data.walletId !== "string") { - throw new WalletError("WalletId is not defined"); - } - - return withAuth((privateKey) => - api.token.claimFaucet({ - ...data, - privateKey, - }) - )(data, { api }); -}; - -const cancelContract = async function (data, { api }) { - data.walletId = wallet.getAddress().address; - data.password = await auth.getSessionPassword(); - - if (typeof data.walletId !== "string") { - throw new WalletError("WalletId is not defined"); - } - return withAuth((privateKey) => - api.contracts.cancelContract({ - walletAddress: data.walletAddress, - contractId: data.contractId, - privateKey, - closeOutType: data.closeOutType, - }) - )(data, { api }); -}; - -const setContractDeleteStatus = async function (data, { api }) { - data.walletId = wallet.getAddress().address; - data.password = await auth.getSessionPassword(); - - if (typeof data.walletId !== "string") { - throw new WalletError("WalletId is not defined"); - } - return withAuth((privateKey) => - api.contracts.setContractDeleteStatus({ - walletAddress: data.walletAddress, - contractId: data.contractId, - deleteContract: data.deleteContract, - privateKey, - }) - )(data, { api }); -}; - -function createWallet(data, core, isOpen = true) { - const seed = keys.mnemonicToSeedHex(data.mnemonic); - const entropy = keys.mnemonicToEntropy(data.mnemonic); - const walletAddress = core.api.wallet.createAddress(seed); - - return Promise.all([ - wallet.setSeed(seed, data.password), - wallet.setEntropy(entropy, data.password), - wallet.setAddress(walletAddress), - ]) - .then(() => core.emitter.emit("create-wallet", { address: walletAddress })) - .then(() => isOpen && openWallet(core, data.password)); -} - -const restartProxyRouter = async (data, { emitter, api }) => { - const password = await auth.getSessionPassword(); - - await api["proxy-router"] - .kill(config.chain.proxyPort) - .catch(err => logger.error("proxy router err", err)); - - emitter.emit("open-proxy-router", { password }); -}; - -const stopProxyRouter = async (data, { emitter, api }) => { - await api["proxy-router"] - .kill(config.chain.proxyPort) - .catch(logger.error); -}; - -async function openWallet({ emitter }, password) { - const { address } = wallet.getAddress(); - - emitter.emit("open-wallet", { address, isActive: true }); - emitter.emit("open-proxy-router", { password }); -} - -const onboardingCompleted = (data, core) => { - setProxyRouterConfig(data.proxyRouterConfig); - return auth - .setPassword(data.password) - .then(() => - createWallet( - { - mnemonic: data.mnemonic, - password: data.password, - }, - core, - true - ) - ) - .then(() => true) - .catch((err) => ({ error: new WalletError("Onboarding unable to be completed: ", err) })); -}; - -const recoverFromMnemonic = function (data, core) { - if (!auth.isValidPassword(data.password)) { - return null; - } - - wallet.clearWallet(); - - return createWallet( - { - mnemonic: data.mnemonic, - password: data.password, - }, - core, - false - ) - .then(noCore.clearCache) - .then((_) => auth.setSessionPassword(data.password)); -}; - -function onLoginSubmit({ password }, core) { - var checkPassword = config.chain.bypassAuth - ? new Promise((r) => r(true)) - : auth.isValidPassword(password); - - return checkPassword.then(function (isValid) { - if (!isValid) { - return { error: new WalletError("Invalid password") }; - } - openWallet(core, password); - - return isValid; - }).catch(err => logger.error("onLoginSubmit err", err)); -} -function refreshAllSockets({ url }, { api, emitter }) { - emitter.emit("sockets-scan-started", {}); - return api.sockets - .getConnections() - .then(function () { - emitter.emit("sockets-scan-finished", { success: true }); - return {}; - }) - .catch(function (error) { - logger.warn("Could not sync sockets/connections", error.stack); - emitter.emit("sockets-scan-finished", { - error: error.message, - success: false, - }); - // emitter.once('coin-block', () => - // refreshAllTransactions({ address }, { api, emitter }) - // ); - return {}; - }); -} - -function refreshAllTransactions({ address }, { api, emitter }) { - emitter.emit("transactions-scan-started", {}); - return api.explorer - .refreshAllTransactions(address) - .then(function () { - emitter.emit("transactions-scan-finished", { success: true }); - return {}; - }) - .catch(function (error) { - logger.warn("Could not sync transactions/events", error.stack); - emitter.emit("transactions-scan-finished", { - error: error.message, - success: false, - }); - emitter.once("coin-block", () => - refreshAllTransactions({ address }, { api, emitter }) - ); - return {}; - }); -} - -const getMarketplaceFee = async function (data, { api }) { - return api.contracts.getMarketplaceFee(data); -}; - -function refreshAllContracts({ }, { api }) { - const walletId = wallet.getAddress().address; - return api.contracts.refreshContracts(null, walletId); -} - -function refreshTransaction({ hash, address }, { api }) { - return pTimeout( - api.explorer.refreshTransaction(hash, address), - config.scanTransactionTimeout - ) - .then(() => ({ success: true })) - .catch((error) => ({ error, success: false })); -} - -const getGasLimit = (data, { api }) => api.wallet.getGasLimit(data); - -const getGasPrice = (data, { api }) => api.wallet.getGasPrice(data); - -const sendLmr = async (data, { api }) => - withAuth(api.lumerin.sendLmr)( - { - ...data, - walletId: wallet.getAddress().address, - password: await auth.getSessionPassword(), - }, - { api } - ); - -const sendEth = async (data, { api }) => - withAuth(api.wallet.sendEth)( - { - ...data, - walletId: wallet.getAddress().address, - password: await auth.getSessionPassword(), - }, - { api } - ); - -const startDiscovery = (data, { api }) => api.devices.startDiscovery(data); - -const stopDiscovery = (data, { api }) => api.devices.stopDiscovery(); - -const setMinerPool = (data, { api }) => api.devices.setMinerPool(data); - -const getLmrTransferGasLimit = (data, { api }) => - api.lumerin.estimateGasTransfer(data); - -const getAddressAndPrivateKey = async (data, { api }) => { - - const isValid = await auth.isValidPassword(data.password); - if (!isValid) { - return { error: new WalletError("Invalid password") }; - } - - const seed = wallet.getSeed(data.password); - return api.wallet.getAddressAndPrivateKey(seed, undefined); -}; - -const refreshProxyRouterConnection = async (data, { api }) => - api["proxy-router"].refreshConnectionsStream(data); - -const getLocalIp = async ({ }, { api }) => api["proxy-router"].getLocalIp(); - -const isProxyPortPublic = async (data, { api }) => api["proxy-router"].isProxyPortPublic(data); - -const logout = async (data) => { - return cleanupDb(); -}; - -const getPoolAddress = async (data) => { - const config = getProxyRouterConfig(); - return config.buyerDefaultPool || config.defaultPool; -}; - -const hasStoredSecretPhrase = async (data) => { - return wallet.hasEntropy(); -}; - -const revealSecretPhrase = async (password) => { - const isValid = await auth.isValidPassword(password); - if (!isValid) { - return { error: new WalletError("Invalid password") }; - } - - const entropy = wallet.getEntropy(password); - const mnemonic = keys.entropyToMnemonic(entropy); - return mnemonic; -} - -function getPastTransactions({ address, page, pageSize }, { api }) { - return api.explorer.getPastCoinTransactions(0, undefined, address, page, pageSize); -} - -module.exports = { - // refreshAllSockets, - refreshAllContracts, - purchaseContract, - createContract, - cancelContract, - onboardingCompleted, - recoverFromMnemonic, - onLoginSubmit, - refreshAllTransactions, - refreshTransaction, - createWallet, - getGasLimit, - getGasPrice, - openWallet, - sendLmr, - sendEth, - startDiscovery, - stopDiscovery, - setMinerPool, - getLmrTransferGasLimit, - getAddressAndPrivateKey, - refreshProxyRouterConnection, - logout, - getLocalIp, - getPoolAddress, - restartProxyRouter, - claimFaucet, - revealSecretPhrase, - hasStoredSecretPhrase, - getPastTransactions, - setContractDeleteStatus, - editContract, - getMarketplaceFee, - isProxyPortPublic, - stopProxyRouter, -}; diff --git a/ui-desktop/public/main/client/index.js b/ui-desktop/public/main/client/index.js deleted file mode 100644 index 570bf735..00000000 --- a/ui-desktop/public/main/client/index.js +++ /dev/null @@ -1,221 +0,0 @@ -"use strict"; - -const { ipcMain, app } = require("electron"); -const createCore = require("@lumerin/wallet-core"); -const stringify = require("json-stringify-safe"); - -const logger = require("../../logger"); -const subscriptions = require("./subscriptions"); -const settings = require("./settings"); -const storage = require("./storage"); -const { startMonitoringHashrate } = require("./contractsHashrateSyncer"); - -const { - getAddressAndPrivateKey, - refreshProxyRouterConnection, -} = require("./handlers/single-core"); - -const { runProxyRouter, isProxyRouterHealthy } = require("./proxyRouter"); -let interval; -function startCore({ chain, core, config: coreConfig }, webContent) { - logger.verbose(`Starting core ${chain}`); - const { emitter, events, api } = core.start(coreConfig); - const proxyRouterApi = api["proxy-router"]; - if(interval) - clearInterval(interval); - - interval = startMonitoringHashrate(coreConfig.localProxyRouterUrl, 5 * 60 * 1000); - - // emitter.setMaxListeners(30); - emitter.setMaxListeners(50); - - events.push( - "create-wallet", - "transactions-scan-started", - "transactions-scan-finished", - "contracts-scan-started", - "contracts-scan-finished", - 'contract-updated', - ); - - function send(eventName, data) { - try { - if (!webContent) { - return; - } - const payload = Object.assign({}, data, { chain }); - webContent.sender.send(eventName, payload); - } catch (err) { - logger.error("send error", err); - } - } - - events.forEach((event) => - emitter.on(event, function (data) { - send(event, data); - }) - ); - - function syncTransactions({ address }, page = 1, pageSize = 15) { - return storage - .getSyncBlock(chain) - .then(function (from) { - send("transactions-scan-started", {}); - - return api.explorer - .syncTransactions( - 0, - address, - (number) => storage.setSyncBlock(number, chain), - page, - pageSize - ) - .then(function () { - send("transactions-scan-finished", { success: true }); - - emitter.on("coin-block", function ({ number }) { - storage.setSyncBlock(number, chain).catch(function (err) { - logger.warn("Could not save new synced block", err); - }); - }); - }); - }) - .catch(function (err) { - logger.warn("Could not sync transactions/events", err.stack); - send("transactions-scan-finished", { - error: err.message, - success: false, - }); - - emitter.once("coin-block", () => syncTransactions({ address }, page, pageSize)); - }); - } - - emitter.on("open-wallet", syncTransactions); - - emitter.on("wallet-error", function (err) { - logger.warn( - err.inner ? `${err.message} - ${err.inner.message}` : err.message - ); - }); - - const shouldRestartProxyRouterAfterWalletUpdate = () => { - const prevAppVersion = settings.getAppVersion(); - const isAppVersionChanged = prevAppVersion !== app.getVersion(); - - if (isAppVersionChanged) { - settings.setAppVersion(app.getVersion()); - return true; - } - return false; - }; - - // emitter.on("open-proxy-router", async ({ password }) => { - // const proxyRouterUserConfig = settings.getProxyRouterConfig(); - // if (!proxyRouterUserConfig.runWithoutProxyRouter) { - // const { address, privateKey } = await getAddressAndPrivateKey( - // { password }, - // { api } - // ); - - // send("proxy-router-type-changed", { - // isLocal: true, - // }); - - // const config = { - // privateKey, - // walletAddress: address, - // ...coreConfig.chain, - // ...proxyRouterUserConfig, - // }; - - // const isProxyHealth = await isProxyRouterHealthy( - // api, - // config.localProxyRouterUrl - // ); - // const shouldRestartProxy = shouldRestartProxyRouterAfterWalletUpdate(); - // if (!isProxyHealth || shouldRestartProxy) { - // logger.debug("Seller is not healhy, restart..."); - // await proxyRouterApi.kill(config.proxyPort).catch(logger.error); - // runProxyRouter(config); - // } - - // refreshProxyRouterConnection( - // { - // proxyNodeUrl: config.localProxyRouterUrl, - // }, - // { api } - // ); - // } - // }); - - return { - emitter, - events, - api, - }; -} - -function stopCore({ core, chain }) { - logger.verbose(`Stopping core ${chain}`); - core.stop(); -} - -function createClient(config) { - ipcMain.on("log.error", function (_, args) { - logger.error("ipcMain error ", args.message); - }); - - settings.presetDefaults(); - - let core = { - chain: config.chain.chainId, - core: createCore(), - config: Object.assign({}, config.chain, config), - }; - - ipcMain.on("ui-ready", function (webContent, args) { - const onboardingComplete = !!settings.getPasswordHash(); - - storage - .getState() - .catch(function (err) { - logger.warn("Failed to get state", err.message); - return {}; - }) - .then(function (persistedState) { - const payload = Object.assign({}, args, { - data: { - onboardingComplete, - persistedState: persistedState || {}, - config, - }, - }); - webContent.sender.send("ui-ready", payload); - // logger.verbose(`<-- ui-ready ${stringify(payload)}`); - }) - .catch(function (err) { - logger.error("Could not send ui-ready message back", err.message); - }) - .then(function () { - const { emitter, events, api } = startCore(core, webContent); - core.emitter = emitter; - core.events = events; - core.api = api; - subscriptions.subscribe(core); - }) - .catch(function (err) { - console.log("panic"); - console.log(err); - console.log("Unknown chain =", err.message); - logger.error("Could not start core", err.message); - }); - }); - - ipcMain.on("ui-unload", function () { - stopCore(core); - subscriptions.unsubscribe(core); - }); -} - -module.exports = { createClient }; diff --git a/ui-desktop/public/main/client/keys.js b/ui-desktop/public/main/client/keys.js deleted file mode 100644 index 84f73496..00000000 --- a/ui-desktop/public/main/client/keys.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -const bip39 = require('bip39'); - -const createMnemonic = () => Promise.resolve(bip39.generateMnemonic()); - -const isValidMnemonic = mnemonic => bip39.validateMnemonic(mnemonic); - -const mnemonicToSeedHex = mnemonic => - bip39.mnemonicToSeedHex(mnemonic).toString('hex'); - -const mnemonicToEntropy = mnemonic => bip39.mnemonicToEntropy(mnemonic).toString('hex'); - -const entropyToMnemonic = entropy => { - const buffer = Buffer.from(entropy, 'hex'); - return bip39.entropyToMnemonic(buffer); -} - -module.exports = { - createMnemonic, - isValidMnemonic, - mnemonicToSeedHex, - mnemonicToEntropy, - entropyToMnemonic -}; diff --git a/ui-desktop/public/main/client/promise-throttle.js b/ui-desktop/public/main/client/promise-throttle.js deleted file mode 100644 index 539da6b2..00000000 --- a/ui-desktop/public/main/client/promise-throttle.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -module.exports = function promiseThrottle (fn) { - const promise = Promise.resolve(); - return function (...args) { - return promise.catch().then(fn(...args)); - }; -} diff --git a/ui-desktop/public/main/client/proxyRouter.js b/ui-desktop/public/main/client/proxyRouter.js deleted file mode 100644 index 2542b17d..00000000 --- a/ui-desktop/public/main/client/proxyRouter.js +++ /dev/null @@ -1,93 +0,0 @@ -const { app } = require("electron"); -const fs = require("fs"); -const { spawn } = require("child_process"); - -const logger = require("../../logger.js"); - -const openLogFile = (name, retry = true) => { - try { - const path = `${app.getPath("logs")}/${name}.log`; - - logger.debug(`Writing logs to ${path}`); - if (fs.existsSync(path)) { - const stats = fs.statSync(path); - const fileSizeInBytes = stats.size; - - const fileSizeInMegabytes = fileSizeInBytes / (1024 * 1024); - if (fileSizeInMegabytes > 10) { - fs.unlinkSync(path); - } - } - return fs.openSync(path, "a"); - } catch { - if (retry) { - return openLogFile(`${name}(1)`, false); - } - return undefined; - } -}; - -const isProxyRouterHealthy = async (api, url) => { - try { - const healthCheck = await api["proxy-router"].healthCheck(url); - return healthCheck?.data?.status === "healthy"; - } catch (err) { - logger.error("proxy-router error", err); - return false; - } -}; - -const runProxyRouter = (config) => { - try { - const resourcePath = - process.env.NODE_ENV === "production" - ? process.resourcesPath // Prod Mode - : `${__dirname}/../../..`; // Dev Mode - - const out = openLogFile(`proxy-out`); - const err = openLogFile(`proxy-err`); - - const proxyConfig = [ - `--contract-address=${config.cloneFactoryAddress}`, - `--eth-node-address=${config.wsApiUrl}`, - - "--miner-share-timeout=10m", - // "--miner-vetting-duration=5m", - - "--hashrate-error-threshold=0.05", - "--hashrate-cycle-duration=5m", - - "--hashrate-share-timeout=120m", - - "--log-level-app=info", - "--log-level-scheduler=info", - "--log-level-proxy=info", - "--log-level-connection=info", - `--log-folder-path=${app.getPath("logs")}/`, - - `--wallet-private-key=${config.privateKey}`, - `--proxy-address=0.0.0.0:${config.proxyPort}`, - `--web-address=0.0.0.0:${config.proxyWebPort}`, - `--pool-address=${config.sellerDefaultPool}`, - ]; - - const ls = spawn( - `${resourcePath}/executables/proxy-router`, - proxyConfig, - { - detached: true, - stdio: ["ignore", out, err], - } - ); - - logger.error(`This is not error, but important info. Proxy config: ${JSON.stringify(proxyConfig.filter(c => !c.includes('private-key')))}`); - - ls.unref(); - return; - } catch (err) { - logger.debug(`ProxyRouter run error: ${err}`); - throw err; - } -}; - -module.exports = { runProxyRouter, isProxyRouterHealthy }; diff --git a/ui-desktop/public/main/client/secure.js b/ui-desktop/public/main/client/secure.js deleted file mode 100644 index 29b27edd..00000000 --- a/ui-desktop/public/main/client/secure.js +++ /dev/null @@ -1,19 +0,0 @@ -const secureStore = require('keytar'); - -const APP_NAME = 'lumerin-wallet'; -const SECURE_PASSWORD_KEY = 'password'; - -module.exports = { - APP_NAME, - SECURE_PASSWORD_KEY, - setSessionPassword(password) { - return secureStore - .setPassword(APP_NAME, SECURE_PASSWORD_KEY, password) - .catch(e => { - console.log('Failed to set password in keystore: ', e); - }); - }, - getSessionPassword() { - return secureStore.getPassword(APP_NAME, SECURE_PASSWORD_KEY); - } -}; diff --git a/ui-desktop/public/main/client/settings/defaultSettings.json b/ui-desktop/public/main/client/settings/defaultSettings.json deleted file mode 100644 index 21c75dbe..00000000 --- a/ui-desktop/public/main/client/settings/defaultSettings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "settingsVersion": 1 -} diff --git a/ui-desktop/public/main/client/settings/index.js b/ui-desktop/public/main/client/settings/index.js deleted file mode 100644 index 2d753386..00000000 --- a/ui-desktop/public/main/client/settings/index.js +++ /dev/null @@ -1,115 +0,0 @@ -'use strict' - -const settings = require('electron-settings') -// const utils = require("web3-utils"); -const { merge } = require('lodash') - -const logger = require('../../../logger') -const restart = require('../electron-restart') -const { getDb } = require('../database') - -const getKey = (key) => settings.getSync(key) - -function setKey(key, value) { - settings.setSync(key, value) - logger.verbose('Settings changed', key) -} - -const getPasswordHash = () => getKey('user.passwordHash') - -function setPasswordHash(hash) { - setKey('user.passwordHash', hash) -} - -const setProxyRouterConfig = (config) => setKey('user.proxyRouterConfig', JSON.stringify(config)) - -const getProxyRouterConfig = () => { - try { - const configJson = getKey('user.proxyRouterConfig') - const data = JSON.parse(configJson) - if (data.defaultPool) { - if (!data.sellerDefaultPool) { - data.sellerDefaultPool = data.defaultPool - } - if (!data.buyerDefaultPool) { - data.buyerDefaultPool = data.defaultPool - } - } - return data - } catch (e) { - console.error('error getting proxyrouter config', e) - cleanupDb() - } -} - -function upgradeSettings(defaultSettings, currentSettings) { - let finalSettings = merge({}, currentSettings) - // Remove no longer used settings as now are stored in config - delete finalSettings.app - delete finalSettings.coincap - delete finalSettings.token - - // Convert previous addresses to checksum addresses - // if (finalSettings.user && finalSettings.user.wallet) { - - // Object.keys(finalSettings.user.wallets).forEach(function (key) { - // Object.keys(finalSettings.user.wallets[key].addresses).forEach(function (address) { - // if (!utils.checkAddressChecksum(address)) { - // finalSettings.user.wallets[key].addresses[utils.toChecksumAddress(address)] = finalSettings.user.wallets[key].addresses[address]; - // // Remove previous lowercase address - // delete finalSettings.user.wallets[key].addresses[address]; - // } - // } - // ); - // }); - - finalSettings.settingsVersion = defaultSettings.settingsVersion - settings.setSync(finalSettings) -} - -function presetDefaults() { - logger.verbose('Settings file', settings.file()) - const currentSettings = settings.getSync() - const defaultSettings = require('./defaultSettings') - settings.setSync(merge(defaultSettings, currentSettings)) - logger.verbose('Default settings applied') - logger.debug('Current settings', settings.getSync()) -} - -function cleanupDb() { - const currentSettings = settings.getSync() - const defaultSettings = require('./defaultSettings') - - logger.warn('Removing old user settings') - delete currentSettings.user - // Overwrite old settings and clear db if settings file version changed - upgradeSettings(defaultSettings, currentSettings) - const db = getDb() - db.dropDatabase().catch(function (err) { - logger.error('Possible database corruption', err.message) - }) - restart(1) -} - -const getDefaultCurrencySetting = () => getKey('selectedCurrency') - -const setDefaultCurrencySetting = (currency) => setKey('selectedCurrency', currency) - -const getAppVersion = () => getKey('app.version') - -const setAppVersion = (value) => setKey('app.version', value) - -module.exports = { - getPasswordHash, - setPasswordHash, - presetDefaults, - setProxyRouterConfig, - getProxyRouterConfig, - cleanupDb, - getDefaultCurrencySetting, - setDefaultCurrencySetting, - getKey, - setKey, - getAppVersion, - setAppVersion -} diff --git a/ui-desktop/public/main/client/storage.js b/ui-desktop/public/main/client/storage.js deleted file mode 100644 index 8076c929..00000000 --- a/ui-desktop/public/main/client/storage.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -const promiseThrottle = require('./promise-throttle'); -const { defaultTo, get } = require('lodash/fp'); -const { getDb } = require('./database'); - -const keysToPersist = ['chain']; - -const mapToObject = array => - array.reduce(function (acum, current) { - acum[current.type] = current.data; - return acum; - }, {}); - -const persistState = promiseThrottle(function (state) { - return Promise.all( - keysToPersist.map(function persist (key) { - const query = { type: key }; - const update = Object.assign({ data: state[key] }, query); - - return getDb() - .collection('state') - .updateAsync(query, update, { upsert: true }); - }) - ); -}); - -function getState () { - return getDb() - .collection('state') - .findAsync({ type: { $in: keysToPersist } }) - .then(mapToObject); -} - -function setSyncBlock (number, chain) { - const query = { type: 'sync' }; - const update = Object.assign({ data: { number } }, query); - - return getDb() - .collection(`sync-${chain}`) - .updateAsync(query, update, { upsert: true }); -} - -function getSyncBlock (chain) { - return getDb() - .collection(`sync-${chain}`) - .findOneAsync({ type: 'sync' }) - .then(defaultTo({ data: { number: 0 } })) - .then(get('data.number')); -} - -module.exports = { - setSyncBlock, - getSyncBlock, - persistState, - getState -}; diff --git a/ui-desktop/public/main/client/subscriptions/index.js b/ui-desktop/public/main/client/subscriptions/index.js deleted file mode 100644 index ad377970..00000000 --- a/ui-desktop/public/main/client/subscriptions/index.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -const { subscribeSingleCore, unsubscribeSingleCore } = require('./single-core'); -const { subscribeWithoutCore, unsubscribeWithoutCore } = require('./no-core'); - -function subscribe (core) { - subscribeSingleCore(core); - subscribeWithoutCore(); -} - -function unsubscribe (core) { - unsubscribeSingleCore(core); - unsubscribeWithoutCore(); -} - -module.exports = { subscribe, unsubscribe }; diff --git a/ui-desktop/public/main/client/subscriptions/no-core.js b/ui-desktop/public/main/client/subscriptions/no-core.js deleted file mode 100644 index f827a615..00000000 --- a/ui-desktop/public/main/client/subscriptions/no-core.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -const handlers = require('../handlers'); -const utils = require('./utils'); - -const listeners = { - 'validate-password': handlers.validatePassword, - 'change-password': handlers.changePassword, - 'persist-state': handlers.persistState, - 'clear-cache': handlers.clearCache, - 'handle-client-error': handlers.handleClientSideError, - 'get-pool-address': handlers.getPoolAddress, - 'reveal-secret-phrase': handlers.revealSecretPhrase, - 'has-stored-secret-phrase': handlers.hasStoredSecretPhrase, - "logout": handlers.logout, - "save-proxy-router-settings": handlers.saveProxyRouterSettings, - "get-proxy-router-settings": handlers.getProxyRouterSettings, - "get-default-currency-settings": handlers.getDefaultCurrency, - "set-default-currency-settings": handlers.setDefaultCurrency, - "get-custom-env-values": handlers.getCustomEnvs, - "set-custom-env-values": handlers.setCustomEnvs, - "get-profit-settings": handlers.getProfitSettings, - "set-profit-settings": handlers.setProfitSettings, - "get-contract-hashrate": handlers.getContractHashrate, - "get-auto-adjust-price": handlers.getAutoAdjustPriceData, - "set-auto-adjust-price": handlers.setAutoAdjustPriceData, -}; - -// Subscribe to messages where no core has to react -const subscribeWithoutCore = () => - utils.subscribeTo(listeners, 'none'); - -const unsubscribeWithoutCore = () => - utils.unsubscribeTo(listeners); - -module.exports = { subscribeWithoutCore, unsubscribeWithoutCore }; diff --git a/ui-desktop/public/main/client/subscriptions/single-core.js b/ui-desktop/public/main/client/subscriptions/single-core.js deleted file mode 100644 index 0a67e934..00000000 --- a/ui-desktop/public/main/client/subscriptions/single-core.js +++ /dev/null @@ -1,52 +0,0 @@ -const handlers = require("../handlers"); -const utils = require("./utils"); - -const withCore = (core) => (fn) => (data) => fn(data, core); - -const listeners = { - "recover-from-mnemonic": handlers.recoverFromMnemonic, - "onboarding-completed": handlers.onboardingCompleted, - "login-submit": handlers.onLoginSubmit, - // 'refresh-all-sockets': handlers.refreshAllSockets, - "refresh-all-contracts": handlers.refreshAllContracts, - "refresh-all-transactions": handlers.refreshAllTransactions, - "refresh-transaction": handlers.refreshTransaction, - "get-gas-limit": handlers.getGasLimit, - "get-gas-price": handlers.getGasPrice, - "get-past-transactions": handlers.getPastTransactions, - "send-lmr": handlers.sendLmr, - "send-eth": handlers.sendEth, - "create-contract": handlers.createContract, - "purchase-contract": handlers.purchaseContract, - "edit-contract": handlers.editContract, - "cancel-contract": handlers.cancelContract, - "set-delete-contract-status": handlers.setContractDeleteStatus, - "start-discovery": handlers.startDiscovery, - "stop-discovery": handlers.stopDiscovery, - "set-miner-pool": handlers.setMinerPool, - "get-lmr-transfer-gas-limit": handlers.getLmrTransferGasLimit, - "get-local-ip": handlers.getLocalIp, - "is-proxy-port-public": handlers.isProxyPortPublic, - "restart-proxy-router": handlers.restartProxyRouter, - "stop-proxy-router": handlers.stopProxyRouter, - "claim-faucet": handlers.claimFaucet, - 'get-private-key': handlers.getAddressAndPrivateKey, - "get-marketplace-fee": handlers.getMarketplaceFee -}; - -let coreListeners = {}; - -// Subscribe to messages where only one particular core has to react -function subscribeSingleCore(core) { - coreListeners[core.chain] = {}; - Object.keys(listeners).forEach(function(key) { - coreListeners[core.chain][key] = withCore(core)(listeners[key]); - }); - - utils.subscribeTo(coreListeners[core.chain], core.chain); -} - -const unsubscribeSingleCore = (core) => - utils.unsubscribeTo(coreListeners[core.chain]); - -module.exports = { subscribeSingleCore, unsubscribeSingleCore }; diff --git a/ui-desktop/public/main/client/subscriptions/utils.js b/ui-desktop/public/main/client/subscriptions/utils.js deleted file mode 100644 index 474bdbb5..00000000 --- a/ui-desktop/public/main/client/subscriptions/utils.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; - -const { ipcMain } = require("electron"); -const stringify = require("json-stringify-safe"); - -const logger = require("../../../logger"); -const WalletError = require("../WalletError"); - -function getLogData(data) { - if (!data) { - return ""; - } - const logData = Object.assign({}, data); - - const blackList = ["password"]; - blackList.forEach((w) => delete logData[w]); - - return stringify(logData); -} - -const checkIfLoggableEvent = (eventName) => eventName !== "persist-state"; - -const isPromise = (p) => { - if (typeof p === "object" && typeof p.then === "function") { - return true; - } - - return false; -}; - -const ignoreChain = (chain, data) => - chain !== "multi" && chain !== "none" && data.chain && chain !== data.chain; - -function onRendererEvent(eventName, handler, chain) { - ipcMain.on(eventName, function (event, { id, data }) { - if (ignoreChain(chain, data)) { - return; - } - const result = handler(data); - - if (!isPromise(result)) { - logger.warn(`<-- ${eventName} result is not a promise!. ${result}`); - return; - } - - result - .then(function (res) { - if (event.sender.isDestroyed()) { - return; - } - event.sender.send(eventName, { id, data: res }); - }) - .catch(function (err) { - if (event.sender.isDestroyed()) { - return; - } - const error = new WalletError(err.message); - event.sender.send(eventName, { id, data: { error } }); - logger.warn(`<-- ${eventName}:${id} ${err.message}`); - }) - .catch(function (err) { - logger.warn(`Could not send message to renderer: ${err.message}`); - }); - }); -} - -const subscribeTo = (types, chain) => - Object.keys(types).forEach((type) => - onRendererEvent(type, types[type], chain) - ); - -const unsubscribeTo = (types) => - Object.keys(types).forEach((type) => - ipcMain.removeAllListeners(type, types[type]) - ); - -module.exports = { subscribeTo, unsubscribeTo }; diff --git a/ui-desktop/public/main/client/wallet.js b/ui-desktop/public/main/client/wallet.js deleted file mode 100644 index 2d347512..00000000 --- a/ui-desktop/public/main/client/wallet.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -const { aes256cbcIv, sha256 } = require('./crypto'); -const settings = require('electron-settings'); - -const getWallet = () => Object.keys(settings.getSync('user.wallet')); - -const getAddress = () => settings.getSync(`user.wallet.address`); - -const getToken = () => settings.getSync(`user.wallet.token`); - -function getSeed (password) { - const encryptedSeed = settings.getSync(`user.wallet.encryptedSeed`); - return aes256cbcIv.decrypt(password, encryptedSeed); -} - -const hasEntropy = () => !!settings.getSync(`user.wallet.encryptedEntropy`); - -function getEntropy (password) { - const encryptedEntropy = settings.getSync(`user.wallet.encryptedEntropy`); - return aes256cbcIv.decrypt(password, encryptedEntropy); -} - -const setAddress = (address) => settings.setSync(`user.wallet.address`, { address }); - -const setSeed = (seed, password) => settings.setSync(`user.wallet.encryptedSeed`, aes256cbcIv.encrypt(password, seed)); - -const setEntropy = (entropy, password) => settings.setSync(`user.wallet.encryptedEntropy`, aes256cbcIv.encrypt(password, entropy)); - -const clearWallet = () => settings.setSync('user.wallet', {}); - -module.exports = { - getAddress, - setAddress, - getActiveWallet: getWallet, - setActiveWallet: setAddress, - clearWallet, - getWallet, - getToken, - getSeed, - setSeed, - getEntropy, - setEntropy, - hasEntropy -}; diff --git a/ui-desktop/public/main/main-window.js b/ui-desktop/public/main/main-window.js deleted file mode 100644 index 340b78d2..00000000 --- a/ui-desktop/public/main/main-window.js +++ /dev/null @@ -1,170 +0,0 @@ -const { app, BrowserWindow, Notification, dialog } = require('electron') -const { autoUpdater } = require('electron-updater') -const isDev = import('electron-is-dev') -const path = require('path') -const windowStateKeeper = require('electron-window-state') - -import logger from '../logger' -import * as analytics from '../analytics' -import * as restart from './client/electron-restart' - -let mainWindow - -// Disable electron security warnings since local content is served via http -if (isDev) { - process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true -} - -function showUpdateNotification(info = {}) { - if (!Notification.isSupported()) { - return - } - - const versionLabel = info.label ? `Version ${info.version}` : 'The latest version' - - const notification = new Notification({ - title: `${versionLabel} was installed`, - body: 'Lumerin Wallet will be automatically updated after restart.' - }) - - notification.show() -} - -function initAutoUpdate() { - if (isDev) { - return - } - autoUpdater.on('checking-for-update', () => logger.info('Checking for update...')) - autoUpdater.on('update-available', () => logger.info('Update available.')) - autoUpdater.on('download-progress', function (progressObj) { - let msg = `Download speed: ${progressObj.bytesPerSecond}` - msg += ` - Downloaded ${progressObj.percent}%` - msg += ` (${progressObj.transferred}/${progressObj.total})` - logger.info(msg) - }) - - autoUpdater.on('update-not-available', () => logger.info('Update not available.')) - autoUpdater.on('error', (err) => logger.error(`Error in auto-updater. ${err}`)) - - autoUpdater - .checkForUpdatesAndNotify() - .then((res) => { - logger.info(`Checked for the updates: ${res}`) - }) - .catch(function (err) { - logger.warn('Could not find updates', err.message) - }) -} - -function loadWindow(config) { - // Ensure the app is ready before creating the main window - if (!app.isReady()) { - logger.warn('Tried to load main window while app not ready. Reloading...') - restart(1) - return - } - - if (mainWindow) { - return - } - - const mainWindowState = windowStateKeeper({ - // defaultWidth: 660, - defaultWidth: 820, - defaultHeight: 800 - }) - - // TODO this should be read from config - mainWindow = new BrowserWindow({ - show: false, - width: mainWindowState.width, - height: mainWindowState.height, - // maxWidth: 660, - // maxHeight: 700, - minWidth: 660, - minHeight: 800, - backgroundColor: '#323232', - webPreferences: { - enableRemoteModule: true, - nodeIntegration: false, - contextIsolation: true, - preload: path.join(__dirname, 'preload.js'), - devTools: config.devTools || !app.isPackaged - }, - x: mainWindowState.x, - y: mainWindowState.y - }) - - require('@electron/remote/main').enable(mainWindow.webContents) - - mainWindowState.manage(mainWindow) - - analytics.init(mainWindow.webContents.getUserAgent()) - - const appUrl = isDev - ? process.env.ELECTRON_START_URL - : `file://${path.join(__dirname, '../index.html')}` - - logger.info('Roading renderer from URL:', appUrl) - - mainWindow.loadURL(appUrl) - - mainWindow.webContents.on('crashed', function (ev, killed) { - logger.error('Crashed', ev.sender.id, killed) - }) - - mainWindow.on('unresponsive', function (ev) { - logger.error('Unresponsive', ev.sender.id) - }) - - mainWindow.on('closed', function () { - mainWindow = null - }) - - mainWindow.once('ready-to-show', function () { - initAutoUpdate() - mainWindow.show() - }) - - mainWindow.on('close', (event) => { - event.preventDefault() - if (app.quitting || process.platform !== 'darwin') { - const choice = dialog.showMessageBoxSync(mainWindow, { - type: 'question', - buttons: ['Yes', 'No'], - title: 'Confirm', - message: 'Are you sure you want to quit?' - }) - if (choice === 1) { - return - } else { - mainWindow.destroy() - mainWindow = null - app.quit() - } - } else { - mainWindow.hide() - } - }) - - app.on('activate', () => { - mainWindow.show() - }) - - app.on('before-quit', () => { - app.quitting = true - }) -} - -function createWindow(config) { - app.on('fullscreen', function () { - mainWindow.isFullScreenable ? mainWindow.setFullScreen(true) : mainWindow.setFullScreen(false) - }) - - const load = loadWindow.bind(null, config) - - app.on('ready', load) - app.on('activate', load) -} - -module.exports = { createWindow } diff --git a/ui-desktop/public/main/preload.js b/ui-desktop/public/main/preload.js deleted file mode 100644 index 14e0377c..00000000 --- a/ui-desktop/public/main/preload.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -const { ipcRenderer, clipboard, shell, contextBridge } = require('electron'); -const remote = require('@electron/remote'); -// electron-is-dev can't be used in preload script -// const isDev = import('electron-is-dev') -const isDev = !remote.app.isPackaged; - -// @see http://electronjs.org/docs/tutorial/security#2-disable-nodejs-integration-for-remote-content - -const copyToClipboard = function (text) { - return clipboard.writeText(text); -}; - -const getAppVersion = function () { - return remote.app.getVersion(); -}; - -const openLink = function (url) { - return shell.openExternal(url); -}; - -contextBridge.exposeInMainWorld('ipcRenderer', { - send (eventName, payload) { - return ipcRenderer.send(eventName, payload); - }, - on (eventName, listener) { - // For some reason the listener passed into this function doesn't work - // if you want to use it to unsubscribe later (likely due to chrome/node connection). - // So we wrap it in a function and provide an unsubscribe function both to event handler - // and as a returned value - function unsubscribe(){ - ipcRenderer.removeListener(eventName, subscription) - } - - function subscription(event, payload) { - listener(event, payload, unsubscribe); - } - - ipcRenderer.on(eventName, subscription); - - return unsubscribe; - } -}); - -contextBridge.exposeInMainWorld('openLink', openLink); -contextBridge.exposeInMainWorld('getAppVersion', getAppVersion); -contextBridge.exposeInMainWorld('copyToClipboard', copyToClipboard); -contextBridge.exposeInMainWorld('isDev', isDev); diff --git a/ui-desktop/public/menu.js b/ui-desktop/public/menu.js deleted file mode 100644 index fe56076b..00000000 --- a/ui-desktop/public/menu.js +++ /dev/null @@ -1,103 +0,0 @@ -'use strict'; - -const { app, shell, Menu } = require('electron'); -const APP_NAME = 'Lumerin Wallet'; - -const template = [ - { - label: 'Edit', - submenu: [ - { role: 'undo' }, - { role: 'redo' }, - { type: 'separator' }, - { role: 'cut' }, - { role: 'copy' }, - { role: 'paste' }, - { role: 'selectall' } - ] - }, - - { - label: 'View', - submenu: [ - { - label: 'Toggle Full Screen', - accelerator: (() => process.platform === 'darwin' ? 'Ctrl+Command+F' : 'F11')(), - click (item, focusedWindow) { - focusedWindow && focusedWindow.setFullScreen(!focusedWindow.isFullScreen()); - } - }, - - { type: 'separator' }, - { label: 'Reload', accelerator: 'CmdOrCtrl+R', role: 'reload' }, - - { - label: 'Force Reload', - accelerator: 'Shift+CmdOrCtrl+R', - role: 'forcereload' - }, - - { - label: 'Toggle Developer Tools', - accelerator: 'Alt+CmdOrCtrl+I', - role: 'toggledevtools' - } - ] - }, - - { - role: 'window', - submenu: [{ role: 'minimize' }, { role: 'close' }] - }, - - { - role: 'help', - submenu: [ - { - label: 'Learn More', - click () { - return shell.openExternal('https://lumerin.io') - } - } - ] - } -]; - -if (process.platform === 'darwin') { - template.unshift({ - label: APP_NAME, - submenu: [ - { role: 'about', label: `About ${APP_NAME}` }, - { type: 'separator' }, - { role: 'services' }, - { type: 'separator' }, - { role: 'hide', label: `Hide ${APP_NAME}` }, - { role: 'hideothers' }, - { role: 'unhide' }, - { type: 'separator' }, - { role: 'quit', label: `Quit ${APP_NAME}` } - ] - }); - - const windowMenu = template.find(m => m.role === 'window'); - - if (windowMenu) { - windowMenu.submenu.push({ type: 'separator' }, { role: 'front' }); - } -} else { - template.unshift({ - label: 'File', - submenu: [{ role: 'quit', label: `Quit ${APP_NAME}` }] - }); - - const help = template.find(t => t.role === 'help'); - - if (help) { - help.submenu.unshift({ type: 'separator' }); - help.submenu.unshift({ role: 'about', label: `${APP_NAME} v${app.getVersion()}`, enabled: false }); - } -} - -module.exports = function () { - Menu.setApplicationMenu(Menu.buildFromTemplate(template)); -}; diff --git a/ui-desktop/src/main/config/index.ts b/ui-desktop/src/main/config/index.ts index 5a0a213c..bd063963 100644 --- a/ui-desktop/src/main/config/index.ts +++ b/ui-desktop/src/main/config/index.ts @@ -21,7 +21,7 @@ const chain = { symbol: process.env.SYMBOL_LMR || 'LMR', symbolEth: process.env.SYMBOL_ETH || 'ETH', - lmrTokenAddress: process.env.LUMERIN_TOKEN_ADDRESS, + mainTokenAddress: process.env.TOKEN_ADDRESS, cloneFactoryAddress: process.env.CLONE_FACTORY_ADDRESS, proxyRouterUrl: process.env.PROXY_ROUTER_URL, @@ -45,7 +45,8 @@ const chain = { process.env.PORT_CHECK_ERROR_LINK || 'https://gitbook.lumerin.io/lumerin-hashpower-marketplace/buyer/2.-network-changes-for-receiving-hashrate', - localProxyRouterUrl: `http://localhost:${process.env.PROXY_WEB_DEFAULT_PORT || 8081}`, + localProxyRouterUrl: `http://localhost:${process.env.PROXY_WEB_DEFAULT_PORT || 8082}`, + diamondAddress: process.env.DIAMOND_ADDRESS, faucetUrl: process.env.FAUCET_URL, showFaucet: process.env.SHOW_FAUCET === 'true', diff --git a/ui-desktop/src/main/electron.ts b/ui-desktop/src/main/electron.ts deleted file mode 100644 index 70f32989..00000000 --- a/ui-desktop/src/main/electron.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { app } from 'electron' -import isDev from 'electron-is-dev' -import * as os from 'os' -import { config as RavenConfig } from 'raven-js' -import { createWindow } from './src/main-window.js' -import { createClient } from './src/client' -import config from './config' -import initContextMenu from './contextMenu' -import initMenu from './menu' -import errorHandler from './errorHandler' -import logger from './logger' - -errorHandler({ logger: logger.error }) -console.log('electron bootstrap') -console.log('app config: ', config) -if (isDev) { - // Development - app.on('ready', function () { - require('electron-debug')({ isEnabled: true }) - - const { - default: installExtension, - REACT_DEVELOPER_TOOLS, - REDUX_DEVTOOLS - } = require('electron-devtools-installer') - - installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS]) - .then((extName) => logger.debug(`Added Extension: ${extName}`)) - .catch((err) => logger.debug('An error occurred: ', err)) - }) -} else { - // Production - if (config.sentryDsn) { - RavenConfig(config.sentryDsn, { - captureUnhandledRejections: true, - release: app.getVersion(), - tags: { - process: process.type, - electron: process.versions.electron, - chrome: process.versions.chrome, - platform: os.platform(), - platform_release: os.release() - } - }).install() - } -} - -app.on('window-all-closed', function () { - if (process.platform !== 'darwin') { - app.quit() - } -}) - -console.log('app config: ', config) -createWindow() - -app.on('ready', function () { - logger.info('App ready, initializing...') - - initMenu() - initContextMenu() - - createClient(config) -}) diff --git a/ui-desktop/src/main/src/client/apiGateway.js b/ui-desktop/src/main/src/client/apiGateway.js new file mode 100644 index 00000000..e438e766 --- /dev/null +++ b/ui-desktop/src/main/src/client/apiGateway.js @@ -0,0 +1,126 @@ +import config from '../../config' + +const getAllModels = async () => { + try { + const path = `${config.chain.localProxyRouterUrl}/blockchain/models` + const response = await fetch(path); + const data = await response.json(); + return data.models; + } + catch (e) { + console.log("Error", e) + return []; + } +} + +const getBalances = async () => { + try { + const path = `${config.chain.localProxyRouterUrl}/blockchain/balance` + const response = await fetch(path); + const data = await response.json(); + return data; + } + catch (e) { + console.log("Error", e) + return []; + } +} + +const sendEth = async (to, amount) => { + try { + const path = `${config.chain.localProxyRouterUrl}/blockchain/send/eth` + const response = await fetch(path, { + method: "POST", + body: JSON.stringify({ + to, amount + }) + }); + const data = await response.json(); + return data.txHash; + } + catch (e) { + console.log("Error", e) + return undefined; + } +} + +const sendMor = async (to, amount) => { + try { + const path = `${config.chain.localProxyRouterUrl}/blockchain/send/mor` + const response = await fetch(path, { + method: "POST", + body: JSON.stringify({ + to, amount + }) + }); + const data = await response.json(); + return data.txHash; + } + catch (e) { + console.log("Error", e) + return undefined; + } +} + +const getTransactions = async (page = 1, size = 15) => { + try { + const path = `${config.chain.localProxyRouterUrl}/blockchain/transactions?page=${page}&limit=${size}` + const response = await fetch(path); + const data = await response.json(); + return data.transactions; + } + catch (e) { + console.log("Error", e) + return []; + } +} + +const getMorRate = async (tokenAddress = "0x092baadb7def4c3981454dd9c0a0d7ff07bcfc86", network = "arbitrum") => { + try { + const path = `https://api.geckoterminal.com/api/v2/simple/networks/${network}/token_price/${tokenAddress}`; + const response = await fetch(path); + const body = await response.json(); + return body.data.attributes.token_prices[tokenAddress]; + } + catch (e) { + console.log("Error", e) + return null; + } +} + +const getTodaysBudget = async () => { + try { + const path = `${config.chain.localProxyRouterUrl}/blockchain/sessions/budget`; + const response = await fetch(path); + const body = await response.json(); + return body.budget; + } + catch (e) { + console.log("Error", e) + return null; + } +} + +const getTokenSupply = async () => { + try { + const path = `${config.chain.localProxyRouterUrl}/blockchain/token/supply`; + const response = await fetch(path); + const body = await response.json(); + return body.supply; + } + catch (e) { + console.log("Error", e) + return null; + } +} + +export default { + getAllModels, + getBalances, + sendEth, + sendMor, + getTransactions, + getMorRate, + getTodaysBudget, + getTokenSupply +} \ No newline at end of file diff --git a/ui-desktop/src/main/src/client/contractsHashrateSyncer.js b/ui-desktop/src/main/src/client/contractsHashrateSyncer.js deleted file mode 100644 index 2f7df542..00000000 --- a/ui-desktop/src/main/src/client/contractsHashrateSyncer.js +++ /dev/null @@ -1,37 +0,0 @@ -const { create: createAxios } = require('axios') -import { getDb } from './database' -import logger from '../../logger' - -export const startMonitoringHashrate = (url, period) => { - const interval = setInterval(async () => { - try { - const items = (await createAxios({ baseURL: url })('/contracts')).data - persistData(items) - } catch (e) { - logger.debug(e.message, 'Failed to poll hashrate') - persistData() - } - }, period) - return interval -} - -export const persistData = (data) => { - const db = getDb() - const collection = db.collection('hashrate') - - if (!data) { - return - } - - data.forEach((item) => { - const id = item.ID - const currentHashrate = item.ResourceEstimatesActual['ema--5m'] - collection.insert({ - id, - hashrate: currentHashrate, - timestamp: new Date().getTime() - }) - }) -} - -export default { startMonitoringHashrate } diff --git a/ui-desktop/src/main/src/client/handlers/no-core.js b/ui-desktop/src/main/src/client/handlers/no-core.js index 11f8716c..639674e0 100644 --- a/ui-desktop/src/main/src/client/handlers/no-core.js +++ b/ui-desktop/src/main/src/client/handlers/no-core.js @@ -14,6 +14,8 @@ import { getKey, setKey } from '../settings' +import apiGateway from '../apiGateway'; + const validatePassword = (data) => auth.isValidPassword(data) function clearCache() { @@ -111,5 +113,6 @@ export default { getProfitSettings, setProfitSettings, getAutoAdjustPriceData, - setAutoAdjustPriceData + setAutoAdjustPriceData, + ...apiGateway } diff --git a/ui-desktop/src/main/src/client/index.js b/ui-desktop/src/main/src/client/index.js index 12f6fbf2..9df7fa6b 100644 --- a/ui-desktop/src/main/src/client/index.js +++ b/ui-desktop/src/main/src/client/index.js @@ -2,25 +2,15 @@ const { ipcMain, app } = require('electron') const createCore = require('@lumerin/wallet-core') -const stringify = require('json-stringify-safe') import logger from '../../logger' import subscriptions from './subscriptions' import settings from './settings' import storage from './storage' -import { startMonitoringHashrate } from './contractsHashrateSyncer' -import { getAddressAndPrivateKey, refreshProxyRouterConnection } from './handlers/single-core' - -import { runProxyRouter, isProxyRouterHealthy } from './proxyRouter' -let interval export function startCore({ chain, core, config: coreConfig }, webContent) { logger.verbose(`Starting core ${chain}`) const { emitter, events, api } = core.start(coreConfig) - const proxyRouterApi = api['proxy-router'] - if (interval) clearInterval(interval) - - interval = startMonitoringHashrate(coreConfig.localProxyRouterUrl, 5 * 60 * 1000) // emitter.setMaxListeners(30); emitter.setMaxListeners(50) @@ -104,39 +94,6 @@ export function startCore({ chain, core, config: coreConfig }, webContent) { return false } - // emitter.on('open-proxy-router', async ({ password }) => { - // const proxyRouterUserConfig = settings.getProxyRouterConfig() - // if (!proxyRouterUserConfig.runWithoutProxyRouter) { - // const { address, privateKey } = await getAddressAndPrivateKey({ password }, { api }) - - // send('proxy-router-type-changed', { - // isLocal: true - // }) - - // const config = { - // privateKey, - // walletAddress: address, - // ...coreConfig.chain, - // ...proxyRouterUserConfig - // } - - // const isProxyHealth = await isProxyRouterHealthy(api, config.localProxyRouterUrl) - // const shouldRestartProxy = shouldRestartProxyRouterAfterWalletUpdate() - // if (!isProxyHealth || shouldRestartProxy) { - // logger.debug('Seller is not healhy, restart...') - // await proxyRouterApi.kill(config.proxyPort).catch(logger.error) - // runProxyRouter(config) - // } - - // refreshProxyRouterConnection( - // { - // proxyNodeUrl: config.localProxyRouterUrl - // }, - // { api } - // ) - // } - // }) - return { emitter, events, diff --git a/ui-desktop/src/main/src/client/subscriptions/no-core.js b/ui-desktop/src/main/src/client/subscriptions/no-core.js index b7fa8f04..75e0a736 100644 --- a/ui-desktop/src/main/src/client/subscriptions/no-core.js +++ b/ui-desktop/src/main/src/client/subscriptions/no-core.js @@ -23,7 +23,14 @@ const listeners = { 'set-profit-settings': handlers.setProfitSettings, 'get-contract-hashrate': handlers.getContractHashrate, 'get-auto-adjust-price': handlers.getAutoAdjustPriceData, - 'set-auto-adjust-price': handlers.setAutoAdjustPriceData + 'set-auto-adjust-price': handlers.setAutoAdjustPriceData, + // Api Gateway + 'get-all-models': handlers.getAllModels, + 'get-transactions': handlers.getTransactions, + 'get-balances': handlers.getBalances, + 'get-rates': handlers.getMorRate, + "get-todays-budget": handlers.getTodaysBudget, + "get-supply": handlers.getTokenSupply, } // Subscribe to messages where no core has to react diff --git a/ui-desktop/src/renderer/index.html b/ui-desktop/src/renderer/index.html index 1d0baf4c..70d4fab7 100644 --- a/ui-desktop/src/renderer/index.html +++ b/ui-desktop/src/renderer/index.html @@ -5,12 +5,14 @@ - Electron + Morpheus - + /> --> + + @@ -29,18 +31,19 @@ body { margin: 0; padding: 0; - background-image: url("src/main.jpg"); + background: #03160e!important; + /* background-image: url("src/main.jpg"); background-position: right; background-repeat: no-repeat; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; - background-size: cover; + background-size: cover; */ font-family: 'Montserrat', sans-serif; font-style: normal; - font-weight: 400; - color: white; - font-size: 1.6rem; + font-weight: 400!important; + color: white!important; + font-size: 1.6rem!important; -webkit-font-smoothing: antialiased; } diff --git a/ui-desktop/src/renderer/src/client/index.jsx b/ui-desktop/src/renderer/src/client/index.jsx index e0881d0d..963f6579 100644 --- a/ui-desktop/src/renderer/src/client/index.jsx +++ b/ui-desktop/src/renderer/src/client/index.jsx @@ -140,7 +140,15 @@ const createClient = function (createStore) { setProfitSettings: utils.forwardToMainProcess('set-profit-settings'), getAutoAdjustPriceData: utils.forwardToMainProcess('get-auto-adjust-price'), setAutoAdjustPriceData: utils.forwardToMainProcess('set-auto-adjust-price'), - getContractHashrate: utils.forwardToMainProcess('get-contract-hashrate') + getContractHashrate: utils.forwardToMainProcess('get-contract-hashrate'), + // API Gateway + getAllModels: utils.forwardToMainProcess('get-all-models'), + + getTransactions: utils.forwardToMainProcess('get-transactions'), + getBalances: utils.forwardToMainProcess('get-balances'), + getRates: utils.forwardToMainProcess('get-rates'), + getTodaysBudget: utils.forwardToMainProcess('get-todays-budget'), + getTokenSupply: utils.forwardToMainProcess('get-supply'), } const api = { diff --git a/ui-desktop/src/renderer/src/components/Loading.tsx b/ui-desktop/src/renderer/src/components/Loading.tsx index 0783132a..f44021fe 100644 --- a/ui-desktop/src/renderer/src/components/Loading.tsx +++ b/ui-desktop/src/renderer/src/components/Loading.tsx @@ -37,13 +37,13 @@ function Loading({ chainStatus }) { - + {/* */} diff --git a/ui-desktop/src/renderer/src/components/Router.tsx b/ui-desktop/src/renderer/src/components/Router.tsx index 7d170053..89a684c3 100644 --- a/ui-desktop/src/renderer/src/components/Router.tsx +++ b/ui-desktop/src/renderer/src/components/Router.tsx @@ -9,6 +9,7 @@ import Marketplace from './contracts/Marketplace' import Chat from './chat/Chat'; import { Models } from './models/Models' import { Agents } from './agents/Agents' +import Bids from './bids/Bids' // import Sockets from './sockets/Sockets' // import Reports from './reports/Reports' @@ -19,6 +20,8 @@ import { Agents } from './agents/Agents' // import BuyerHub from './contracts/BuyerHub' // import AutoPriceAdjuster from './AutoPriceAdjuster' +import 'bootstrap/dist/css/bootstrap.min.css'; +import Providers from './providers/Providers' const fadeIn = keyframes` from { @@ -63,6 +66,8 @@ export const Layout = () => ( + + {/* */} diff --git a/ui-desktop/src/renderer/src/components/bids/Bids.tsx b/ui-desktop/src/renderer/src/components/bids/Bids.tsx new file mode 100644 index 00000000..c5b59b8c --- /dev/null +++ b/ui-desktop/src/renderer/src/components/bids/Bids.tsx @@ -0,0 +1,100 @@ +import React, { useEffect, useState } from "react"; +import { withRouter } from 'react-router-dom'; +import withBidsState from '../../store/hocs/withBidsState'; + +import { LayoutHeader } from '../common/LayoutHeader' +import { View } from '../common/View' +import Table from 'react-bootstrap/Table'; +import Button from 'react-bootstrap/Button'; +import { abbreviateAddress } from '../../utils'; +import styled from 'styled-components'; + +const BidTable = styled(Table)` + text-align: center!important; + border: 0.5px solid#21dc8f!important; + + th { + background: #244a47!important; + color: #21dc8f!important; + } + + td { + background: #244a47!important; + color: #21dc8f!important; + padding: 12px 0!important + } +` + +const StartBtn = styled(Button)` + background: rgba(0,0,0, 0.9)!important; + border-radius: 0!important; + border: 1px solid #21dc8f!important; +` + +function renderTable({ onStart, bids, providers }) { + return ( + + + + Bid + Provider + Provider Endpoint + Price Per Second + + + + + {bids?.length + ? bids.map(b => { + const provider = providers?.find(x => x.Address.toLowerCase() === b.Provider.toLowerCase()); + return ( + + {abbreviateAddress(b.Id, 5)} + {abbreviateAddress(b.Provider, 5)} + {provider?.Endpoint} + {b.PricePerSecond / 10 ** 18} MOR + onStart(b.Id, provider)}>Start + ) + }) : null} + + + ); +} + +const Bids = ({ history, getProviders, selectedModel, getBitsByModels, setBid }) => { + const [bids, setBids] = useState([]); + const [providers, setProviders] = useState([]); + + useEffect(() => { + if (!selectedModel) { + history.push("/models"); + return; + } + + getProviders().then(data => { + const providersMap = data.filter(d => !d.IsDeleted) + setProviders(providersMap); + }) + + getBitsByModels(selectedModel.Id).then(data => { + setBids(data.filter(d => !d.DeletedAt)); + }) + }, []) + + const onStart = (bidId, provider) => { + setBid({ bidId, provider }).then((isSuccess) => { + if(!isSuccess) { + return; + } + history.push("/chat"); + }) + } + + return ( + + +
{renderTable({ onStart, bids, providers })}
+
) +} + +export default withRouter(withBidsState((Bids))); \ No newline at end of file diff --git a/ui-desktop/src/renderer/src/components/chat/Chat.css b/ui-desktop/src/renderer/src/components/chat/Chat.css index 49bf83b3..69b15528 100644 --- a/ui-desktop/src/renderer/src/components/chat/Chat.css +++ b/ui-desktop/src/renderer/src/components/chat/Chat.css @@ -1,14 +1,48 @@ .history-drawer { - width: 25%!important; + width: 35%!important; min-width: 250px!important; border-left: 1px solid rgba(255, 255, 255, 0.16)!important; padding: 2.4rem!important; + background: #0d1f16!important; - background-image: url("src/main.jpg")!important; + /* background-image: url("src/main.jpg")!important; background-position: right!important; background-repeat: no-repeat!important; -webkit-background-size: cover!important; -moz-background-size: cover!important; -o-background-size: cover!important; - background-size: cover!important; + background-size: cover!important; */ +} + +.model-selector { + align-items: center; + justify-content: space-between; + margin: 1.6rem 0 1.6rem; + background-color: #fff; + padding: 6px 1.6rem 6px 1.6rem; + border-radius: 0.375rem; + color: white; + max-width: 720px; + + background: rgba(255,255,255, 0.04); + border-width: 1px; + border: 1px solid rgba(255, 255, 255, 0.04); + color: white; + width: 350px; +} + +.model-selector__info span { + font-size: 12px; + display: block; +} + +.change-modal { + height: 60px!important; + width: 140px!important; +} + +.model-selector__icons { + display: flex; + flex-direction: column; + justify-content: center; } \ No newline at end of file diff --git a/ui-desktop/src/renderer/src/components/chat/Chat.styles.tsx b/ui-desktop/src/renderer/src/components/chat/Chat.styles.tsx index 3b14d0a1..6b89b028 100644 --- a/ui-desktop/src/renderer/src/components/chat/Chat.styles.tsx +++ b/ui-desktop/src/renderer/src/components/chat/Chat.styles.tsx @@ -6,12 +6,11 @@ export const View = styled.div` max-width: 100%; min-width: 600px; position: relative; - padding-top: 2rem; `; export const Container = styled.div` max-width: 1120px; - height: calc(100% - 160px); + height: calc(100% - 200px); justify-content: space-between; margin: 0 auto; display: flex; @@ -24,6 +23,21 @@ export const ChatBlock = styled.div` height: 100%; overflow-y: auto; margin-bottom: 20px; + + &.createSessionMode { + display: flex; + align-items: center; + justify-content: center; + } + + &.createSessionMode .session-container { + width: 400px; + } + + &.createSessionMode .session-title { + text-align: center; + margin-bottom: 10px; + } ` export const Control = styled.div` @@ -36,17 +50,28 @@ export const Control = styled.div` resize: none; padding-right: 6rem; } + + textarea:focus, input:focus{ + outline: none!important; + } ` export const SendBtn = styled.div` position: absolute; right: 16px; border-radius: 5px; - width: 26px; - height: 26px; + width: 32px; + height: 32px; + display: flex; + align-items: center; + justify-content: center; text-align: center; bottom: 12px; background: ${p => p.theme.colors.morMain}; + + &[disabled] { + opacity: 0.5; + } ` export const Avatar = styled.div` @@ -68,6 +93,8 @@ export const AvatarHeader = styled.div` font-weight: 900; padding: 0 8px; font-size: 18px; + line-height: 18px; + margin-bottom: 5px; ` export const MessageBody = styled.div` @@ -103,7 +130,11 @@ export const CustomTextArrea = styled(TextareaAutosize)` padding: 12px 16px; &::focus { - outline: none; + outline: none!important; + } + + textarea:focus, input:focus{ + outline: none!important; } ` @@ -114,13 +145,12 @@ export const ContainerTitle = styled.div` align-items: center; position: sticky; width: 100%; - padding: 1.5rem 0; + padding: 0 2.4rem; z-index: 2; right: 0; left: 0; top: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.16); - padding-bottom: 32px!important; `; export const TitleRow = styled.div` diff --git a/ui-desktop/src/renderer/src/components/chat/Chat.tsx b/ui-desktop/src/renderer/src/components/chat/Chat.tsx index 84784867..63c96be6 100644 --- a/ui-desktop/src/renderer/src/components/chat/Chat.tsx +++ b/ui-desktop/src/renderer/src/components/chat/Chat.tsx @@ -1,7 +1,7 @@ -import React, { createRef, useContext, useRef, useState } from 'react' +import React, { createRef, useContext, useEffect, useRef, useState } from 'react' // import component 👇 import Drawer from 'react-modern-drawer' -import { IconHistory, IconArrowUp } from '@tabler/icons-react'; +import { IconHistory, IconArrowUp, IconServer, IconWorld } from '@tabler/icons-react'; import { View, ContainerTitle, @@ -18,33 +18,68 @@ import { Control, SendBtn } from './Chat.styles'; +import { BtnAccent } from '../dashboard/BalanceBlock.styles'; +import { withRouter } from 'react-router-dom'; +import withChatState from '../../store/hocs/withChatState'; +import { abbreviateAddress } from '../../utils' import 'react-modern-drawer/dist/index.css' import './Chat.css' import { ChatHistory } from './ChatHistory'; +import Spinner from 'react-bootstrap/Spinner'; +import OpenSessionModal from './modals/OpenSessionModal'; +import ModelSelectionModal from './modals/ModelSelectionModal'; -const lorem = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." const colors = [ '#1899cb', '#da4d76', '#d66b38', '#d39d00', '#b46fc4', '#269c68', '#86858a' ]; const getColor = (name) => { - return colors[getHashCode(name) % colors.length] + if (!name) { + return; + } + return colors[(getHashCode(name) + 1) % colors.length] } const Chat = (props) => { const chatBlockRef = useRef(null); const [value, setValue] = useState(""); + const [hasSession, setHasSession] = useState(true); + + const [sessions, setSessions] = useState(); - const [history, setHistory] = useState(["What is Lorem Ipsum?"]); const [isSpinning, setIsSpinning] = useState(false); + const [meta, setMeta] = useState({ budget: 0, supply: 0 }); + + const [activeSession, setActiveSession] = useState(undefined); + + const [chainData, setChainData] = useState(null); + + const [openSessionModal, setOpenSessionModal] = useState(false); + const [openChangeModal, setOpenChangeModal] = useState(false); - const user = props.chat || 'Llama GPT'; + const [selectedBid, setSelectedBid] = useState(null); - const [messages, setMessages] = useState([ - { user: 'Me', role: "user", text: "What is Lorem Ipsum?", icon: "M", color: getColor("Me") }, - { user: 'GPT', role: "assistant", text: lorem, icon: "GPT", color: getColor("GPT") }]); + const modelName = selectedBid?.Model?.Name || "Model"; + + const isLocal = selectedBid?.Provider == 'Local'; + const providerAddress = isLocal ? "(local)" : selectedBid?.Provider ? abbreviateAddress(selectedBid?.Provider, 4) : null; + + useEffect(() => { + props.getMetaInfo().then((meta) => { + setMeta(meta); + }); + props.getModelsData().then((chainData) => { + setChainData(chainData); + const defaultSelectedBid = (chainData.models + .find((x: any) => x.bids.find(b => b.Provider == 'Local')) as any).bids.find(b => b.Provider == 'Local'); + setSelectedBid(defaultSelectedBid); + }); + refreshSessions(); + }, []) + + const [messages, setMessages] = useState([]); const [isOpen, setIsOpen] = useState(false); const toggleDrawer = () => { @@ -52,49 +87,137 @@ const Chat = (props) => { } const scrollToBottom = () => { - chatBlockRef.current?.scrollIntoView({ behavior: "smooth" }) + chatBlockRef.current?.scrollIntoView({ behavior: "smooth", block: 'end' }) + } + + const onOpenSession = ({ stake }) => { + console.log("open-session", stake); + + props.onOpenSession({ stake, selectedBid}).then((res) => { + setActiveSession(res); + refreshSessions(); + }) + } + + const refreshSessions = () => { + return props.getSessionsByUser(props.address).then(setSessions); + } + + const closeSession = (sessionId: string) => { + props.closeSession(sessionId).then(refreshSessions); } const call = async (message) => { - try { - const response = await fetch("http://localhost:11434/v1/chat/completions", { + setIsSpinning(true); + const chatHistory = messages.map(m => ({ role: m.role, content: m.text })) + let response; + + if(isLocal) { + response = await fetch(`${props.config.chain.localProxyRouterUrl}/v1/chat/completions`, { method: 'POST', headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' + "Accept": "application/json" }, body: JSON.stringify({ model: "llama2:latest", + stream: true, messages: [ - { - role: "user", - content: message - }] + ...chatHistory, + { + role: "user", + content: message + } + ] }) }); - const data = await response.json(); - setMessages([...messages, { user: 'GPT', role: "assistant", text: data.choices, icon: "GPT", color: getColor("GPT") }]); } - catch (e) { - setMessages([...messages, { user: 'GPT', role: "assistant", text: "Ooops, cannot answer", icon: "GPT", color: getColor("GPT") }]); + else { + try { + response = await fetch(`${props.config.chain.localProxyRouterUrl}/proxy/sessions/${activeSession.sessionId}/prompt`, { + method: 'POST', + body: JSON.stringify({ + prompt: { + model: "llama2:latest", + stream: true, + messages: [ + ...chatHistory, + { + role: "user", + content: message + } + ] + }, + providerUrl: selectedBid.ProviderData.Endpoint.replace("http://", ""), + providerPublicKey: activeSession.signature.message + }) + }); + + if(!response.ok) { + console.log("Failed", await response.json()) + } + } + catch(e) { + console.log("error", e); + return; + } } - finally { - setIsSpinning(false); + + function parse(decodedChunk) { + const lines = decodedChunk.split('\n'); + const trimmedData = lines.map(line => line.replace(/^data: /, "").trim()); + const filteredData = trimmedData.filter(line => !["", "[DONE]"].includes(line)); + const parsedData = filteredData.map(line => JSON.parse(line)); + + return parsedData; + } + + const textDecoder = new TextDecoder(); + + if (response.body != null) { + const reader = response.body.getReader() + + let memoState = [...messages, { id: "some", user: 'Me', text: value, role: "user", icon: "M", color: "#20dc8e" }]; + + while (true) { + const { value, done } = await reader.read(); + if (done) { + setIsSpinning(false); + break; + } + const decodedString = textDecoder.decode(value, { stream: true }); + const parts = parse(decodedString); + parts.forEach(part => { + if(!part?.id) { + return; + } + const message = memoState.find(m => m.id == part.id); + const otherMessages = memoState.filter(m => m.id != part.id); + const text = `${message?.text || ''}${part?.choices[0]?.delta?.content || ''}`; + const result = [...otherMessages, { id: part.id, user: modelName, role: "assistant", text: text, icon: "L", color: getColor("L") }]; + memoState = result; + setMessages(result); + scrollToBottom(); + }) + } + } } const handleSubmit = () => { - if(!value) { + if (!value) { return; } - + setIsSpinning(true); - setMessages([...messages, { user: 'Me', text: value, role: "user", icon: "M", color: colors[getHashCode("M") % colors.length] }]); - scrollToBottom(); - call(messages); + setMessages([...messages, { id: "some", user: 'Me', text: value, role: "user", icon: "M", color: "#20dc8e" }]); + call(value).then(() => { + setIsSpinning(false); + }); setValue(""); } + const price = selectedBid?.PricePerSecond ? selectedBid?.PricePerSecond / (10 ** 18) : 0; + return ( <> { direction='right' className='history-drawer' > - + - + Chat +
+
+
+

{selectedBid?.Model?.Name}

+ { + isLocal ? + ( + <> + (local) + 0 MOR/sec + + ) + : ( + <> + {providerAddress} + {price} MOR/sec + + ) + } +
+
+ + +
+
+ setOpenChangeModal(true)}>Change Model +
- - GPT + + {selectedBid?.Model?.Name[0]} -
Llama GPT
+
{selectedBid?.Model?.Name}
-
Provider: 0x123...234
+
Provider: {isLocal ? "(local)" : providerAddress}
@@ -127,15 +279,30 @@ const Chat = (props) => { - + { - messages && messages.map(x => ( + messages?.length ? messages.map(x => ( )) + : (!isLocal && !activeSession &&
+
To perform promt please create session and choose desired session time
+
Session will be created for selected Model
+
+ setOpenSessionModal(true)} + block + > + Create Session +
+
) }
{ if (e.key === 'Enter') { e.preventDefault(); @@ -148,10 +315,33 @@ const Chat = (props) => { placeholder={"Ask me anything..."} minRows={1} maxRows={6} /> - + { + isSpinning ? : + }
+ { + setOpenSessionModal(false) + onOpenSession(data); + }} + handleClose={() => setOpenSessionModal(false)} /> + { + const defaultSelectedBid = (chainData.models + .find((x: any) => x.bids.find(b => b.Id == id)) as any) + .bids.find(b => b.Id == id); + + setSelectedBid(defaultSelectedBid); + setMessages([]); + }} + handleClose={() => setOpenChangeModal(false)} /> ) } @@ -191,4 +381,4 @@ function getHashCode(string) { return Math.abs(hash); } -export default Chat; \ No newline at end of file +export default withRouter(withChatState(Chat)); \ No newline at end of file diff --git a/ui-desktop/src/renderer/src/components/chat/ChatHistory.tsx b/ui-desktop/src/renderer/src/components/chat/ChatHistory.tsx index 1ae56a82..4c868887 100644 --- a/ui-desktop/src/renderer/src/components/chat/ChatHistory.tsx +++ b/ui-desktop/src/renderer/src/components/chat/ChatHistory.tsx @@ -1,5 +1,7 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import styled from 'styled-components'; +import { IconX } from "@tabler/icons-react"; +import { abbreviateAddress } from '../../utils'; const Container = styled.div` text-align: center; @@ -11,16 +13,36 @@ const Title = styled.div` ` const HistoryItem = styled.div` color: ${p => p.theme.colors.morMain} + display: flex; + align-items: center; + justify-content: space-evenly; + cursor: pointer; + padding: 5px 0; ` -export const ChatHistory = (props: { history: string[]}) => { + +interface ChatHistoryProps { + onCloseSession: (string) => void; + sessions: any[]; +} + +export const ChatHistory = (props: ChatHistoryProps) => { + const sessions = props.sessions; + return ( - History + Sessions { - props.history?.length && ( - props.history.map(a => ({a})) + sessions?.length && ( + sessions.map(a => ( + +
{abbreviateAddress(a.Id, 5)}
+
{new Date(a.OpenedAt * 1000).toLocaleString()}
+ { + !a.ClosedAt ? ( props.onCloseSession(a.Id)}>) :
CLOSED
+ } +
)) ) }
diff --git a/ui-desktop/src/renderer/src/components/chat/modals/ModelRow.tsx b/ui-desktop/src/renderer/src/components/chat/modals/ModelRow.tsx new file mode 100644 index 00000000..6d108bc3 --- /dev/null +++ b/ui-desktop/src/renderer/src/components/chat/modals/ModelRow.tsx @@ -0,0 +1,103 @@ +import React, { useState } from 'react'; +import { IconTrashOff } from '@tabler/icons-react'; +import styled from 'styled-components'; +import Select from "react-select"; +import { + TitleWrapper, + Title, + Subtitle, + Form, + InputGroup, + Row, + Input, + Label, + Sublabel, + RightBtn, +} from '../../contracts/modals/CreateContractModal.styles'; +import { abbreviateAddress } from '../../../utils'; + +const RowContainer = styled.div` + padding: 1.2rem 0; + display: grid; + grid-template-columns: 2fr 4fr 2fr; + text-align: center; + box-shadow: 0 -1px 0 0 ${p => p.theme.colors.morMain} inset; + color: ${p => p.theme.colors.morMain}; +`; + +const FlexCenter = styled.div` + display: flex; + justify-content: center; + align-items: center; +`; + +const selectorStyles = { + control: (base, state) => ({ ...base, borderColor: '#20dc8e', width: '100%', background: 'transparent' }), + option: (base, state) => ({ + ...base, + backgroundColor: state.isSelected ? '#0e4353' : "#03160e", + color: '#20dc8e', + ':active': { + ...base[':active'], + backgroundColor: '#0e435380', + color: '#20dc8e' + }, + zIndex: 100 + }), + placeholder: base => ({ + ...base, + color: '#20dc8e', + fontSize: '1.4rem', + fontWeight: 700 + }), + singleValue: base => ({ + ...base, + color: '#20dc8e', + fontWeight: 600, + fontSize: '1.4rem' + }), + indicatorsContainer: base => ({ + ...base, + color: '#20dc8e' + }), +}; + +function ModelRow(props) { + + let hasLocal = false; + const optionsWithoutLocal = props?.model?.bids.map(x => { + const isLocal = !x.Id; + if(isLocal) { + hasLocal = true; + return null; + } + return ({ value: x.Id, label: `${abbreviateAddress(x.Provider || "", 3)} ${x.PricePerSecond / (10 ** 18)} MOR` }) + }).filter(x => x); + const options = hasLocal ? [({ value: "Local", label: "(local) 0 MOR"}), ...optionsWithoutLocal] : optionsWithoutLocal; + + const [selected, changeSelected] = useState(); + + return ( + + + {props?.model?.Name} + + +
+ { + + const value = Number(e.target.value); + const totalCost = pricePerSecond * value * 60; + const stake = totalCost * +supply / +budget; + setMorStake(stake); + setDuration(value); + }} + type="number" + min={5} + max={1440} + name="time" + id="time" + /> + Session Length (min 5, max 1440) + {/* {formState?.errors?.time?.type === 'required' && ( + Duration is required + )} + {formState?.errors?.time?.type === 'min' && ( + {'Minimum 24 hours'} + )} + {formState?.errors?.time?.type === 'max' && ( + {'Maximum 48 hours'} + )} */} + + + { + duration && morStake && ( + + Funds to Stake: {(morStake / 10 ** 18).toFixed(2)} MOR + + ) + } + + + {/* Save as Draft */} + triggerOpen({ stake: morStake, duration })}> + {"Open"} + + + + + + ) +} + +export default OpenSessionModal; \ No newline at end of file diff --git a/ui-desktop/src/renderer/src/components/common/AltLayout.jsx b/ui-desktop/src/renderer/src/components/common/AltLayout.jsx index f6484a15..599aa559 100644 --- a/ui-desktop/src/renderer/src/components/common/AltLayout.jsx +++ b/ui-desktop/src/renderer/src/components/common/AltLayout.jsx @@ -12,6 +12,10 @@ const Container = styled(Flex.Column)` ` const Body = styled.div` + background: rgba(255,255,255, 0.04); + border-width: 1px; + border: 1px solid rgba(255, 255, 255, 0.04); + padding: 3rem; max-width: 53rem; width: 100%; margin-top: 4rem; diff --git a/ui-desktop/src/renderer/src/components/common/Btn.jsx b/ui-desktop/src/renderer/src/components/common/Btn.jsx index a699720a..ed230be2 100644 --- a/ui-desktop/src/renderer/src/components/common/Btn.jsx +++ b/ui-desktop/src/renderer/src/components/common/Btn.jsx @@ -26,9 +26,9 @@ export const Btn = styled(BaseBtn)` line-height: 2.5rem; font-size: 2rem; font-weight: 500; - color: ${p => p.theme.colors.light}; - border-radius: 12px; - background-color: ${p => p.theme.colors.primary}; + color: black; + border-radius: 5px; + background-color: ${p => p.theme.colors.morMain}; box-shadow: inset 0 3px 0 0 rgba(255, 255, 255, 0.1); padding: 1.6rem 2rem; diff --git a/ui-desktop/src/renderer/src/components/common/ChecklistItem.jsx b/ui-desktop/src/renderer/src/components/common/ChecklistItem.jsx index 572c3ba5..dce17c77 100644 --- a/ui-desktop/src/renderer/src/components/common/ChecklistItem.jsx +++ b/ui-desktop/src/renderer/src/components/common/ChecklistItem.jsx @@ -11,7 +11,7 @@ const Container = styled.div` const Icon = styled.svg` position: absolute; fill: ${p => - p.isActive ? p.theme.colors.primary : p.theme.colors.translucentDark}; + p.isActive ? p.theme.colors.morMain : p.theme.colors.translucentDark}; left: 0; top: 1px; `; diff --git a/ui-desktop/src/renderer/src/components/common/FilteredMessage.jsx b/ui-desktop/src/renderer/src/components/common/FilteredMessage.jsx index 6401aaee..cb93655e 100644 --- a/ui-desktop/src/renderer/src/components/common/FilteredMessage.jsx +++ b/ui-desktop/src/renderer/src/components/common/FilteredMessage.jsx @@ -12,7 +12,7 @@ const FilteredMessage = props => { // coinSymbol: PropTypes.string.isRequired, // children: PropTypes.node.isRequired, // config: PropTypes.shape({ - // lmrTokenAddress: PropTypes.string.isRequired + // mainTokenAddress: PropTypes.string.isRequired // }).isRequired, // client: PropTypes.shape({ // fromWei: PropTypes.func.isRequired @@ -30,7 +30,7 @@ const FilteredMessage = props => { replaceWith: 'WEB FACING CONTRACT' }, { - search: props.config.lmrTokenAddress, + search: props.config.mainTokenAddress, replaceWith: 'LMR TOKEN CONTRACT' }, { search: /(.*gas too low.*)/gi, replaceWith: () => 'Gas too low.' }, diff --git a/ui-desktop/src/renderer/src/components/common/LayoutHeader.jsx b/ui-desktop/src/renderer/src/components/common/LayoutHeader.jsx index ca568adf..2a7b9058 100644 --- a/ui-desktop/src/renderer/src/components/common/LayoutHeader.jsx +++ b/ui-desktop/src/renderer/src/components/common/LayoutHeader.jsx @@ -14,6 +14,7 @@ const Container = styled.div` right: 0; left: 0; top: 0; + padding-bottom: 32px!important; `; const TitleRow = styled.div` diff --git a/ui-desktop/src/renderer/src/components/common/LoadingBar.jsx b/ui-desktop/src/renderer/src/components/common/LoadingBar.jsx index 8fe824f6..b8aea7f0 100644 --- a/ui-desktop/src/renderer/src/components/common/LoadingBar.jsx +++ b/ui-desktop/src/renderer/src/components/common/LoadingBar.jsx @@ -12,7 +12,7 @@ const loading = keyframes` const Container = styled.div` width: 100%; - background-color: ${p => p.theme.colors.translucentPrimary}; + background-color: ${p => p.theme.colors.morMain}; padding: 0.2rem; border-radius: 0.8rem; `; diff --git a/ui-desktop/src/renderer/src/components/common/Root.jsx b/ui-desktop/src/renderer/src/components/common/Root.jsx index 071a68b2..3d5ed4e8 100644 --- a/ui-desktop/src/renderer/src/components/common/Root.jsx +++ b/ui-desktop/src/renderer/src/components/common/Root.jsx @@ -54,13 +54,6 @@ class Root extends React.Component { payload: defaultCurr || this.props.sellerDefaultCurrency || 'BTC' }) }) - .then(() => this.props.client.getMarketplaceFee({})) - .then((fee) => - this.props.dispatch({ - type: 'set-marketplace-fee', - payload: fee - }) - ) // eslint-disable-next-line no-console .catch((e) => { console.error('root component error', e.message) diff --git a/ui-desktop/src/renderer/src/components/contracts/modals/CreateContractModal.styles.jsx b/ui-desktop/src/renderer/src/components/contracts/modals/CreateContractModal.styles.jsx index a11c1232..2135cd92 100644 --- a/ui-desktop/src/renderer/src/components/contracts/modals/CreateContractModal.styles.jsx +++ b/ui-desktop/src/renderer/src/components/contracts/modals/CreateContractModal.styles.jsx @@ -11,7 +11,7 @@ export const CloseModal = onClose => ( top: '25px', right: '30px', cursor: 'pointer', - color: 'rgba(0, 0, 0, 0.54)' + color: 'white' }} onClick={onClose} /> @@ -41,10 +41,13 @@ export const Body = styled.div` background-color: ${p => p.theme.colors.light}; width: ${p => p.width || '45%'}; height: ${p => p.height || 'fit-content'}; - border-radius: 15px; + border-radius: 5px; padding: 3rem 5%; max-width: ${p => p.maxWidth || '600px'}; max-height: ${p => p.maxHeight || '800px'}; + background-color: #173629; + color: white; + border: 1px solid rgba(255, 255, 255, 0.04); @media (min-height: 700px) { padding: 5rem; @@ -125,7 +128,7 @@ export const Input = styled.input` outline: 0; border: 0px; background: #eaf7fc; - border-radius: 15px; + border-radius: 5px; padding: 1.5rem 1.5rem; margin-top: 0.25rem; @@ -176,10 +179,10 @@ export const LeftBtn = styled(BaseBtn)` width: 45%; height: 40px; font-size: 1.5rem; - border-radius: 15px; + border-radius: 5px; border: 1px solid ${p => p.theme.colors.primary}; - background-color: ${p => p.theme.colors.light}; - color: ${p => p.theme.colors.primary}; + background-color: ${p => p.theme.colors.morMain}; + color: black; @media (min-width: 1040px) { margin-left: 0; @@ -190,9 +193,10 @@ export const RightBtn = styled(BaseBtn)` width: 45%; height: 40px; font-size: 1.5rem; - border-radius: 15px; - background-color: ${p => p.theme.colors.primary}; - color: ${p => p.theme.colors.light}; + border-radius: 5px; + background-color: ${p => p.theme.colors.morMain}; + color: black; + font-weight: 600; @media (min-width: 1040px) { margin-left: 0; diff --git a/ui-desktop/src/renderer/src/components/contracts/modals/Modal.jsx b/ui-desktop/src/renderer/src/components/contracts/modals/Modal.jsx index 6dd85ea6..805a839f 100644 --- a/ui-desktop/src/renderer/src/components/contracts/modals/Modal.jsx +++ b/ui-desktop/src/renderer/src/components/contracts/modals/Modal.jsx @@ -6,7 +6,7 @@ import { CloseModal } from './CreateContractModal.styles'; -function Modal({ children, onClose }) { +function Modal({ children, onClose, bodyProps }) { const waitingForMouseUpRef = useRef(false); const ignoreBackdropClickRef = useRef(false); const modalRef = useRef(false); @@ -34,6 +34,7 @@ function Modal({ children, onClose }) { return ( e.stopPropagation()} onMouseDown={handleDialogMouseDown} > diff --git a/ui-desktop/src/renderer/src/components/dashboard/Balance.jsx b/ui-desktop/src/renderer/src/components/dashboard/Balance.jsx index 727f03c3..8b8396c0 100644 --- a/ui-desktop/src/renderer/src/components/dashboard/Balance.jsx +++ b/ui-desktop/src/renderer/src/components/dashboard/Balance.jsx @@ -62,7 +62,7 @@ export const Balance = ({ {formatCurrency({ value, maxSignificantFractionDigits })}  - {currency} + {currency == "saLMR" ? "saMOR" : currency} ≈ {equivalentUSD} diff --git a/ui-desktop/src/renderer/src/components/dashboard/BalanceBlock.jsx b/ui-desktop/src/renderer/src/components/dashboard/BalanceBlock.jsx index 0a9bd4de..7c92d4c5 100644 --- a/ui-desktop/src/renderer/src/components/dashboard/BalanceBlock.jsx +++ b/ui-desktop/src/renderer/src/components/dashboard/BalanceBlock.jsx @@ -57,38 +57,25 @@ const BalanceBlock = ({ lmrBalanceUSD, ethBalance, ethBalanceUSD, - sendDisabled, - sendDisabledReason, - recaptchaSiteKey, - faucetUrl, - showFaucet, - walletAddress, onTabSwitch, symbol, symbolEth, - client + ...props }) => { const handleTabSwitch = e => { e.preventDefault(); onTabSwitch(e.target.dataset.modal); }; - const claimFaucet = e => { - e.preventDefault(); - const url = new URL(faucetUrl); - url.searchParams.set('address', walletAddress); - window.open(url); - }; - return ( Receive - Send - - - {showFaucet && ( - - Get Tokens - - )} + diff --git a/ui-desktop/src/renderer/src/components/dashboard/Dashboard.jsx b/ui-desktop/src/renderer/src/components/dashboard/Dashboard.jsx index 03c81be7..4bb2fb21 100644 --- a/ui-desktop/src/renderer/src/components/dashboard/Dashboard.jsx +++ b/ui-desktop/src/renderer/src/components/dashboard/Dashboard.jsx @@ -24,19 +24,26 @@ const Dashboard = ({ address, hasTransactions, copyToClipboard, - onWalletRefresh + onWalletRefresh, + onInit }) => { - console.log('dashboard') const [activeModal, setActiveModal] = useState(null) const onCloseModal = () => setActiveModal(null) const onTabSwitch = (modal) => setActiveModal(modal) + const [balanceData, setBalanceData] = useState(null); + + useEffect(() => { + onInit().then(setBalanceData); + }, []) + return ( diff --git a/ui-desktop/src/renderer/src/components/dashboard/tx-list/row/Row.jsx b/ui-desktop/src/renderer/src/components/dashboard/tx-list/row/Row.jsx index 55391cf5..08c4280c 100644 --- a/ui-desktop/src/renderer/src/components/dashboard/tx-list/row/Row.jsx +++ b/ui-desktop/src/renderer/src/components/dashboard/tx-list/row/Row.jsx @@ -29,21 +29,25 @@ const IconContainer = styled.div` width: 40px; `; -const Row = ({ tx, explorerUrl, symbol, symbolEth }) => ( - window.openLink(explorerUrl)}> - - {tx.symbol === 'LMR' ? ( - - ) : ( - - )} - - - - - -
- -); +const Row = ({ tx, explorerUrl, symbol, symbolEth, morAddress }) => { + const morTransaction = tx.isMor; + + return ( + window.openLink(explorerUrl)}> + + {morTransaction ? ( + + ) : ( + + )} + + + + + +
+ + ); +}; export default withTxRowState(Row); diff --git a/ui-desktop/src/renderer/src/components/dashboard/tx-modal/SendForm.jsx b/ui-desktop/src/renderer/src/components/dashboard/tx-modal/SendForm.jsx index 5994c24b..24c7ad90 100644 --- a/ui-desktop/src/renderer/src/components/dashboard/tx-modal/SendForm.jsx +++ b/ui-desktop/src/renderer/src/components/dashboard/tx-modal/SendForm.jsx @@ -68,6 +68,7 @@ const FeeRow = styled.div` display: flex; flex-direction: row; justify-content: space-between; + `; const FeeLabel = styled.div` @@ -137,7 +138,7 @@ const LMR_MODE = 'coinAmount'; const USD_MODE = 'usdAmount'; const selectorStyles = { - control: (base, state) => ({ ...base, borderColor: '#0e4353' }), + control: (base, state) => ({ ...base, borderColor: '#0e4353', width: '100%' }), option: (base, state) => ({ ...base, backgroundColor: state.isSelected ? '#0e4353' : undefined, @@ -219,7 +220,7 @@ export function SendForm(props) { setMode(newMode); props.onAmountInput(sanitize(newAmount)); }; - + return ( <> diff --git a/ui-desktop/src/renderer/src/components/models/ModelsTable.tsx b/ui-desktop/src/renderer/src/components/models/ModelsTable.tsx index 05a20cdc..21479c0f 100644 --- a/ui-desktop/src/renderer/src/components/models/ModelsTable.tsx +++ b/ui-desktop/src/renderer/src/components/models/ModelsTable.tsx @@ -1,131 +1,101 @@ -import React, { useState, useEffect } from 'react'; -import { List as RVList, AutoSizer } from 'react-virtualized'; -import ScanningContractsPlaceholder from '../contracts/contracts-list/ScanningContractsPlaceholder'; -import NoContractsPlaceholder from '../contracts/contracts-list/NoContractsPlaceholder'; -import { ItemFilter } from '../common'; -import Header from '../contracts/contracts-list/Header'; -import ContractsRow from '../contracts/contracts-list/Row'; -import { - Container, - ListContainer, - Contracts, - FooterLogo -} from '../contracts/contracts-list/ContractsList.styles'; -import { ContractsRowContainer } from '../contracts/contracts-list/ContractsRow.styles'; +import { useState, useEffect } from 'react'; +import { withRouter } from 'react-router-dom'; +import withModelsState from "../../store/hocs/withModelsState"; import styled from 'styled-components'; -import { Btn } from '../common'; -function ModelsTable({ - contracts, - syncStatus, - cancel, - deleteContract, - address, - contractsRefresh, - noContractsMessage, - allowSendTransaction, - tabs, - edit, - setEditContractData, - offset, - underProfitContracts, -} : any) { - const [selectedContracts, setSelectedContracts] = useState([]); - const [search, setSearch] = useState(''); - const [sort, setSort] = useState(null); +import Card from 'react-bootstrap/Card'; +import { abbreviateAddress } from '../../utils'; +import { IconDownload } from '@tabler/icons-react'; - const [headerOptions, setHeaderOptions] = useState({}); +const CustomCard = styled(Card)` + background: #244a47!important; + color: #21dc8f!important; + border: 0.5px solid!important; + cursor: pointer!important; - console.log("render"); + p { + color: white!important; + } - let contractsToShow = contracts || []; - - const hasContracts = contractsToShow.length; + .gap-20 { + gap: 20px!important; + } +` - const defaultTabs = [ - { value: 'name', name: 'Name', ratio: 2 }, - { value: 'size', name: 'Size', ratio: 2 }, - { value: 'ipc', name: 'IPC', ratio: 2 }, - ]; +const Container = styled.div` + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 24px; +` - const tabsToShow = tabs || defaultTabs; - const ratio = tabsToShow.map(x => x.ratio); +function ModelCard({ onSelect, model }) { + return ( + onSelect(model.Id)}> + + + {model.Name} + + + {abbreviateAddress(model.Id, 6)} + + {/*
+ Fee: {model.Fee} +
+
+ Stake: {model.Stake} +
*/} +
+ + { + model.Tags.map(t => (
{t}
)) + } +
+
+
+ ); +} - const rowRenderer = (contractsList, ratio, converters) => ({ - key, - index, - style - }) => ( - - - - ); +function ModelsTable({ + getAllModels, + history, + setSelectedModel +} : any) { + const [models, setModels] = useState([{ + "Id": "0x0557d796a4490cb847efa225c610e56921e1aee2cefcd6e3577c5d470b5bbf80", + "IpfsCID": "0x0000000000000000000000000000697066733a2f2f6970667361646472657373", + "Fee": 100, + "Stake": 100, + "Owner": "0xb4b12a69fdbb70b31214d4d3c063752c186ff8de", + "Name": "Llama 3.0", + "Tags": [ + "llama", + "llm", + "chat" + ], + "Timestamp": 1715336698, + "IsDeleted": false +}]); - const filterExtractValue = ({ status }) => status; - return ( - - - - {({ filteredItems }) => ( - -
{}} - onColumnOptionChange={e => - setHeaderOptions({ - ...headerOptions, - [e.type]: e.value - }) - } - activeFilter={null} - tabs={tabsToShow} - /> + const onSelect = (id) => { + console.log("selected", id); + setSelectedModel(models.find(x => x.Id == id)); + history.push("/bids"); + } - - {!hasContracts && - (syncStatus === 'syncing' ? ( - - ) : ( - - ))} - - {({ width, height }) => ( - - )} - - - - - )} - - - - ); + useEffect(() => { + // getAllModels().then(data => { + // console.log("🚀 ~ getAllModels ~ data:", data) + // setModels(data.filter(d => !d.IsDeleted)); + // }); + }, []) + + return ( + { + models.length ? models.map((x => (
{ModelCard({ onSelect, model: x})}
))) : null + } +
) } -export default ModelsTable; +export default withRouter(withModelsState(ModelsTable)); diff --git a/ui-desktop/src/renderer/src/components/onboarding/CopyMnemonicStep.jsx b/ui-desktop/src/renderer/src/components/onboarding/CopyMnemonicStep.jsx index 1cb2af25..230b7087 100644 --- a/ui-desktop/src/renderer/src/components/onboarding/CopyMnemonicStep.jsx +++ b/ui-desktop/src/renderer/src/components/onboarding/CopyMnemonicStep.jsx @@ -12,7 +12,7 @@ const Mnemonic = styled.div` font-weight: 600; line-height: 2; text-align: center; - color: ${p => p.theme.colors.primary}; + color: ${p => p.theme.colors.morMain}; word-spacing: 1.6rem; `; diff --git a/ui-desktop/src/renderer/src/components/onboarding/Onboarding.tsx b/ui-desktop/src/renderer/src/components/onboarding/Onboarding.tsx index 6e3bed41..1814a418 100644 --- a/ui-desktop/src/renderer/src/components/onboarding/Onboarding.tsx +++ b/ui-desktop/src/renderer/src/components/onboarding/Onboarding.tsx @@ -1,13 +1,11 @@ import withOnboardingState from '../../store/hocs/withOnboardingState' import PropTypes from 'prop-types' -import React from 'react' import VerifyMnemonicStep from './VerifyMnemonicStep' import CopyMnemonicStep from './CopyMnemonicStep' import UserMnemonicStep from './UserMnemonicStep' import PasswordStep from './PasswordStep' import TermsStep from './TermsStep' -import ProxyRouterConfigStep from './ProxyRouterConfigStep' const Onboarding = (props) => { const page = () => { @@ -22,8 +20,6 @@ const Onboarding = (props) => { return case 'recover-from-mnemonic': return - case 'config-proxy-router': - return default: return null } diff --git a/ui-desktop/src/renderer/src/components/providers/Providers.css b/ui-desktop/src/renderer/src/components/providers/Providers.css new file mode 100644 index 00000000..cf5860d7 --- /dev/null +++ b/ui-desktop/src/renderer/src/components/providers/Providers.css @@ -0,0 +1,9 @@ +.model-header button { + background: #03160e!important; + color: #20dc8e!important; + font-size: 2rem; +} + +.accordion-item { + background: transparent!important; +} \ No newline at end of file diff --git a/ui-desktop/src/renderer/src/components/providers/Providers.tsx b/ui-desktop/src/renderer/src/components/providers/Providers.tsx new file mode 100644 index 00000000..e0291b3a --- /dev/null +++ b/ui-desktop/src/renderer/src/components/providers/Providers.tsx @@ -0,0 +1,30 @@ +import { useEffect, useState } from 'react' +import { LayoutHeader } from '../common/LayoutHeader' +import { View } from '../common/View' +import ProvidersList from './ProvidersList' +import { withRouter } from 'react-router-dom'; +import { BtnAccent } from '../dashboard/BalanceBlock.styles'; + +import withProvidersState from "../../store/hocs/withProvidersState"; +const Providers = ({ fetchData, providerId }) => { + + const [data, setData] = useState(); + + useEffect(() => { + (async () => { + const data = await fetchData(providerId); + console.log(data); + setData(data); + })() + }, []) + + return ( + + + Add provider + + + ) +} + +export default withRouter(withProvidersState(Providers)); \ No newline at end of file diff --git a/ui-desktop/src/renderer/src/components/providers/ProvidersList.tsx b/ui-desktop/src/renderer/src/components/providers/ProvidersList.tsx new file mode 100644 index 00000000..1e2dfad4 --- /dev/null +++ b/ui-desktop/src/renderer/src/components/providers/ProvidersList.tsx @@ -0,0 +1,117 @@ +import { useState, useEffect } from 'react'; +import { withRouter } from 'react-router-dom'; +import withProvidersState from "../../store/hocs/withProvidersState"; +import styled from 'styled-components'; +import Accordion from 'react-bootstrap/Accordion'; + +import Card from 'react-bootstrap/Card'; +import { abbreviateAddress } from '../../utils'; +import { Btn } from '../../components/common' +import Table from 'react-bootstrap/Table'; +import Button from 'react-bootstrap/Button'; +import './Providers.css' + +const ClaimBtn = styled(Btn)` + background-color: ${p => p.theme.colors.morMain}; + color: black; + font-weight: 600; + border-radius: 5px; +`; + +const CustomCard = styled(Card)` + background: #244a47!important; + color: #21dc8f!important; + border: 0.5px solid!important; + cursor: pointer!important; + + p { + color: white!important; + } + + .gap-20 { + gap: 20px!important; + } +` + +const Container = styled.div` + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 24px; +` + +const BidTable = styled(Table)` + text-align: center!important; + border: 0.5px solid#21dc8f!important; + + th { + background: #244a47!important; + color: #21dc8f!important; + } + + td { + background: #244a47!important; + color: #21dc8f!important; + padding: 12px 0!important + } +` + +const StartBtn = styled(Button)` + background: rgba(0,0,0, 0.9)!important; + border-radius: 0!important; + border: 1px solid #21dc8f!important; +` + + +function renderTable({ onClaim, sessions }) { + return ( + + + + Session + Bid + Status + Balance + + + + + {sessions?.length + ? sessions.map(b => { + // const provider = providers?.find(x => x.Address.toLowerCase() === b.Provider.toLowerCase()); + return ( + + {abbreviateAddress(b.Id, 5)} + {abbreviateAddress(b.BidID, 5)} + {b.ClosedAt ? "CLOSED" : "OPEN"} + {b.Balance / 10 ** 18} MOR + {!b.ClosedAt && onClaim(b.Id)}>Claim} + ) + }) : null} + + + ); +} + + +function ProvidersList({ data, claimFunds }) { + + return (
+ {data?.modelsNames && Object.keys(data?.modelsNames).map(model => { + const modelSessions = data.results.filter(r => r.ModelAgentId.toLowerCase() == model.toLowerCase()); + + return ( + + + {data?.modelsNames[model]} + + {renderTable({ onClaim: claimFunds, sessions: modelSessions})} + + + + ) + })} +
) +} + +export default withRouter(withProvidersState(ProvidersList)); diff --git a/ui-desktop/src/renderer/src/components/sidebar/PrimaryNav.jsx b/ui-desktop/src/renderer/src/components/sidebar/PrimaryNav.jsx index fdc76b23..f6fd9335 100644 --- a/ui-desktop/src/renderer/src/components/sidebar/PrimaryNav.jsx +++ b/ui-desktop/src/renderer/src/components/sidebar/PrimaryNav.jsx @@ -3,8 +3,8 @@ import { NavLink } from 'react-router-dom'; import styled from 'styled-components'; import { IconFileReport, IconMessage } from '@tabler/icons-react'; import { IconBuildingStore } from '@tabler/icons-react'; -import { IconChecklist } from '@tabler/icons-react'; -import { IconWallet, IconMessages, IconPackages, IconUsers } from '@tabler/icons-react'; +import { IconBrandStackshare } from '@tabler/icons-react'; +import { IconWallet, IconPhoto, IconPackages, IconUsers } from '@tabler/icons-react'; const Container = styled.div` display: flex; @@ -19,7 +19,7 @@ const Button = styled(NavLink)` min-height: 6rem; align-items: center; text-decoration: none; - color: ${p => p.theme.colors.inactive}; + color: white; padding: 1.6rem; border-top: 1px solid transparent; @@ -95,7 +95,7 @@ export default function PrimaryNav({ parent, activeIndex, setActiveIndex }) { to="/chat" > - + @@ -103,25 +103,49 @@ export default function PrimaryNav({ parent, activeIndex, setActiveIndex }) { + + + + + + ); } diff --git a/ui-desktop/src/renderer/src/components/sidebar/SecondaryNav.jsx b/ui-desktop/src/renderer/src/components/sidebar/SecondaryNav.jsx index 07c6f189..5f158a19 100644 --- a/ui-desktop/src/renderer/src/components/sidebar/SecondaryNav.jsx +++ b/ui-desktop/src/renderer/src/components/sidebar/SecondaryNav.jsx @@ -4,7 +4,7 @@ import { withClient } from '../../store/hocs/clientContext'; import { NavLink } from 'react-router-dom'; import styled from 'styled-components'; import { IconPlugConnected } from '@tabler/icons-react'; -import { IconCpu2 } from '@tabler/icons-react'; +import { IconSettings } from '@tabler/icons-react'; import { IconHelp } from '@tabler/icons-react'; import { IconTools } from '@tabler/icons-react'; @@ -43,7 +43,6 @@ const HelpLink = styled.span` text-decoration: none; color: ${p => p.theme.colors.morMain}; padding: 1.6rem; - border-top: 1px solid rgba(255, 255, 255, 0.16); cursor: pointer; &:focus { @@ -136,18 +135,21 @@ function SecondaryNav({ + */} + */} + + + diff --git a/ui-desktop/src/renderer/src/store/hocs/withBidsState.jsx b/ui-desktop/src/renderer/src/store/hocs/withBidsState.jsx new file mode 100644 index 00000000..9cdd0cad --- /dev/null +++ b/ui-desktop/src/renderer/src/store/hocs/withBidsState.jsx @@ -0,0 +1,119 @@ +import * as validators from '../validators'; +import { withClient } from './clientContext'; +import * as utils from '../utils'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import React from 'react'; +import { ToastsContext } from '../../components/toasts'; +import selectors from '../selectors'; + +const withBidsState = WrappedComponent => { + class Container extends React.Component { + + static contextType = ToastsContext; + + static displayName = `withBidsState(${WrappedComponent.displayName || + WrappedComponent.name})`; + + getBitsByModels = async (modelId) => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/models/${modelId}/bids` + const response = await fetch(path); + const data = await response.json(); + return data.bids; + } + catch (e) { + console.log("Error", e) + return []; + } + } + + getProviders = async () => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/providers` + const response = await fetch(path); + const data = await response.json(); + return data.providers; + } + catch (e) { + console.log("Error", e) + return []; + } + } + + setBid = async (data) => { + let signature = ''; + let sessionId = ''; + + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/proxy/sessions/initiate`; + const body = { + user: this.props.address, + provider: data.provider.Address, + spend: 10, + providerUrl: data.provider.Endpoint.replace("http://", "") + }; + const response = await fetch(path, { + method: "POST", + body: JSON.stringify(body) + }); + const dataResponse = await response.json(); + signature = dataResponse.response.result.message; + } + catch (e) { + console.log("Error", e) + return false; + } + + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/sessions`; + const body = { + bidId: data.bidId, + stake: "380925328193836900000", // TEMP ISSUE SOLVER + }; + const response = await fetch(path, { + method: "POST", + body: JSON.stringify(body) + }); + const dataResponse = await response.json(); + sessionId = dataResponse.sessionId; + } + catch (e) { + console.log("Error", e) + return false; + } + + this.props.setBidState(data); + this.props.setActiveSession({ sessionId: sessionId, signature: signature }); + return true; + } + + render() { + + return ( + + ); + } + } + + const mapStateToProps = (state, props) => ({ + address: selectors.getWalletAddress(state), + config: state.config, + selectedModel: state.models.selectedModel + }); + + const mapDispatchToProps = dispatch => ({ + setBidState: model => dispatch({ type: 'set-bid', payload: model }), + setActiveSession: sessionModel => dispatch({ type: 'set-active-session', payload: sessionModel }) + }); + + return withClient(connect(mapStateToProps, mapDispatchToProps)(Container)); +}; + +export default withBidsState; diff --git a/ui-desktop/src/renderer/src/store/hocs/withChatState.jsx b/ui-desktop/src/renderer/src/store/hocs/withChatState.jsx new file mode 100644 index 00000000..dcc2d220 --- /dev/null +++ b/ui-desktop/src/renderer/src/store/hocs/withChatState.jsx @@ -0,0 +1,208 @@ +import * as validators from '../validators'; +import { withClient } from './clientContext'; +import * as utils from '../utils'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import React from 'react'; +import { ToastsContext } from '../../components/toasts'; +import selectors from '../selectors'; + +const withChatState = WrappedComponent => { + class Container extends React.Component { + + static contextType = ToastsContext; + + static displayName = `withChatState(${WrappedComponent.displayName || + WrappedComponent.name})`; + + getBitsByModels = async (modelId) => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/models/${modelId}/bids` + const response = await fetch(path); + const data = await response.json(); + return data.bids; + } + catch(e) { + console.log("Error", e) + return []; + } + } + + getProviders = async () => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/providers` + const response = await fetch(path); + const data = await response.json(); + return data.providers; + } + catch(e) { + console.log("Error", e) + return []; + } + } + + closeSession = async (sessionId) => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/sessions/${sessionId}/close`; + const response = await fetch(path, { + method: "POST" + }); + const data = await response.json(); + return data.success; + } + catch(e) { + console.log("Error", e) + return []; + } + } + + getAllModels = async () => { + const result = await this.props.client.getAllModels(); + return result; + } + + getModelsData = async () => { + const models = (await this.getAllModels()).filter(m => !m.IsDeleted); + const providers = (await this.getProviders()).filter(m => !m.IsDeleted); + const providersMap = providers.reduce((a,b) => ({...a, [b.Address.toLowerCase()]: b}), {}); + let result = []; + + for (const model of models) { + const id = model.Id; + const bids = (await this.getBitsByModels(id)).filter(b => !b.DeletedAt); + if(!bids.length) { + continue; + } + + const bidsWithProviders = bids.map(b => ({...b, ProviderData: providersMap[b.Provider.toLowerCase()], Model: model})) + + result.push({...model, bids: model.Name == "Llama 2.0" ? [...bidsWithProviders, { Provider: "Local", Model: model}] : bidsWithProviders }) + } + + return { models: result, providers } + } + + + getMetaInfo = async () => { + var budget = await this.props.client.getTodaysBudget(); + var supply = await this.props.client.getTokenSupply(); + return { budget, supply }; + } + + getSessionsByUser = async (user) => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/sessions?user=${user}`; + const response = await fetch(path); + const data = await response.json(); + return data.sessions; + } + catch(e) { + console.log("Error", e) + return []; + } + } + + onOpenSession = async ({ selectedBid, stake }) => { + console.log("open-session", stake); + + let signature = {}; + let sessionId = ''; + + debugger; + const bidId = selectedBid.Id; + + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/proxy/sessions/initiate`; + const body = { + user: this.props.address, + provider: selectedBid.Provider, + spend: Number(stake), + bidId, + providerUrl: selectedBid.ProviderData.Endpoint.replace("http://", "") + }; + const response = await fetch(path, { + method: "POST", + body: JSON.stringify(body) + }); + const dataResponse = await response.json(); + signature = dataResponse.response.result; + } + catch (e) { + console.log("Error", e) + return false; + } + + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/approve?amount=${BigInt(stake).toString()}&spender=${this.props.config.chain.diamondAddress}`; + const response = await fetch(path, { + method: "POST", + }); + const dataResponse = await response.json(); + console.log("Increase", dataResponse) + } + catch (e) { + console.log("Error", e) + return false; + } + + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/sessions`; + const body = { + approval: signature.approval, + approvalSig: signature.approvalSig, + stake: BigInt(stake).toString(), + }; + const response = await fetch(path, { + method: "POST", + body: JSON.stringify(body) + }); + const dataResponse = await response.json(); + sessionId = dataResponse.sessionId; + } + catch (e) { + console.log("Error", e) + return false; + } + + return { sessionId, signature }; + } + + render() { + + return ( + + ); + } + } + + const mapStateToProps = (state, props) => ({ + // selectedCurrency: selectors.getSellerSelectedCurrency(state), + // isLocalProxyRouter: selectors.getIsLocalProxyRouter(state), + // titanLightningPool: state.config.chain.titanLightningPool, + // titanLightningDashboard: state.config.chain.titanLightningDashboard, + config: state.config, + selectedBid: state.models.selectedBid, + model: state.models.selectedModel, + provider: state.models.selectedProvider, + activeSession: state.models.activeSession, + address: selectors.getWalletAddress(state), + }); + + const mapDispatchToProps = dispatch => ({ + setBid: model => dispatch({ type: 'set-bid', payload: model }) + }); + + return withClient(connect(mapStateToProps, mapDispatchToProps)(Container)); +}; + +export default withChatState; diff --git a/ui-desktop/src/renderer/src/store/hocs/withDashboardState.jsx b/ui-desktop/src/renderer/src/store/hocs/withDashboardState.jsx index 169ed92a..f61af395 100644 --- a/ui-desktop/src/renderer/src/store/hocs/withDashboardState.jsx +++ b/ui-desktop/src/renderer/src/store/hocs/withDashboardState.jsx @@ -49,6 +49,13 @@ const withDashboardState = WrappedComponent => { }); }; + onInit = async () => { + var balances = await this.props.client.getBalances(); + var transactions = await this.props.client.getTransactions(); + var rate = await this.props.client.getRates(); + return { balances, transactions, rate }; + } + render() { const { sendLmrFeatureStatus } = this.props; @@ -64,6 +71,7 @@ const withDashboardState = WrappedComponent => { sendDisabledReason={sendDisabledReason} copyToClipboard={this.props.client.copyToClipboard} onWalletRefresh={this.onWalletRefresh} + onInit={this.onInit} sendDisabled={sendLmrFeatureStatus !== 'ok'} {...this.props} {...this.state} diff --git a/ui-desktop/src/renderer/src/store/hocs/withModelsState.jsx b/ui-desktop/src/renderer/src/store/hocs/withModelsState.jsx new file mode 100644 index 00000000..745b892c --- /dev/null +++ b/ui-desktop/src/renderer/src/store/hocs/withModelsState.jsx @@ -0,0 +1,68 @@ +import * as validators from '../validators'; +import { withClient } from './clientContext'; +import * as utils from '../utils'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import React from 'react'; +import { ToastsContext } from '../../components/toasts'; +import selectors from '../selectors'; + +const withModelsState = WrappedComponent => { + class Container extends React.Component { + + static contextType = ToastsContext; + + static displayName = `withModelsState(${WrappedComponent.displayName || + WrappedComponent.name})`; + + getAllModels = async () => { + const result = await this.props.client.getAllModels(); + return result; + } + + getAllProviders = async () => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/providers` + const response = await fetch(path); + const data = await response.json(); + return data.providers; + } + catch(e) { + console.log("Error", e) + return []; + } + } + + getBitsByModels = async (modelId) => { + + } + + render() { + + return ( + + ); + } + } + + const mapStateToProps = (state, props) => ({ + // selectedCurrency: selectors.getSellerSelectedCurrency(state), + // isLocalProxyRouter: selectors.getIsLocalProxyRouter(state), + // titanLightningPool: state.config.chain.titanLightningPool, + // titanLightningDashboard: state.config.chain.titanLightningDashboard, + config: state.config + }); + + const mapDispatchToProps = dispatch => ({ + setSelectedModel: model => dispatch({ type: 'set-model', payload: model }) + }); + + return withClient(connect(mapStateToProps, mapDispatchToProps)(Container)); +}; + +export default withModelsState; diff --git a/ui-desktop/src/renderer/src/store/hocs/withOnboardingState.jsx b/ui-desktop/src/renderer/src/store/hocs/withOnboardingState.jsx index d8afcfac..ef7a9881 100644 --- a/ui-desktop/src/renderer/src/store/hocs/withOnboardingState.jsx +++ b/ui-desktop/src/renderer/src/store/hocs/withOnboardingState.jsx @@ -126,7 +126,8 @@ const withOnboardingState = WrappedComponent => { if (Object.keys(errors).length > 0) return this.setState({ errors }); - return this.setState({ isMnemonicVerified: true }); + this.setState({ isMnemonicVerified: true }); + this.onFinishOnboarding(); }; validateDefaultPoolAddress() { @@ -141,49 +142,11 @@ const withOnboardingState = WrappedComponent => { return true; } - onProxyRouterConfigured = e => { + // HERE + onFinishOnboarding = e => { if (e && e.preventDefault) e.preventDefault(); - if (this.state.isTitanLightning) { - if (!EMAIL_REGEX.test(this.state.lightningAddress)) { - const newErrors = this.state.errors; - newErrors.lightningAddress = 'Invalid email'; - this.setState({ errors: newErrors }); - return; - } - const poolUrl = generatePoolUrl( - this.state.lightningAddress, - this.props.config.chain.titanLightningPool - ); - - return this.props.onOnboardingCompleted({ - proxyRouterConfig: { - sellerDefaultPool: poolUrl, - buyerDefaultPool: poolUrl, - isTitanLightning: true - }, - password: this.state.password, - mnemonic: this.state.useUserMnemonic - ? utils.sanitizeMnemonic(this.state.userMnemonic) - : this.state.mnemonic - }); - } - - const isValid = this.validateDefaultPoolAddress(); - if (!isValid) { - return; - } - - const defaultPool = toRfc2396( - this.state.proxyDefaultPool, - this.state.proxyPoolUsername - ); - return this.props.onOnboardingCompleted({ - proxyRouterConfig: { - sellerDefaultPool: defaultPool, - buyerDefaultPool: defaultPool - }, password: this.state.password, mnemonic: this.state.useUserMnemonic ? utils.sanitizeMnemonic(this.state.userMnemonic) @@ -247,7 +210,6 @@ const withOnboardingState = WrappedComponent => { shouldSubmit={shouldSubmit} currentStep={this.getCurrentStep()} getTooltip={getTooltip} - onProxyRouterConfigured={this.onProxyRouterConfigured} onRunWithoutProxyRouter={this.onRunWithoutProxyRouter} {...this.state} /> diff --git a/ui-desktop/src/renderer/src/store/hocs/withProvidersState.jsx b/ui-desktop/src/renderer/src/store/hocs/withProvidersState.jsx new file mode 100644 index 00000000..b99fcb9a --- /dev/null +++ b/ui-desktop/src/renderer/src/store/hocs/withProvidersState.jsx @@ -0,0 +1,132 @@ +import * as validators from '../validators'; +import { withClient } from './clientContext'; +import * as utils from '../utils'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import React from 'react'; +import { ToastsContext } from '../../components/toasts'; +import selectors from '../selectors'; + +const withProvidersState = WrappedComponent => { + class Container extends React.Component { + + static contextType = ToastsContext; + + static displayName = `withProvidersState(${WrappedComponent.displayName || + WrappedComponent.name})`; + + getAllModels = async () => { + const result = await this.props.client.getAllModels(); + return result; + } + + getAllProviders = async () => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/providers` + const response = await fetch(path); + const data = await response.json(); + return data.providers; + } + catch(e) { + console.log("Error", e) + return []; + } + } + + getSessionsByProvider = async (provider) => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/blockchain/sessions?provider=${provider}`; + const response = await fetch(path); + const data = await response.json(); + return data.sessions; + } + catch(e) { + console.log("Error", e) + return []; + } + } + + getBalanceBySession = async (sessionId) => { + try { + const path = `${this.props.config.chain.localProxyRouterUrl}/proxy/sessions/${sessionId}/providerClaimableBalance` + const response = await fetch(path); + const data = await response.json(); + return data.balance; + } + catch(e) { + console.log("Error", e) + return []; + } + } + + claimFunds = async (sessionId) => { + try { + const path = `${props.config.chain.localProxyRouterUrl}/proxy/sessions/${sessionId}/providerClaim`; + const response = await fetch(path, { + method: "POST", + }); + const dataResponse = await response.json(); + } + catch(e) { + console.log("Error", e) + } + } + + fetchData = async (providerId) => { + const models = await this.getAllModels(); + // const providers = await getAllProviders(); + const providerSession = await this.getSessionsByProvider(providerId); + const modelsNames = models.reduce((a,b) => ({ ...a, [b.Id]: b.Name}), {}); + + let results = []; + for (const session of providerSession) { + const id = session.Id; + let balance = 0; + try { + if(!session.ClosedAt) { + balance = (await this.getBalanceBySession(id)); + } + } + catch(e) { + console.log(e); + } + results.push({ ...session, Balance: balance }) + } + + return { results, modelsNames }; + } + + render() { + + return ( + + ); + } + } + + const mapStateToProps = (state, props) => ({ + // selectedCurrency: selectors.getSellerSelectedCurrency(state), + // isLocalProxyRouter: selectors.getIsLocalProxyRouter(state), + // titanLightningPool: state.config.chain.titanLightningPool, + // titanLightningDashboard: state.config.chain.titanLightningDashboard, + providerId: selectors.getWalletAddress(state), + config: state.config + }); + + const mapDispatchToProps = dispatch => ({ + setSelectedModel: model => dispatch({ type: 'set-model', payload: model }) + }); + + return withClient(connect(mapStateToProps, mapDispatchToProps)(Container)); +}; + +export default withProvidersState; diff --git a/ui-desktop/src/renderer/src/store/hocs/withSendLMRFormState.jsx b/ui-desktop/src/renderer/src/store/hocs/withSendLMRFormState.jsx index d18a0300..891c5372 100644 --- a/ui-desktop/src/renderer/src/store/hocs/withSendLMRFormState.jsx +++ b/ui-desktop/src/renderer/src/store/hocs/withSendLMRFormState.jsx @@ -9,7 +9,7 @@ import React, { useState } from 'react'; const withSendLMRFormState = Component => { const WrappedComponent = ({ lmrDefaultGasLimit, - lmrTokenAddress, + mainTokenAddress, chainGasPrice, availableLMR, walletId, @@ -18,7 +18,7 @@ const withSendLMRFormState = Component => { }) => { const props = { lmrDefaultGasLimit, - lmrTokenAddress, + mainTokenAddress, chainGasPrice, availableLMR, walletId, @@ -76,7 +76,7 @@ const withSendLMRFormState = Component => { client .getTokenGasLimit({ value: client.toWei(utils.sanitize(inputs.lmrAmount)), - token: lmrTokenAddress, + token: mainTokenAddress, chain, from, to: inputs.toAddress @@ -141,7 +141,7 @@ const withSendLMRFormState = Component => { const mapStateToProps = state => ({ lmrDefaultGasLimit: selectors.getChainConfig(state).lmrDefaultGasLimit, - lmrTokenAddress: selectors.getChainConfig(state).lmrTokenAddress, + mainTokenAddress: selectors.getChainConfig(state).mainTokenAddress, chainGasPrice: selectors.getChainGasPrice(state), availableLMR: selectors.getLmrBalanceWei(state), from: selectors.getWalletAddress(state), diff --git a/ui-desktop/src/renderer/src/store/hocs/withTxRowState.jsx b/ui-desktop/src/renderer/src/store/hocs/withTxRowState.jsx index 65f3ef16..42d67878 100644 --- a/ui-desktop/src/renderer/src/store/hocs/withTxRowState.jsx +++ b/ui-desktop/src/renderer/src/store/hocs/withTxRowState.jsx @@ -28,7 +28,8 @@ const withTxRowState = WrappedComponent => { hash: props.tx.hash }), symbol: selectors.getCoinSymbol(state), - symbolEth: selectors.getSymbolEth(state) + symbolEth: selectors.getSymbolEth(state), + morAddress: state.config.chain.diamondAddress }); return connect(mapStateToProps)(Container); diff --git a/ui-desktop/src/renderer/src/store/reducers/index.jsx b/ui-desktop/src/renderer/src/store/reducers/index.jsx index f5a37dab..6581f109 100644 --- a/ui-desktop/src/renderer/src/store/reducers/index.jsx +++ b/ui-desktop/src/renderer/src/store/reducers/index.jsx @@ -7,6 +7,7 @@ import proxyRouter from './proxy-router'; import contracts from './contracts'; import meta from './meta'; import devices from './devices'; +import models from './models'; export default combineReducers({ connectivity, @@ -15,6 +16,7 @@ export default combineReducers({ chain, proxyRouter, contracts, - devices + devices, + models // meta }); diff --git a/ui-desktop/src/renderer/src/store/reducers/models.jsx b/ui-desktop/src/renderer/src/store/reducers/models.jsx new file mode 100644 index 00000000..307b5385 --- /dev/null +++ b/ui-desktop/src/renderer/src/store/reducers/models.jsx @@ -0,0 +1,29 @@ +import { handleActions } from 'redux-actions'; + +const initialState = { + selectedModel: null, + selectedBid: null, + selectedProvider: null, + activeSession: null +}; + +const reducer = handleActions( + { + 'set-model': (state, { payload }) => ({ + ...state, + selectedModel: payload + }), + 'set-bid': (state, { payload }) => ({ + ...state, + selectedBid: payload.bidId, + selectedProvider: payload.provider + }), + 'set-active-session': (state, { payload }) => ({ + ...state, + activeSession: payload, + }), + }, + initialState +); + +export default reducer; diff --git a/ui-desktop/src/renderer/src/store/utils/createTransactionParser.jsx b/ui-desktop/src/renderer/src/store/utils/createTransactionParser.jsx index 11d804a6..4cbd1217 100644 --- a/ui-desktop/src/renderer/src/store/utils/createTransactionParser.jsx +++ b/ui-desktop/src/renderer/src/store/utils/createTransactionParser.jsx @@ -127,7 +127,7 @@ export const createTransactionParser = myAddress => rawTx => { const timestamp = getTimestamp(rawTx, txType); const symbol = getSymbol(rawTx, tokenData, txType); const value = getValue(rawTx, tokenData, txType); - + return { contractCallFailed: getContractCallFailed(rawTx), isCancelApproval: getIsCancelApproval(tokenData), @@ -141,13 +141,13 @@ export const createTransactionParser = myAddress => rawTx => { gasUsed: getGasUsed(rawTx), txType, symbol, - value: - symbol === 'LMR' - ? fromTokenBaseUnitsToLMR(value) - : fromTokenBaseUnitsToETH(value), + value:(value / 10 ** 18), + // rawTx?.transaction?.isMor + // ? fromTokenBaseUnitsToLMR(value) from: getFrom(rawTx, tokenData, txType), hash: getTransactionHash(rawTx), meta: rawTx.meta, - to: getTo(rawTx, tokenData, txType) + to: getTo(rawTx, tokenData, txType), + isMor: rawTx?.transaction?.isMor }; }; diff --git a/ui-desktop/src/renderer/src/utils/coinValue.jsx b/ui-desktop/src/renderer/src/utils/coinValue.jsx index 7426728f..b7f1c89a 100644 --- a/ui-desktop/src/renderer/src/utils/coinValue.jsx +++ b/ui-desktop/src/renderer/src/utils/coinValue.jsx @@ -1,4 +1,4 @@ -export const lmrDecimals = 10 ** 8; +export const lmrDecimals = 10 ** 18; export const ethDecimals = 10 ** 18; export const fromTokenBaseUnitsToLMR = baseUnits => baseUnits / lmrDecimals; diff --git a/ui-desktop/yarn.lock b/ui-desktop/yarn.lock index 6c65f125..aa6f3b29 100644 --- a/ui-desktop/yarn.lock +++ b/ui-desktop/yarn.lock @@ -7,11 +7,6 @@ resolved "https://registry.yarnpkg.com/7zip-bin/-/7zip-bin-5.2.0.tgz#7a03314684dd6572b7dfa89e68ce31d60286854d" integrity sha512-ukTPVhqG4jNzMro2qA9HSCSSVJN3aN7tlb+hfqYCt3ER0yWroeA2VR38MNrOHLQ/cVj+DaIMad0kFCtWWowh/A== -"@aashutoshrathi/word-wrap@^1.2.3": - version "1.2.6" - resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" - integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== - "@ampproject/remapping@^2.2.0": version "2.3.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" @@ -27,48 +22,48 @@ dependencies: tslib "^2.2.0" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" - integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.2": + version "7.24.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" + integrity sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ== dependencies: - "@babel/highlight" "^7.23.4" - chalk "^2.4.2" + "@babel/highlight" "^7.24.2" + picocolors "^1.0.0" "@babel/compat-data@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" - integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== + version "7.24.4" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.4.tgz#6f102372e9094f25d908ca0d34fc74c74606059a" + integrity sha512-vg8Gih2MLK+kOkHJp4gBEIkyaIi00jgWot2D9QOmmfLC8jINSOzmCLta6Bvz/JSBCqnegV0L80jhxkol5GWNfQ== "@babel/core@^7.21.3", "@babel/core@^7.23.5": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.0.tgz#56cbda6b185ae9d9bed369816a8f4423c5f2ff1b" - integrity sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw== + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.5.tgz#15ab5b98e101972d171aeef92ac70d8d6718f06a" + integrity sha512-tVQRucExLQ02Boi4vdPp49svNGcfL2GhdTCT9aldhXgCJVAI21EtRfBettiuLUwce/7r6bFdgs6JFkcdTiFttA== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.23.5" - "@babel/generator" "^7.23.6" + "@babel/code-frame" "^7.24.2" + "@babel/generator" "^7.24.5" "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helpers" "^7.24.0" - "@babel/parser" "^7.24.0" + "@babel/helper-module-transforms" "^7.24.5" + "@babel/helpers" "^7.24.5" + "@babel/parser" "^7.24.5" "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.0" - "@babel/types" "^7.24.0" + "@babel/traverse" "^7.24.5" + "@babel/types" "^7.24.5" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" - integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== +"@babel/generator@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.5.tgz#e5afc068f932f05616b66713e28d0f04e99daeb3" + integrity sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA== dependencies: - "@babel/types" "^7.23.6" - "@jridgewell/gen-mapping" "^0.3.2" - "@jridgewell/trace-mapping" "^0.3.17" + "@babel/types" "^7.24.5" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" "@babel/helper-annotate-as-pure@^7.22.5": @@ -109,120 +104,114 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.22.15", "@babel/helper-module-imports@^7.22.5": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" - integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== +"@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.22.5", "@babel/helper-module-imports@^7.24.3": + version "7.24.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz#6ac476e6d168c7c23ff3ba3cf4f7841d46ac8128" + integrity sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg== dependencies: - "@babel/types" "^7.22.15" + "@babel/types" "^7.24.0" -"@babel/helper-module-transforms@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" - integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== +"@babel/helper-module-transforms@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.24.5.tgz#ea6c5e33f7b262a0ae762fd5986355c45f54a545" + integrity sha512-9GxeY8c2d2mdQUP1Dye0ks3VDyIMS98kt/llQ2nUId8IsWqTF0l1LkSX0/uP7l7MCDrzXS009Hyhe2gzTiGW8A== dependencies: "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-module-imports" "^7.22.15" - "@babel/helper-simple-access" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-module-imports" "^7.24.3" + "@babel/helper-simple-access" "^7.24.5" + "@babel/helper-split-export-declaration" "^7.24.5" + "@babel/helper-validator-identifier" "^7.24.5" -"@babel/helper-plugin-utils@^7.22.5": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz#945681931a52f15ce879fd5b86ce2dae6d3d7f2a" - integrity sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w== +"@babel/helper-plugin-utils@^7.24.0", "@babel/helper-plugin-utils@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.5.tgz#a924607dd254a65695e5bd209b98b902b3b2f11a" + integrity sha512-xjNLDopRzW2o6ba0gKbkZq5YWEBaK3PCyTOY1K2P/O07LGMhMqlMXPxwN4S5/RhWuCobT8z0jrlKGlYmeR1OhQ== -"@babel/helper-simple-access@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" - integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== +"@babel/helper-simple-access@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.5.tgz#50da5b72f58c16b07fbd992810be6049478e85ba" + integrity sha512-uH3Hmf5q5n7n8mz7arjUlDOCbttY/DW4DYhE6FUsjKJ/oYC1kQQUvwEQWxRwUpX9qQKRXeqLwWxrqilMrf32sQ== dependencies: - "@babel/types" "^7.22.5" + "@babel/types" "^7.24.5" -"@babel/helper-split-export-declaration@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" - integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== +"@babel/helper-split-export-declaration@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.5.tgz#b9a67f06a46b0b339323617c8c6213b9055a78b6" + integrity sha512-5CHncttXohrHk8GWOFCcCl4oRD9fKosWlIRgWm4ql9VYioKm52Mk2xsmoohvm7f3JoiLSM5ZgJuRaf5QZZYd3Q== dependencies: - "@babel/types" "^7.22.5" + "@babel/types" "^7.24.5" -"@babel/helper-string-parser@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" - integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== +"@babel/helper-string-parser@^7.24.1": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz#f99c36d3593db9540705d0739a1f10b5e20c696e" + integrity sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ== -"@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== +"@babel/helper-validator-identifier@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz#918b1a7fa23056603506370089bd990d8720db62" + integrity sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA== "@babel/helper-validator-option@^7.23.5": version "7.23.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== -"@babel/helpers@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.0.tgz#a3dd462b41769c95db8091e49cfe019389a9409b" - integrity sha512-ulDZdc0Aj5uLc5nETsa7EPx2L7rM0YJM8r7ck7U73AXi7qOV44IHHRAYZHY6iU1rr3C5N4NtTmMRUJP6kwCWeA== +"@babel/helpers@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.5.tgz#fedeb87eeafa62b621160402181ad8585a22a40a" + integrity sha512-CiQmBMMpMQHwM5m01YnrM6imUG1ebgYJ+fAIW4FZe6m4qHTPaRHti+R8cggAwkdz4oXhtO4/K9JWlh+8hIfR2Q== dependencies: "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.0" - "@babel/types" "^7.24.0" + "@babel/traverse" "^7.24.5" + "@babel/types" "^7.24.5" -"@babel/highlight@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" - integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== +"@babel/highlight@^7.24.2": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.5.tgz#bc0613f98e1dd0720e99b2a9ee3760194a704b6e" + integrity sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw== dependencies: - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-validator-identifier" "^7.24.5" chalk "^2.4.2" js-tokens "^4.0.0" + picocolors "^1.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.0.tgz#26a3d1ff49031c53a97d03b604375f028746a9ac" - integrity sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg== +"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.24.0", "@babel/parser@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.5.tgz#4a4d5ab4315579e5398a82dcf636ca80c3392790" + integrity sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg== "@babel/plugin-syntax-jsx@^7.22.5": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz#8f2e4f8a9b5f9aa16067e142c1ac9cd9f810f473" - integrity sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg== + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.1.tgz#3f6ca04b8c841811dbc3c5c5f837934e0d626c10" + integrity sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.0" "@babel/plugin-transform-arrow-functions@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.23.3.tgz#94c6dcfd731af90f27a79509f9ab7fb2120fc38b" - integrity sha512-NzQcQrzaQPkaEwoTm4Mhyl8jI1huEL/WWIEvudjTCMJ9aBZNpsJbMASx7EQECtQQPS/DcnFpo0FIh3LvEO9cxQ== + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.1.tgz#2bf263617060c9cc45bcdbf492b8cc805082bf27" + integrity sha512-ngT/3NkRhsaep9ck9uj2Xhv9+xB1zShY3tM3g6om4xxCELwCDN4g4Aq5dRn48+0hasAql7s2hdBOysCfNpr4fw== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.0" "@babel/plugin-transform-react-jsx-self@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.23.3.tgz#ed3e7dadde046cce761a8e3cf003a13d1a7972d9" - integrity sha512-qXRvbeKDSfwnlJnanVRp0SfuWE5DQhwQr5xtLBzp56Wabyo+4CMosF6Kfp+eOD/4FYpql64XVJ2W0pVLlJZxOQ== + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.24.5.tgz#22cc7572947895c8e4cd034462e65d8ecf857756" + integrity sha512-RtCJoUO2oYrYwFPtR1/jkoBEcFuI1ae9a9IMxeyAVa3a1Ap4AnxmyIKG2b2FaJKqkidw/0cxRbWN+HOs6ZWd1w== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.5" "@babel/plugin-transform-react-jsx-source@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.23.3.tgz#03527006bdc8775247a78643c51d4e715fe39a3e" - integrity sha512-91RS0MDnAWDNvGC6Wio5XYkyWI39FMFO+JK9+4AlgaTH+yWwVTsw7/sn6LK0lH7c5F+TFkpv/3LfCJ1Ydwof/g== + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.24.1.tgz#a2dedb12b09532846721b5df99e52ef8dc3351d0" + integrity sha512-1v202n7aUq4uXAieRTKcwPzNyphlCuqHHDcdSNc+vdhoTEZcFMh+L5yZuCmGaIO7bs1nJUNfHB89TZyoL48xNA== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.0" -"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.0.tgz#584c450063ffda59697021430cb47101b085951e" - integrity sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw== - dependencies: - regenerator-runtime "^0.14.0" - -"@babel/runtime@^7.20.13": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.4.tgz#de795accd698007a66ba44add6cc86542aff1edd" - integrity sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA== +"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.13", "@babel/runtime@^7.21.0", "@babel/runtime@^7.22.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.5.tgz#230946857c053a36ccc66e1dd03b17dd0c4ed02c" + integrity sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g== dependencies: regenerator-runtime "^0.14.0" @@ -235,29 +224,29 @@ "@babel/parser" "^7.24.0" "@babel/types" "^7.24.0" -"@babel/traverse@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.0.tgz#4a408fbf364ff73135c714a2ab46a5eab2831b1e" - integrity sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw== +"@babel/traverse@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.5.tgz#972aa0bc45f16983bf64aa1f877b2dd0eea7e6f8" + integrity sha512-7aaBLeDQ4zYcUFDUD41lJc1fG8+5IU9DaNSJAgal866FGvmD5EbWQgnEC6kO1gGLsX0esNkfnJSndbTXA3r7UA== dependencies: - "@babel/code-frame" "^7.23.5" - "@babel/generator" "^7.23.6" + "@babel/code-frame" "^7.24.2" + "@babel/generator" "^7.24.5" "@babel/helper-environment-visitor" "^7.22.20" "@babel/helper-function-name" "^7.23.0" "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.24.0" - "@babel/types" "^7.24.0" + "@babel/helper-split-export-declaration" "^7.24.5" + "@babel/parser" "^7.24.5" + "@babel/types" "^7.24.5" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.21.3", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.6", "@babel/types@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf" - integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.21.3", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.24.0", "@babel/types@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.5.tgz#7661930afc638a5383eb0c4aee59b74f38db84d7" + integrity sha512-6mQNsaLeXTw0nxYUYu+NSa4Hx4BlF1x1x8/PMFbiR+GBSr+2DkECc69b8hgy2frEodNcvPffeH8YfWd3LI6jhQ== dependencies: - "@babel/helper-string-parser" "^7.23.4" - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-string-parser" "^7.24.1" + "@babel/helper-validator-identifier" "^7.24.5" to-fast-properties "^2.0.0" "@develar/schema-utils@~2.6.5": @@ -285,9 +274,9 @@ "@typescript-eslint/parser" "^6.14.0" "@electron-toolkit/preload@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@electron-toolkit/preload/-/preload-3.0.0.tgz#34a801a7038e80fa7dd41cd5d114ce5b0ae3ffc4" - integrity sha512-DTyvNGits43J1RiQGFN00/OxjjcTcozLWMjgQBANt97FFptEYiLVasq7kMC24nMwwoOpdDYY9CE6C+4wQJ55/w== + version "3.0.1" + resolved "https://registry.yarnpkg.com/@electron-toolkit/preload/-/preload-3.0.1.tgz#8bae193fd851f3d38c56eec13a5dd602744e8064" + integrity sha512-EzoQmpK8jqqU8YnM5jRe0GJjGVJPke2KtANqz8QtN2JPT96ViOvProBdK5C6riCm0j1T8jjAGVQCZLQy9OVoIA== "@electron-toolkit/tsconfig@^1.0.1": version "1.0.1" @@ -300,9 +289,9 @@ integrity sha512-GaXHDhiT7KCvMJjXdp/QqpYinq69T/Pdl49Z1XLf8mKGf63dnsODMWyrmIjEQ0z/vG7dO8qF3fvmI6Eb2lUNZA== "@electron/asar@^3.2.1": - version "3.2.9" - resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.9.tgz#7b3a1fd677b485629f334dd80ced8c85353ba7e7" - integrity sha512-Vu2P3X2gcZ3MY9W7yH72X9+AMXwUQZEJBrsPIbX0JsdllLtoh62/Q8Wg370/DawIEVKOyfD6KtTLo645ezqxUA== + version "3.2.10" + resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.10.tgz#615cf346b734b23cafa4e0603551010bd0e50aa8" + integrity sha512-mvBSwIBUeiRscrCeJE1LwctAriBj65eUDm0Pc11iE5gRwzkmsdbS7FnZ1XUWjpSeQWL1L5g12Fc/SchPM9DUOw== dependencies: commander "^5.0.0" glob "^7.1.6" @@ -427,9 +416,9 @@ hoist-non-react-statics "^3.3.1" "@emotion/serialize@^1.1.2", "@emotion/serialize@^1.1.3": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-1.1.3.tgz#84b77bfcfe3b7bb47d326602f640ccfcacd5ffb0" - integrity sha512-iD4D6QVZFDhcbH0RAG1uVu1CwVLMWUkCvAqqlewO/rxf8+87yIBAlt4+AxMiiKPLs5hFc0owNk/sLLAOROw3cA== + version "1.1.4" + resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-1.1.4.tgz#fc8f6d80c492cfa08801d544a05331d1cc7cd451" + integrity sha512-RIN04MBT8g+FnDwgvIUi8czvr1LU1alUMI05LekWB5DGyTm8cCBMCRpq3GqaiyEDRptEXOyXnvZ58GZYu4kBxQ== dependencies: "@emotion/hash" "^0.9.1" "@emotion/memoize" "^0.8.1" @@ -472,116 +461,231 @@ resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz#d1bc06aedb6936b3b6d313bf809a5a40387d2b7f" integrity sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA== +"@esbuild/aix-ppc64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz#a70f4ac11c6a1dfc18b8bbb13284155d933b9537" + integrity sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g== + "@esbuild/android-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz#7ad65a36cfdb7e0d429c353e00f680d737c2aed4" integrity sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA== +"@esbuild/android-arm64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz#db1c9202a5bc92ea04c7b6840f1bbe09ebf9e6b9" + integrity sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg== + "@esbuild/android-arm@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.12.tgz#b0c26536f37776162ca8bde25e42040c203f2824" integrity sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w== +"@esbuild/android-arm@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.2.tgz#3b488c49aee9d491c2c8f98a909b785870d6e995" + integrity sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w== + "@esbuild/android-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.12.tgz#cb13e2211282012194d89bf3bfe7721273473b3d" integrity sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew== +"@esbuild/android-x64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.2.tgz#3b1628029e5576249d2b2d766696e50768449f98" + integrity sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg== + "@esbuild/darwin-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz#cbee41e988020d4b516e9d9e44dd29200996275e" integrity sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g== +"@esbuild/darwin-arm64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz#6e8517a045ddd86ae30c6608c8475ebc0c4000bb" + integrity sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA== + "@esbuild/darwin-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz#e37d9633246d52aecf491ee916ece709f9d5f4cd" integrity sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A== +"@esbuild/darwin-x64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz#90ed098e1f9dd8a9381695b207e1cff45540a0d0" + integrity sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA== + "@esbuild/freebsd-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz#1ee4d8b682ed363b08af74d1ea2b2b4dbba76487" integrity sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA== +"@esbuild/freebsd-arm64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz#d71502d1ee89a1130327e890364666c760a2a911" + integrity sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw== + "@esbuild/freebsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz#37a693553d42ff77cd7126764b535fb6cc28a11c" integrity sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg== +"@esbuild/freebsd-x64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz#aa5ea58d9c1dd9af688b8b6f63ef0d3d60cea53c" + integrity sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw== + "@esbuild/linux-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz#be9b145985ec6c57470e0e051d887b09dddb2d4b" integrity sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA== +"@esbuild/linux-arm64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz#055b63725df678379b0f6db9d0fa85463755b2e5" + integrity sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A== + "@esbuild/linux-arm@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz#207ecd982a8db95f7b5279207d0ff2331acf5eef" integrity sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w== +"@esbuild/linux-arm@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz#76b3b98cb1f87936fbc37f073efabad49dcd889c" + integrity sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg== + "@esbuild/linux-ia32@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz#d0d86b5ca1562523dc284a6723293a52d5860601" integrity sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA== +"@esbuild/linux-ia32@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz#c0e5e787c285264e5dfc7a79f04b8b4eefdad7fa" + integrity sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig== + "@esbuild/linux-loong64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz#9a37f87fec4b8408e682b528391fa22afd952299" integrity sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA== +"@esbuild/linux-loong64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz#a6184e62bd7cdc63e0c0448b83801001653219c5" + integrity sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ== + "@esbuild/linux-mips64el@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz#4ddebd4e6eeba20b509d8e74c8e30d8ace0b89ec" integrity sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w== +"@esbuild/linux-mips64el@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz#d08e39ce86f45ef8fc88549d29c62b8acf5649aa" + integrity sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA== + "@esbuild/linux-ppc64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz#adb67dadb73656849f63cd522f5ecb351dd8dee8" integrity sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg== +"@esbuild/linux-ppc64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz#8d252f0b7756ffd6d1cbde5ea67ff8fd20437f20" + integrity sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg== + "@esbuild/linux-riscv64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz#11bc0698bf0a2abf8727f1c7ace2112612c15adf" integrity sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg== +"@esbuild/linux-riscv64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz#19f6dcdb14409dae607f66ca1181dd4e9db81300" + integrity sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg== + "@esbuild/linux-s390x@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz#e86fb8ffba7c5c92ba91fc3b27ed5a70196c3cc8" integrity sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg== +"@esbuild/linux-s390x@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz#3c830c90f1a5d7dd1473d5595ea4ebb920988685" + integrity sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ== + "@esbuild/linux-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz#5f37cfdc705aea687dfe5dfbec086a05acfe9c78" integrity sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg== +"@esbuild/linux-x64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz#86eca35203afc0d9de0694c64ec0ab0a378f6fff" + integrity sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw== + "@esbuild/netbsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz#29da566a75324e0d0dd7e47519ba2f7ef168657b" integrity sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA== +"@esbuild/netbsd-x64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz#e771c8eb0e0f6e1877ffd4220036b98aed5915e6" + integrity sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ== + "@esbuild/openbsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz#306c0acbdb5a99c95be98bdd1d47c916e7dc3ff0" integrity sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw== +"@esbuild/openbsd-x64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz#9a795ae4b4e37e674f0f4d716f3e226dd7c39baf" + integrity sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ== + "@esbuild/sunos-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz#0933eaab9af8b9b2c930236f62aae3fc593faf30" integrity sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA== +"@esbuild/sunos-x64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz#7df23b61a497b8ac189def6e25a95673caedb03f" + integrity sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w== + "@esbuild/win32-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz#773bdbaa1971b36db2f6560088639ccd1e6773ae" integrity sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A== +"@esbuild/win32-arm64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz#f1ae5abf9ca052ae11c1bc806fb4c0f519bacf90" + integrity sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ== + "@esbuild/win32-ia32@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz#000516cad06354cc84a73f0943a4aa690ef6fd67" integrity sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ== +"@esbuild/win32-ia32@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz#241fe62c34d8e8461cd708277813e1d0ba55ce23" + integrity sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ== + "@esbuild/win32-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz#c57c8afbb4054a3ab8317591a0b7320360b444ae" integrity sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA== +"@esbuild/win32-x64@0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz#9c907b21e30a52db959ba4f80bb01a0cc403d5cc" + integrity sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ== + "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -987,24 +1091,24 @@ "@ethersproject/strings" "^5.7.0" "@floating-ui/core@^1.0.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.0.tgz#fa41b87812a16bf123122bf945946bae3fdf7fc1" - integrity sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g== + version "1.6.1" + resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.1.tgz#a4e6fef1b069cda533cbc7a4998c083a37f37573" + integrity sha512-42UH54oPZHPdRHdw6BgoBD6cg/eVTmVrFcgeRDM3jbO7uxSoipVcmcIGFcA5jmOHO5apcyvBhkSKES3fQJnu7A== dependencies: - "@floating-ui/utils" "^0.2.1" + "@floating-ui/utils" "^0.2.0" "@floating-ui/dom@^1.0.1": - version "1.6.3" - resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.3.tgz#954e46c1dd3ad48e49db9ada7218b0985cee75ef" - integrity sha512-RnDthu3mzPlQ31Ss/BTwQ1zjzIhr3lk1gZB1OC56h/1vEtaXkESrOqL5fQVMfXpwGtRwX+YsZBdyHtJMQnkArw== + version "1.6.5" + resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.5.tgz#323f065c003f1d3ecf0ff16d2c2c4d38979f4cb9" + integrity sha512-Nsdud2X65Dz+1RHjAIP0t8z5e2ff/IRbei6BqFrl1urT8sDVzM1HMQ+R0XcU5ceRfyO3I6ayeqIfh+6Wb8LGTw== dependencies: "@floating-ui/core" "^1.0.0" "@floating-ui/utils" "^0.2.0" -"@floating-ui/utils@^0.2.0", "@floating-ui/utils@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2" - integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q== +"@floating-ui/utils@^0.2.0": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.2.tgz#d8bae93ac8b815b2bd7a98078cf91e2724ef11e5" + integrity sha512-J4yDIIthosAsRZ5CPYP/jQvUAQtlZTTD/4suA08/FEnlxqW3sKS9iAhgsa9VYLZ6vDHn/ixJgIqRQPotoBjxIw== "@humanwhocodes/config-array@^0.11.14": version "0.11.14" @@ -1021,9 +1125,9 @@ integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== "@humanwhocodes/object-schema@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917" - integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== + version "2.0.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" + integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== "@isaacs/cliui@^8.0.2": version "8.0.2" @@ -1037,7 +1141,7 @@ wrap-ansi "^8.1.0" wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" -"@jridgewell/gen-mapping@^0.3.2", "@jridgewell/gen-mapping@^0.3.5": +"@jridgewell/gen-mapping@^0.3.5": version "0.3.5" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== @@ -1061,7 +1165,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.24": +"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== @@ -1089,12 +1193,14 @@ ip "^1.1.8" json-stringify-safe "^5.0.1" lodash "4.17.15" + openai "^4.38.2" p-all "3.0.0" p-retry "4.6.0" p-timeout "4.1.0" p-whilst "2.0.0" promise-all-props "1.0.1" safe-exchange-rate "1.0.0" + sinon "^17.0.1" socket.io-client "2.1.1" tough-cookie "2.5.0" web3 "^1.8.1" @@ -1131,11 +1237,16 @@ dependencies: "@noble/hashes" "1.3.3" -"@noble/hashes@1.3.3", "@noble/hashes@^1.2.0", "@noble/hashes@~1.3.2": +"@noble/hashes@1.3.3", "@noble/hashes@~1.3.2": version "1.3.3" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== +"@noble/hashes@^1.2.0", "@noble/hashes@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1167,6 +1278,11 @@ resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== +"@popperjs/core@^2.11.6": + version "2.11.8" + resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" + integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A== + "@reach/auto-id@0.18.0": version "0.18.0" resolved "https://registry.yarnpkg.com/@reach/auto-id/-/auto-id-0.18.0.tgz#4b97085cd1cf1360a9bedc6e9c78e97824014f0d" @@ -1243,6 +1359,35 @@ resolved "https://registry.yarnpkg.com/@reach/utils/-/utils-0.18.0.tgz#4f3cebe093dd436eeaff633809bf0f68f4f9d2ee" integrity sha512-KdVMdpTgDyK8FzdKO9SCpiibuy/kbv3pwgfXshTI6tEcQT1OOwj7BAksnzGC0rPz0UholwC+AgkqEl3EJX3M1A== +"@react-aria/ssr@^3.5.0": + version "3.9.3" + resolved "https://registry.yarnpkg.com/@react-aria/ssr/-/ssr-3.9.3.tgz#9e7d4e019965aaf86cec3da2411a392be49ac2b3" + integrity sha512-5bUZ93dmvHFcmfUcEN7qzYe8yQQ8JY+nHN6m9/iSDCQ/QmCiE0kWXYwhurjw5ch6I8WokQzx66xKIMHBAa4NNA== + dependencies: + "@swc/helpers" "^0.5.0" + +"@restart/hooks@^0.4.9": + version "0.4.16" + resolved "https://registry.yarnpkg.com/@restart/hooks/-/hooks-0.4.16.tgz#95ae8ac1cc7e2bd4fed5e39800ff85604c6d59fb" + integrity sha512-f7aCv7c+nU/3mF7NWLtVVr0Ra80RqsO89hO72r+Y/nvQr5+q0UFGkocElTH6MJApvReVh6JHUFYn2cw1WdHF3w== + dependencies: + dequal "^2.0.3" + +"@restart/ui@^1.6.8": + version "1.6.9" + resolved "https://registry.yarnpkg.com/@restart/ui/-/ui-1.6.9.tgz#05ec905a56486fa39b62f29c09b3917e57acd62f" + integrity sha512-mUbygUsJcRurjZCt1f77gg4DpheD1D+Sc7J3JjAkysUj7t8m4EBJVOqWC9788Qtbc69cJ+HlJc6jBguKwS8Mcw== + dependencies: + "@babel/runtime" "^7.21.0" + "@popperjs/core" "^2.11.6" + "@react-aria/ssr" "^3.5.0" + "@restart/hooks" "^0.4.9" + "@types/warning" "^3.0.0" + dequal "^2.0.3" + dom-helpers "^5.2.0" + uncontrollable "^8.0.1" + warning "^4.0.3" + "@rollup/plugin-inject@^5.0.5": version "5.0.5" resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz#616f3a73fe075765f91c5bec90176608bed277a3" @@ -1261,75 +1406,90 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rollup/rollup-android-arm-eabi@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.12.1.tgz#11aaa02a933864b87f0b31cf2b755734e1f22787" - integrity sha512-iU2Sya8hNn1LhsYyf0N+L4Gf9Qc+9eBTJJJsaOGUp+7x4n2M9dxTt8UvhJl3oeftSjblSlpCfvjA/IfP3g5VjQ== - -"@rollup/rollup-android-arm64@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.12.1.tgz#b1e606fb4b46b38dc32bf010d513449462d669e9" - integrity sha512-wlzcWiH2Ir7rdMELxFE5vuM7D6TsOcJ2Yw0c3vaBR3VOsJFVTx9xvwnAvhgU5Ii8Gd6+I11qNHwndDscIm0HXg== - -"@rollup/rollup-darwin-arm64@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.12.1.tgz#dc21df1be9402671a8b6b15a93dd5953c68ec114" - integrity sha512-YRXa1+aZIFN5BaImK+84B3uNK8C6+ynKLPgvn29X9s0LTVCByp54TB7tdSMHDR7GTV39bz1lOmlLDuedgTwwHg== - -"@rollup/rollup-darwin-x64@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.12.1.tgz#397dcc4427d774f29b9954676893574ac563bf0b" - integrity sha512-opjWJ4MevxeA8FhlngQWPBOvVWYNPFkq6/25rGgG+KOy0r8clYwL1CFd+PGwRqqMFVQ4/Qd3sQu5t7ucP7C/Uw== - -"@rollup/rollup-linux-arm-gnueabihf@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.12.1.tgz#d851fd49d617e7792e7cde8e5a95ca51ea520fe5" - integrity sha512-uBkwaI+gBUlIe+EfbNnY5xNyXuhZbDSx2nzzW8tRMjUmpScd6lCQYKY2V9BATHtv5Ef2OBq6SChEP8h+/cxifQ== - -"@rollup/rollup-linux-arm64-gnu@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.12.1.tgz#e41a271ae51f79ffee6fb2b5597cc81b4ef66ad9" - integrity sha512-0bK9aG1kIg0Su7OcFTlexkVeNZ5IzEsnz1ept87a0TUgZ6HplSgkJAnFpEVRW7GRcikT4GlPV0pbtVedOaXHQQ== - -"@rollup/rollup-linux-arm64-musl@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.12.1.tgz#d3b4cd6ef18d0aa7103129755e0c535701624fac" - integrity sha512-qB6AFRXuP8bdkBI4D7UPUbE7OQf7u5OL+R94JE42Z2Qjmyj74FtDdLGeriRyBDhm4rQSvqAGCGC01b8Fu2LthQ== - -"@rollup/rollup-linux-riscv64-gnu@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.12.1.tgz#215101b2bb768cce2f2227145b8dd5c3c716c259" - integrity sha512-sHig3LaGlpNgDj5o8uPEoGs98RII8HpNIqFtAI8/pYABO8i0nb1QzT0JDoXF/pxzqO+FkxvwkHZo9k0NJYDedg== - -"@rollup/rollup-linux-x64-gnu@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.12.1.tgz#34a12fa305e167105eab70dbf577cd41e5199709" - integrity sha512-nD3YcUv6jBJbBNFvSbp0IV66+ba/1teuBcu+fBBPZ33sidxitc6ErhON3JNavaH8HlswhWMC3s5rgZpM4MtPqQ== - -"@rollup/rollup-linux-x64-musl@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.12.1.tgz#3f000b5a92a32b844e385e1166979c87882930a3" - integrity sha512-7/XVZqgBby2qp/cO0TQ8uJK+9xnSdJ9ct6gSDdEr4MfABrjTyrW6Bau7HQ73a2a5tPB7hno49A0y1jhWGDN9OQ== - -"@rollup/rollup-win32-arm64-msvc@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.12.1.tgz#27977d91f5059645ebb3b7fbf4429982de2278d3" - integrity sha512-CYc64bnICG42UPL7TrhIwsJW4QcKkIt9gGlj21gq3VV0LL6XNb1yAdHVp1pIi9gkts9gGcT3OfUYHjGP7ETAiw== - -"@rollup/rollup-win32-ia32-msvc@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.12.1.tgz#0d252acd5af0274209c74374867ee8b949843d75" - integrity sha512-LN+vnlZ9g0qlHGlS920GR4zFCqAwbv2lULrR29yGaWP9u7wF5L7GqWu9Ah6/kFZPXPUkpdZwd//TNR+9XC9hvA== - -"@rollup/rollup-win32-x64-msvc@4.12.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.12.1.tgz#cd8d175e001c212d5ac71c7827ef1d5c5e14494c" - integrity sha512-n+vkrSyphvmU0qkQ6QBNXCGr2mKjhP08mPRM/Xp5Ck2FV4NrHU+y6axzDeixUrCBHVUS51TZhjqrKBBsHLKb2Q== +"@rollup/rollup-android-arm-eabi@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.17.2.tgz#1a32112822660ee104c5dd3a7c595e26100d4c2d" + integrity sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ== + +"@rollup/rollup-android-arm64@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.17.2.tgz#5aeef206d65ff4db423f3a93f71af91b28662c5b" + integrity sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw== + +"@rollup/rollup-darwin-arm64@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.17.2.tgz#6b66aaf003c70454c292cd5f0236ebdc6ffbdf1a" + integrity sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw== + +"@rollup/rollup-darwin-x64@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.17.2.tgz#f64fc51ed12b19f883131ccbcea59fc68cbd6c0b" + integrity sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ== + +"@rollup/rollup-linux-arm-gnueabihf@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.17.2.tgz#1a7641111be67c10111f7122d1e375d1226cbf14" + integrity sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A== + +"@rollup/rollup-linux-arm-musleabihf@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.17.2.tgz#c93fd632923e0fee25aacd2ae414288d0b7455bb" + integrity sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg== + +"@rollup/rollup-linux-arm64-gnu@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.17.2.tgz#fa531425dd21d058a630947527b4612d9d0b4a4a" + integrity sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A== + +"@rollup/rollup-linux-arm64-musl@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.17.2.tgz#8acc16f095ceea5854caf7b07e73f7d1802ac5af" + integrity sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA== + +"@rollup/rollup-linux-powerpc64le-gnu@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.17.2.tgz#94e69a8499b5cf368911b83a44bb230782aeb571" + integrity sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ== + +"@rollup/rollup-linux-riscv64-gnu@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.17.2.tgz#7ef1c781c7e59e85a6ce261cc95d7f1e0b56db0f" + integrity sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg== + +"@rollup/rollup-linux-s390x-gnu@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.17.2.tgz#f15775841c3232fca9b78cd25a7a0512c694b354" + integrity sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g== + +"@rollup/rollup-linux-x64-gnu@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.2.tgz#b521d271798d037ad70c9f85dd97d25f8a52e811" + integrity sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ== + +"@rollup/rollup-linux-x64-musl@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.2.tgz#9254019cc4baac35800991315d133cc9fd1bf385" + integrity sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q== + +"@rollup/rollup-win32-arm64-msvc@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.17.2.tgz#27f65a89f6f52ee9426ec11e3571038e4671790f" + integrity sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA== + +"@rollup/rollup-win32-ia32-msvc@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.17.2.tgz#a2fbf8246ed0bb014f078ca34ae6b377a90cb411" + integrity sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ== + +"@rollup/rollup-win32-x64-msvc@4.17.2": + version "4.17.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.17.2.tgz#5a2d08b81e8064b34242d5cc9973ef8dd1e60503" + integrity sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w== "@scure/base@~1.1.4": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.5.tgz#1d85d17269fe97694b9c592552dd9e5e33552157" - integrity sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ== + version "1.1.6" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" + integrity sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g== "@scure/bip32@1.3.3": version "1.3.3" @@ -1353,6 +1513,41 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== +"@sinonjs/commons@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-2.0.0.tgz#fd4ca5b063554307e8327b4564bd56d3b73924a3" + integrity sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg== + dependencies: + type-detect "4.0.8" + +"@sinonjs/commons@^3.0.0", "@sinonjs/commons@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" + integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== + dependencies: + type-detect "4.0.8" + +"@sinonjs/fake-timers@^11.2.2": + version "11.2.2" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz#50063cc3574f4a27bd8453180a04171c85cc9699" + integrity sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw== + dependencies: + "@sinonjs/commons" "^3.0.0" + +"@sinonjs/samsam@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-8.0.0.tgz#0d488c91efb3fa1442e26abea81759dfc8b5ac60" + integrity sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew== + dependencies: + "@sinonjs/commons" "^2.0.0" + lodash.get "^4.4.2" + type-detect "^4.0.8" + +"@sinonjs/text-encoding@^0.7.2": + version "0.7.2" + resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz#5981a8db18b56ba38ef0efb7d995b12aa7b51918" + integrity sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ== + "@svgr/babel-plugin-add-jsx-attribute@8.0.0": version "8.0.0" resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz#4001f5d5dd87fa13303e36ee106e3ff3a7eb8b22" @@ -1436,6 +1631,13 @@ "@svgr/hast-util-to-babel-ast" "8.0.0" svg-parser "^2.0.4" +"@swc/helpers@^0.5.0": + version "0.5.11" + resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.11.tgz#5bab8c660a6e23c13b2d23fcd1ee44a2db1b0cb7" + integrity sha512-YNlnKRWF2sVojTpIyzwou9XoTNbzbzONwRhOoniEioF1AtaitTvVZblaQRrAzChWQ1bLYyYSWzM18y4WwgzJ+A== + dependencies: + tslib "^2.4.0" + "@szmarczak/http-timer@^4.0.5": version "4.0.6" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz#b4a914bb62e7c272d4e5989fe4440f812ab1d807" @@ -1451,16 +1653,16 @@ defer-to-connect "^2.0.1" "@tabler/icons-react@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@tabler/icons-react/-/icons-react-3.1.0.tgz#5202b5cc7c6e57dde75c41981b618dcfebd69b50" - integrity sha512-k/WTlax2vbj/LpxvaJ+BmaLAAhVUgyLj4Ftgaczz66tUSNzqrAZXCFdOU7cRMYPNVBqyqE2IdQd2rzzhDEJvkw== + version "3.3.0" + resolved "https://registry.yarnpkg.com/@tabler/icons-react/-/icons-react-3.3.0.tgz#ca38c131aa43145c24198a6656e2aac2a4954222" + integrity sha512-Qn1Po+0gErh1zCWlaOdoVoGqeonWfSuiboYgwZBs6PIJNsj7yr3bIa4BkHmgJgtlXLT9LvCzt/RvwlgjxLfjjg== dependencies: - "@tabler/icons" "3.1.0" + "@tabler/icons" "3.3.0" -"@tabler/icons@3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@tabler/icons/-/icons-3.1.0.tgz#d69d184eae572db6adb452b511562442133cc26d" - integrity sha512-CpZGyS1IVJKFcv88yZ2sYZIpWWhQ6oy76BQKQ5SF0fGgOqgyqKdBGG/YGyyMW632on37MX7VqQIMTzN/uQqmFg== +"@tabler/icons@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@tabler/icons/-/icons-3.3.0.tgz#ae7194d44a3808d97e8fcd47439eb8772d138659" + integrity sha512-PLVe9d7b59sKytbx00KgeGhQG3N176Ezv8YMmsnSz4s0ifDzMWlp/h2wEfQZ0ZNe8e377GY2OW6kovUe3Rnd0g== "@tootallnate/once@2": version "2.0.0" @@ -1565,10 +1767,18 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433" integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== +"@types/node-fetch@^2.6.4": + version "2.6.11" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.11.tgz#9b39b78665dae0e82a08f02f4967d62c66f95d24" + integrity sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + "@types/node@*": - version "20.11.25" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.25.tgz#0f50d62f274e54dd7a49f7704cc16bfbcccaf49f" - integrity sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw== + version "20.12.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.11.tgz#c4ef00d3507000d17690643278a60dc55a9dc9be" + integrity sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw== dependencies: undici-types "~5.26.4" @@ -1578,9 +1788,9 @@ integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== "@types/node@^18.11.18", "@types/node@^18.19.9": - version "18.19.22" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.22.tgz#f622f92514b897e6b09903e97c16a0db8e94689f" - integrity sha512-p3pDIfuMg/aXBmhkyanPshdfJuX5c5+bQjYLIikPLXAUycEogij/c50n/C+8XOA5L93cU4ZRXtn+dNQGi0IZqQ== + version "18.19.33" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.33.tgz#98cd286a1b8a5e11aa06623210240bcc28e95c48" + integrity sha512-NR9+KrpSajr2qBVp/Yt5TU/rp+b5Mayi3+OlMlcg2cVCfRmcG5PWZ7S4+MG9PZ5gWBoc9Pd0BKSRViuBCRPu0A== dependencies: undici-types "~5.26.4" @@ -1605,31 +1815,30 @@ xmlbuilder ">=11.0.1" "@types/prop-types@*": - version "15.7.11" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.11.tgz#2596fb352ee96a1379c657734d4b913a613ad563" - integrity sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng== + version "15.7.12" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.12.tgz#12bb1e2be27293c1406acb6af1c3f3a1481d98c6" + integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q== "@types/react-dom@^18.2.18": - version "18.2.21" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.21.tgz#b8c81715cebdebb2994378616a8d54ace54f043a" - integrity sha512-gnvBA/21SA4xxqNXEwNiVcP0xSGHh/gi1VhWv9Bl46a0ItbTT5nFY+G9VSQpaG/8N/qdJpJ+vftQ4zflTtnjLw== + version "18.3.0" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.0.tgz#0cbc818755d87066ab6ca74fbedb2547d74a82b0" + integrity sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg== dependencies: "@types/react" "*" -"@types/react-transition-group@^4.4.0": +"@types/react-transition-group@^4.4.0", "@types/react-transition-group@^4.4.6": version "4.4.10" resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-4.4.10.tgz#6ee71127bdab1f18f11ad8fb3322c6da27c327ac" integrity sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q== dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^18.2.48": - version "18.2.64" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.64.tgz#3700fbb6b2fa60a6868ec1323ae4cbd446a2197d" - integrity sha512-MlmPvHgjj2p3vZaxbQgFUQFvD8QiZwACfGqEdDSWou5yISWxDQ4/74nCAwsUiX7UFLKZz3BbVSPj+YxeoGGCfg== +"@types/react@*", "@types/react@>=16.9.11", "@types/react@^18.2.48": + version "18.3.2" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.2.tgz#462ae4904973bc212fa910424d901e3d137dbfcd" + integrity sha512-Btgg89dAnqD4vV7R3hlwOxgqobUQKgx3MmrQRi0yYbs/P0ym8XozIAlkqVilPqHQwXs4e9Tf63rrCgl58BcO4w== dependencies: "@types/prop-types" "*" - "@types/scheduler" "*" csstype "^3.0.2" "@types/responselike@^1.0.0": @@ -1644,11 +1853,6 @@ resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.5.tgz#f090ff4bd8d2e5b940ff270ab39fd5ca1834a07e" integrity sha512-3xSjTp3v03X/lSQLkczaN9UIEwJMoMCA1+Nb5HfbJEQWogdeQIyVtTvxPXDQjZ5zws8rFQfVfRdz03ARihPJgw== -"@types/scheduler@*": - version "0.16.8" - resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff" - integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A== - "@types/secp256k1@^4.0.1": version "4.0.6" resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.6.tgz#d60ba2349a51c2cbc5e816dcd831a42029d376bf" @@ -1686,6 +1890,11 @@ resolved "https://registry.yarnpkg.com/@types/verror/-/verror-1.10.10.tgz#d5a4b56abac169bfbc8b23d291363a682e6fa087" integrity sha512-l4MM0Jppn18hb9xmM6wwD1uTdShpf9Pn80aXTStnK1C94gtPvJcV2FrDmbOQUAQfJ1cKZHktkQUDwEqaAKXMMg== +"@types/warning@^3.0.0": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/warning/-/warning-3.0.3.tgz#d1884c8cc4a426d1ac117ca2611bf333834c6798" + integrity sha512-D1XC7WK8K+zZEveUPY+cf4+kgauk8N4eHr/XIHXGlGYkHLud6hK9lYfZk1ry1TNh798cZUCgb6MqGEG8DkJt6Q== + "@types/yauzl@^2.9.1": version "2.10.3" resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.3.tgz#e9b2808b4f109504a03cda958259876f61017999" @@ -1813,6 +2022,13 @@ abi-decoder@^2.4.0: web3-eth-abi "^1.2.1" web3-utils "^1.2.1" +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + abortcontroller-polyfill@^1.7.5: version "1.7.5" resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed" @@ -1863,6 +2079,13 @@ agent-base@6: dependencies: debug "4" +agentkeepalive@^4.2.1: + version "4.5.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" + integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== + dependencies: + humanize-ms "^1.2.1" + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -1972,14 +2195,15 @@ array-flatten@1.1.1: integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== array-includes@^3.1.6, array-includes@^3.1.7: - version "3.1.7" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.7.tgz#8cd2e01b26f7a3086cbc87271593fe921c62abda" - integrity sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ== + version "3.1.8" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.8.tgz#5e370cbe172fdd5dd6530c1d4aadda25281ba97d" + integrity sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - get-intrinsic "^1.2.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-object-atoms "^1.0.0" + get-intrinsic "^1.2.4" is-string "^1.0.7" array-union@^2.1.0: @@ -1988,14 +2212,15 @@ array-union@^2.1.0: integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== array.prototype.findlast@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/array.prototype.findlast/-/array.prototype.findlast-1.2.4.tgz#eeb9e45fc894055c82e5675c463e8077b827ad36" - integrity sha512-BMtLxpV+8BD+6ZPFIWmnUBpQoy+A+ujcg4rhp2iwCRJYA7PEh2MS4NL3lz8EiDlLrJPp2hg9qWihr5pd//jcGw== + version "1.2.5" + resolved "https://registry.yarnpkg.com/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz#3e4fbcb30a15a7f5bf64cf2faae22d139c2e4904" + integrity sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ== dependencies: - call-bind "^1.0.5" + call-bind "^1.0.7" define-properties "^1.2.1" - es-abstract "^1.22.3" + es-abstract "^1.23.2" es-errors "^1.3.0" + es-object-atoms "^1.0.0" es-shim-unscopables "^1.0.2" array.prototype.flat@^1.3.1: @@ -2115,13 +2340,6 @@ async@^3.2.3: resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== -asynciterator.prototype@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz#8c5df0514936cdd133604dfcc9d3fb93f09b2b62" - integrity sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg== - dependencies: - has-symbols "^1.0.3" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -2132,7 +2350,7 @@ at-least-node@^1.0.0: resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== -available-typed-arrays@^1.0.6, available-typed-arrays@^1.0.7: +available-typed-arrays@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" integrity sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ== @@ -2365,6 +2583,11 @@ boolean@^3.0.1: resolved "https://registry.yarnpkg.com/boolean/-/boolean-3.2.0.tgz#9e5294af4e98314494cbb17979fa54ca159f116b" integrity sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw== +bootstrap@^5.3.3: + version "5.3.3" + resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.3.3.tgz#de35e1a765c897ac940021900fcbb831602bac38" + integrity sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg== + bottleneck@^2.19.5: version "2.19.5" resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.19.5.tgz#5df0b90f59fd47656ebe63c78a98419205cadd91" @@ -2645,9 +2868,9 @@ camelize@^1.0.0: integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ== caniuse-lite@^1.0.30001587: - version "1.0.30001596" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001596.tgz#da06b79c3d9c3d9958eb307aa832ac68ead79bee" - integrity sha512-zpkZ+kEr6We7w63ORkoJ2pOfBwBkY/bJrG/UZ90qNb45Isblu8wzDgevEOrRL1r9dWayHjYiiyCMEXPn4DweGQ== + version "1.0.30001617" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001617.tgz#809bc25f3f5027ceb33142a7d6c40759d7a901eb" + integrity sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA== caseless@~0.12.0: version "0.12.0" @@ -2745,7 +2968,7 @@ class-is@^1.1.0: resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== -classnames@^2.2.3: +classnames@^2.2.3, classnames@^2.3.2: version "2.5.1" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b" integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== @@ -2919,10 +3142,10 @@ cookie-signature@1.0.6: resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== -cookie@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" - integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== +cookie@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== core-js@^2.4.0: version "2.6.12" @@ -3122,6 +3345,33 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +data-view-buffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.1.tgz#8ea6326efec17a2e42620696e671d7d5a8bc66b2" + integrity sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA== + dependencies: + call-bind "^1.0.6" + es-errors "^1.3.0" + is-data-view "^1.0.1" + +data-view-byte-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz#90721ca95ff280677eb793749fce1011347669e2" + integrity sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + is-data-view "^1.0.1" + +data-view-byte-offset@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz#5e0bbfb4828ed2d1b9b400cd8a7d119bca0ff18a" + integrity sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA== + dependencies: + call-bind "^1.0.6" + es-errors "^1.3.0" + is-data-view "^1.0.1" + debug@2.6.9, debug@^2.2.0: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -3224,6 +3474,11 @@ depd@2.0.0: resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== +dequal@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" + integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== + des.js@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.1.0.tgz#1d37f5766f3bbff4ee9638e871a8768c173b81da" @@ -3238,15 +3493,20 @@ destroy@1.2.0: integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== detect-libc@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.2.tgz#8ccf2ba9315350e1241b88d0ac3b0e1fbd99605d" - integrity sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw== + version "2.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" + integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== detect-node@^2.0.4: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== +diff@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" + integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -3320,7 +3580,7 @@ doctrine@^3.0.0: dependencies: "@babel/runtime" "^7.1.2" -dom-helpers@^5.0.1: +dom-helpers@^5.0.1, dom-helpers@^5.2.0, dom-helpers@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.2.1.tgz#d9400536b2bf8225ad98fe052e029451ac40e902" integrity sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA== @@ -3405,11 +3665,11 @@ ecc-jsbn@~0.1.1: safer-buffer "^2.1.0" ecies-geth@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/ecies-geth/-/ecies-geth-1.7.0.tgz#b44b674ce86a98e8b2416670b9f609af347e8408" - integrity sha512-b1930BRQ8ra/aGG7zkBotSo1uqnUF+kTmaQLjvjP8D+vimRC3x+LrIIY4QJ67UIqYY2UAthg+xxvcrWgMzGlRg== + version "1.7.1" + resolved "https://registry.yarnpkg.com/ecies-geth/-/ecies-geth-1.7.1.tgz#14ff0c6ff57063de52639cc1479236c554238e6a" + integrity sha512-AXfex57cTB4RwpIvqZM1UmnSn6Fmne0d+J8xZu95ToJ7nb2xJAgwKTWn/FuQFFYQNN3PyG4jTwrDcBMReoALIA== dependencies: - elliptic "^6.5.4" + elliptic "^6.5.5" secp256k1 "^5.0.0" ee-first@1.1.1: @@ -3418,9 +3678,9 @@ ee-first@1.1.1: integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== ejs@^3.1.8: - version "3.1.9" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.9.tgz#03c9e8777fe12686a9effcef22303ca3d8eeb361" - integrity sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ== + version "3.1.10" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b" + integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA== dependencies: jake "^10.8.5" @@ -3513,9 +3773,9 @@ electron-log@^4.4.8: integrity sha512-QQ4GvrXO+HkgqqEOYbi+DHL7hj5JM+nHi/j+qrN9zeeXVKy8ZABgbu4CnG+BBqDZ2+tbeq9tUC4DZfIWFU5AZA== electron-log@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-5.1.2.tgz#fb40ad7f4ae694dd0e4c02c662d1a65c03e1243e" - integrity sha512-Cpg4hAZ27yM9wzE77c4TvgzxzavZ+dVltCczParXN+Vb3jocojCSAuSMCVOI9fhFuuOR+iuu3tZLX1cu0y0kgQ== + version "5.1.4" + resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-5.1.4.tgz#9b7ea4ae1167475f3c9babc5c3d94d54f46dd35a" + integrity sha512-P0RSXnwT3z+e89Z5uAcZDeN85/QjIgv764a93kqCi+wh2Jm22CCbc3AGDt4S8rsxAHWHB4Q0PGsQl3fw1AN0kQ== electron-publish@24.13.1: version "24.13.1" @@ -3531,21 +3791,18 @@ electron-publish@24.13.1: mime "^2.5.2" electron-settings@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/electron-settings/-/electron-settings-4.0.2.tgz#26ef242397393e0e69119f6fb879fc2287d0f508" - integrity sha512-WnUlrnBsO784oXcag0ym+A3ySoIwonz5GhYFsWroMHVzslzmsP+81f/Fof41T9UrRUxuPPKiZPZMwGO+yvWChg== + version "4.0.4" + resolved "https://registry.yarnpkg.com/electron-settings/-/electron-settings-4.0.4.tgz#b2e6f17a7b0a03cbaf64be28aa460b533d24e8ad" + integrity sha512-yR6ByH3hHqDgbcQ9y5foA2Pr2fSMIggFDMsHe71z1Og6myw7vxMlrkIzenmmrmZHeFLlvQyt7+gTZCH8BywHBw== dependencies: - lodash.get "^4.4.2" - lodash.has "^4.5.2" - lodash.set "^4.3.2" - lodash.unset "^4.5.2" + lodash "^4.17.21" mkdirp "^1.0.4" write-file-atomic "^3.0.3" electron-to-chromium@^1.4.668: - version "1.4.699" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.699.tgz#dd53c939e13da64e94b341e563f0a3011b4ef0e9" - integrity sha512-I7q3BbQi6e4tJJN5CRcyvxhK0iJb34TV8eJQcgh+fR2fQ8miMgZcEInckCo1U9exDHbfz7DLDnFn8oqH/VcRKw== + version "1.4.763" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.763.tgz#64f2041ed496fd6fc710b9be806fe91da9334f91" + integrity sha512-k4J8NrtJ9QrvHLRo8Q18OncqBCB7tIUyqxRcJnlonQ0ioHKYB988GcDFF3ZePmnb8eHEopDs/wPHR/iGAFgoUQ== electron-updater@^6.1.7: version "6.1.8" @@ -3562,9 +3819,9 @@ electron-updater@^6.1.7: tiny-typed-emitter "^2.1.0" electron-vite@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/electron-vite/-/electron-vite-2.1.0.tgz#33908c3b9c90bcab5c5f4c0f6c483263303cc5aa" - integrity sha512-DjToUW6q3ILoW79b1yBywC6LubnOw5Axr2zo9cHMlYf00zAO8oVzrCcqinJQTTbJLvqCuVcBzuICMl5MYshUnQ== + version "2.2.0" + resolved "https://registry.yarnpkg.com/electron-vite/-/electron-vite-2.2.0.tgz#52976a71606afce2b2cf2b7489547db6bc3a1ea1" + integrity sha512-WvE8KlZTiay9uWqBRvnYuxg2JqIicaNqaz9qFvsZkIae2/FmqZC5jctziyduCuuwVxqJG0Sjh8RlTwSn8xcCoQ== dependencies: "@babel/core" "^7.23.5" "@babel/plugin-transform-arrow-functions" "^7.23.3" @@ -3582,9 +3839,9 @@ electron-window-state@^5.0.3: mkdirp "^0.5.1" electron@^28.2.0: - version "28.2.6" - resolved "https://registry.yarnpkg.com/electron/-/electron-28.2.6.tgz#ec4958ff759009e3eb2c9489df5eb02f989f06bf" - integrity sha512-RuhbW+ifvh3DqnVlHCcCKhKIFOxTktq1GN1gkIkEZ8y5LEZfcjOkxB2s6Fd1S6MzsMZbiJti+ZJG5hXS4SDVLQ== + version "28.3.1" + resolved "https://registry.yarnpkg.com/electron/-/electron-28.3.1.tgz#babb3ff8e246336e9cd1c1966f16a55ba723ea06" + integrity sha512-aF9fONuhVDJlctJS7YOw76ynxVAQdfIWmlhRMKits24tDcdSL0eMHUS0wWYiRfGWbQnUKB6V49Rf17o32f4/fg== dependencies: "@electron/get" "^2.0.0" "@types/node" "^18.11.18" @@ -3688,17 +3945,21 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.22.4: - version "1.22.5" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.5.tgz#1417df4e97cc55f09bf7e58d1e614bc61cb8df46" - integrity sha512-oW69R+4q2wG+Hc3KZePPZxOiisRIqfKBVo/HLx94QcJeWGU/8sZhCvc829rd1kS366vlJbzBfXf9yWwf0+Ko7w== +es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.1, es-abstract@^1.23.2, es-abstract@^1.23.3: + version "1.23.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.3.tgz#8f0c5a35cd215312573c5a27c87dfd6c881a0aa0" + integrity sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A== dependencies: array-buffer-byte-length "^1.0.1" arraybuffer.prototype.slice "^1.0.3" available-typed-arrays "^1.0.7" call-bind "^1.0.7" + data-view-buffer "^1.0.1" + data-view-byte-length "^1.0.1" + data-view-byte-offset "^1.0.0" es-define-property "^1.0.0" es-errors "^1.3.0" + es-object-atoms "^1.0.0" es-set-tostringtag "^2.0.3" es-to-primitive "^1.2.1" function.prototype.name "^1.1.6" @@ -3709,10 +3970,11 @@ es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.22.4: has-property-descriptors "^1.0.2" has-proto "^1.0.3" has-symbols "^1.0.3" - hasown "^2.0.1" + hasown "^2.0.2" internal-slot "^1.0.7" is-array-buffer "^3.0.4" is-callable "^1.2.7" + is-data-view "^1.0.1" is-negative-zero "^2.0.3" is-regex "^1.1.4" is-shared-array-buffer "^1.0.3" @@ -3723,17 +3985,17 @@ es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.22.4: object-keys "^1.1.1" object.assign "^4.1.5" regexp.prototype.flags "^1.5.2" - safe-array-concat "^1.1.0" + safe-array-concat "^1.1.2" safe-regex-test "^1.0.3" - string.prototype.trim "^1.2.8" - string.prototype.trimend "^1.0.7" - string.prototype.trimstart "^1.0.7" + string.prototype.trim "^1.2.9" + string.prototype.trimend "^1.0.8" + string.prototype.trimstart "^1.0.8" typed-array-buffer "^1.0.2" typed-array-byte-length "^1.0.1" typed-array-byte-offset "^1.0.2" - typed-array-length "^1.0.5" + typed-array-length "^1.0.6" unbox-primitive "^1.0.2" - which-typed-array "^1.1.14" + which-typed-array "^1.1.15" es-define-property@^1.0.0: version "1.0.0" @@ -3742,33 +4004,39 @@ es-define-property@^1.0.0: dependencies: get-intrinsic "^1.2.4" -es-errors@^1.0.0, es-errors@^1.1.0, es-errors@^1.2.1, es-errors@^1.3.0: +es-errors@^1.1.0, es-errors@^1.2.1, es-errors@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-iterator-helpers@^1.0.17: - version "1.0.17" - resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.0.17.tgz#123d1315780df15b34eb181022da43e734388bb8" - integrity sha512-lh7BsUqelv4KUbR5a/ZTaGGIMLCjPGPqJ6q+Oq24YP0RdyptX1uzm4vvaqzk7Zx3bpl/76YLTTDj9L7uYQ92oQ== + version "1.0.19" + resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.0.19.tgz#117003d0e5fec237b4b5c08aded722e0c6d50ca8" + integrity sha512-zoMwbCcH5hwUkKJkT8kDIBZSz9I6mVG//+lDCinLCGov4+r7NIy0ld8o03M0cJxl2spVf6ESYVS6/gpIfq1FFw== dependencies: - asynciterator.prototype "^1.0.0" call-bind "^1.0.7" define-properties "^1.2.1" - es-abstract "^1.22.4" + es-abstract "^1.23.3" es-errors "^1.3.0" - es-set-tostringtag "^2.0.2" + es-set-tostringtag "^2.0.3" function-bind "^1.1.2" get-intrinsic "^1.2.4" globalthis "^1.0.3" has-property-descriptors "^1.0.2" - has-proto "^1.0.1" + has-proto "^1.0.3" has-symbols "^1.0.3" internal-slot "^1.0.7" iterator.prototype "^1.1.2" - safe-array-concat "^1.1.0" + safe-array-concat "^1.1.2" -es-set-tostringtag@^2.0.2, es-set-tostringtag@^2.0.3: +es-object-atoms@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.0.0.tgz#ddb55cd47ac2e240701260bc2a8e31ecb643d941" + integrity sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw== + dependencies: + es-errors "^1.3.0" + +es-set-tostringtag@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz#8bb60f0a440c2e4281962428438d58545af39777" integrity sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ== @@ -3830,7 +4098,7 @@ es6-symbol@^3.1.1, es6-symbol@^3.1.3: d "^1.0.2" ext "^1.7.0" -esbuild@^0.19.3, esbuild@^0.19.8: +esbuild@^0.19.8: version "0.19.12" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.12.tgz#dc82ee5dc79e82f5a5c3b4323a2a641827db3e04" integrity sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg== @@ -3859,7 +4127,36 @@ esbuild@^0.19.3, esbuild@^0.19.8: "@esbuild/win32-ia32" "0.19.12" "@esbuild/win32-x64" "0.19.12" -escalade@^3.1.1: +esbuild@^0.20.1: + version "0.20.2" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.20.2.tgz#9d6b2386561766ee6b5a55196c6d766d28c87ea1" + integrity sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g== + optionalDependencies: + "@esbuild/aix-ppc64" "0.20.2" + "@esbuild/android-arm" "0.20.2" + "@esbuild/android-arm64" "0.20.2" + "@esbuild/android-x64" "0.20.2" + "@esbuild/darwin-arm64" "0.20.2" + "@esbuild/darwin-x64" "0.20.2" + "@esbuild/freebsd-arm64" "0.20.2" + "@esbuild/freebsd-x64" "0.20.2" + "@esbuild/linux-arm" "0.20.2" + "@esbuild/linux-arm64" "0.20.2" + "@esbuild/linux-ia32" "0.20.2" + "@esbuild/linux-loong64" "0.20.2" + "@esbuild/linux-mips64el" "0.20.2" + "@esbuild/linux-ppc64" "0.20.2" + "@esbuild/linux-riscv64" "0.20.2" + "@esbuild/linux-s390x" "0.20.2" + "@esbuild/linux-x64" "0.20.2" + "@esbuild/netbsd-x64" "0.20.2" + "@esbuild/openbsd-x64" "0.20.2" + "@esbuild/sunos-x64" "0.20.2" + "@esbuild/win32-arm64" "0.20.2" + "@esbuild/win32-ia32" "0.20.2" + "@esbuild/win32-x64" "0.20.2" + +escalade@^3.1.1, escalade@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== @@ -3898,9 +4195,9 @@ eslint-plugin-prettier@^5.0.1: synckit "^0.8.6" eslint-plugin-react@^7.33.2: - version "7.34.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.34.0.tgz#ab71484d54fc409c37025c5eca00eb4177a5e88c" - integrity sha512-MeVXdReleBTdkz/bvcQMSnCXGi+c9kvy51IpinjnJgutl3YTHWsDdke7Z1ufZpGfDG8xduBDKyjtB9JH1eBKIQ== + version "7.34.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.34.1.tgz#6806b70c97796f5bbfb235a5d3379ece5f4da997" + integrity sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw== dependencies: array-includes "^3.1.7" array.prototype.findlast "^1.2.4" @@ -4077,11 +4374,11 @@ ethereum-abi-types-generator@^1.3.2: yargs "^15.3.1" ethereum-bloom-filters@^1.0.6: - version "1.0.10" - resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz#3ca07f4aed698e75bd134584850260246a5fed8a" - integrity sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA== + version "1.1.0" + resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.1.0.tgz#b3fc1eb789509ee30db0bf99a2988ccacb8d0397" + integrity sha512-J1gDRkLpuGNvWYzWslBQR9cDV4nd4kfvVTE/Wy4Kkm4yb3EYRSlyi0eB/inTsSTTVyA0+HyzHgbr95Fn/Z1fSw== dependencies: - js-sha3 "^0.8.0" + "@noble/hashes" "^1.4.0" ethereum-cryptography@^0.1.3: version "0.1.3" @@ -4206,6 +4503,11 @@ event-emitter@^0.3.5: d "1" es5-ext "~0.10.14" +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + eventemitter3@4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384" @@ -4235,16 +4537,16 @@ expand-template@^2.0.3: integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== express@^4.14.0: - version "4.18.3" - resolved "https://registry.yarnpkg.com/express/-/express-4.18.3.tgz#6870746f3ff904dee1819b82e4b51509afffb0d4" - integrity sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw== + version "4.19.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" + integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q== dependencies: accepts "~1.3.8" array-flatten "1.1.1" body-parser "1.20.2" content-disposition "0.5.4" content-type "~1.0.4" - cookie "0.5.0" + cookie "0.6.0" cookie-signature "1.0.6" debug "2.6.9" depd "2.0.0" @@ -4448,9 +4750,9 @@ follow-redirects@1.5.10: debug "=3.1.0" follow-redirects@^1.10.0, follow-redirects@^1.14.4: - version "1.15.5" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020" - integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw== + version "1.15.6" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" + integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== for-each@^0.3.3: version "0.3.3" @@ -4477,6 +4779,11 @@ form-data-encoder@1.7.1: resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== +form-data-encoder@1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040" + integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A== + form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -4495,6 +4802,14 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" +formdata-node@^4.3.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.4.1.tgz#23f6a5cb9cb55315912cbec4ff7b0f59bbd191e2" + integrity sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ== + dependencies: + node-domexception "1.0.0" + web-streams-polyfill "4.0.0-beta.3" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -4660,15 +4975,15 @@ glob-parent@^6.0.2: is-glob "^4.0.3" glob@^10.3.10: - version "10.3.10" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.10.tgz#0351ebb809fd187fe421ab96af83d3a70715df4b" - integrity sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g== + version "10.3.14" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.14.tgz#36501f871d373fe197fc5794588d0aa71e69ff68" + integrity sha512-4fkAqu93xe9Mk7le9v0y3VrPDqLKHarNi2s4Pv7f2yOvfhWfhc7hRPHC/JyqMqb8B/Dt/eGS4n7ykwf3fOsl8g== dependencies: foreground-child "^3.1.0" - jackspeak "^2.3.5" + jackspeak "^2.3.6" minimatch "^9.0.1" - minipass "^5.0.0 || ^6.0.2 || ^7.0.0" - path-scurry "^1.10.1" + minipass "^7.0.4" + path-scurry "^1.11.0" glob@^7.1.3, glob@^7.1.6: version "7.2.3" @@ -4715,11 +5030,12 @@ globals@^13.19.0: type-fest "^0.20.2" globalthis@^1.0.1, globalthis@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" - integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== + version "1.0.4" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236" + integrity sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ== dependencies: - define-properties "^1.1.3" + define-properties "^1.2.1" + gopd "^1.0.1" globby@^11.1.0: version "11.1.0" @@ -4843,7 +5159,7 @@ has-symbols@^1.0.2, has-symbols@^1.0.3: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== -has-tostringtag@^1.0.0, has-tostringtag@^1.0.1, has-tostringtag@^1.0.2: +has-tostringtag@^1.0.0, has-tostringtag@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== @@ -4883,10 +5199,10 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: inherits "^2.0.3" minimalistic-assert "^1.0.1" -hasown@^2.0.0, hasown@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.1.tgz#26f48f039de2c0f8d3356c223fb8d50253519faa" - integrity sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA== +hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== dependencies: function-bind "^1.1.2" @@ -5008,6 +5324,13 @@ https-proxy-agent@^5.0.1: agent-base "6" debug "4" +humanize-ms@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== + dependencies: + ms "^2.0.0" + iconv-corefoundation@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz#31065e6ab2c9272154c8b0821151e2c88f1b002a" @@ -5093,7 +5416,7 @@ ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -internal-slot@^1.0.5, internal-slot@^1.0.7: +internal-slot@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.7.tgz#c06dcca3ed874249881007b0a5523b172a190802" integrity sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g== @@ -5186,6 +5509,13 @@ is-core-module@^2.13.0: dependencies: hasown "^2.0.0" +is-data-view@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-data-view/-/is-data-view-1.0.1.tgz#4b4d3a511b70f3dc26d42c03ca9ca515d847759f" + integrity sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w== + dependencies: + is-typed-array "^1.1.13" + is-date-object@^1.0.1, is-date-object@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" @@ -5413,7 +5743,7 @@ iterator.prototype@^1.1.2: reflect.getprototypeof "^1.0.4" set-function-name "^2.0.1" -jackspeak@^2.3.5: +jackspeak@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.3.6.tgz#647ecc472238aee4b06ac0e461acc21a8c505ca8" integrity sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ== @@ -5423,9 +5753,9 @@ jackspeak@^2.3.5: "@pkgjs/parseargs" "^0.11.0" jake@^10.8.5: - version "10.8.7" - resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.7.tgz#63a32821177940c33f356e0ba44ff9d34e1c7d8f" - integrity sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w== + version "10.9.1" + resolved "https://registry.yarnpkg.com/jake/-/jake-10.9.1.tgz#8dc96b7fcc41cb19aa502af506da4e1d56f5e62b" + integrity sha512-61btcOHNnLnsOdtLgA5efqQWjnSi/vow5HbI7HMdKKWqvrKR1bLK3BPlJn9gcSaP2ewuamUSMB5XEy76KUIS2w== dependencies: async "^3.2.3" chalk "^4.0.2" @@ -5437,7 +5767,7 @@ js-sha3@0.5.7, js-sha3@^0.5.7: resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g== -js-sha3@0.8.0, js-sha3@^0.8.0: +js-sha3@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== @@ -5560,6 +5890,11 @@ jszip@^3.1.0: readable-stream "~2.3.6" setimmediate "^1.0.5" +just-extend@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-6.2.0.tgz#b816abfb3d67ee860482e7401564672558163947" + integrity sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw== + keccak@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" @@ -5674,11 +6009,6 @@ lodash.get@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ== -lodash.has@^4.5.2: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.has/-/lodash.has-4.5.2.tgz#d19f4dc1095058cccbe2b0cdf4ee0fe4aa37c862" - integrity sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g== - lodash.isequal@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" @@ -5689,16 +6019,6 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.set@^4.3.2: - version "4.3.2" - resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" - integrity sha512-4hNPN5jlm/N/HLMCO43v8BXKq9Z7QdAGc/VGrRD61w8gN9g/6jF9A4L1pbUgBLCffi0w9VsXfTOij5x8iTyFvg== - -lodash.unset@^4.5.2: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.unset/-/lodash.unset-4.5.2.tgz#370d1d3e85b72a7e1b0cdf2d272121306f23e4ed" - integrity sha512-bwKX88k2JhCV9D1vtE8+naDKlLiGrSmf8zi/Y9ivFHwbmRfA8RxS/aVJ+sIht2XOwqoNr4xUPUkGZpc1sHFEKg== - lodash@4.17.15: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" @@ -5733,6 +6053,11 @@ lowercase-keys@^3.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== +lru-cache@^10.2.0: + version "10.2.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.2.tgz#48206bc114c1252940c41b25b41af5b545aca878" + integrity sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -5747,15 +6072,10 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -"lru-cache@^9.1.1 || ^10.0.0": - version "10.2.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" - integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q== - magic-string@^0.30.3, magic-string@^0.30.5: - version "0.30.8" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.8.tgz#14e8624246d2bedba70d5462aa99ac9681844613" - integrity sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ== + version "0.30.10" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.10.tgz#123d9c41a0cb5640c892b041d4cfb3bd0aa4b39e" + integrity sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ== dependencies: "@jridgewell/sourcemap-codec" "^1.4.15" @@ -5887,7 +6207,7 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -minimatch@9.0.3, minimatch@^9.0.1: +minimatch@9.0.3: version "9.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== @@ -5908,6 +6228,13 @@ minimatch@^5.0.1, minimatch@^5.1.1: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.1: + version "9.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51" + integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" @@ -5933,10 +6260,10 @@ minipass@^5.0.0: resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d" integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== -"minipass@^5.0.0 || ^6.0.2 || ^7.0.0": - version "7.0.4" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" - integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.0.4: + version "7.1.1" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.1.tgz#f7f85aff59aa22f110b20e27692465cf3bf89481" + integrity sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA== minizlib@^1.3.3: version "1.3.3" @@ -6007,7 +6334,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.1.1: +ms@2.1.3, ms@^2.0.0, ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -6093,6 +6420,17 @@ next-tick@^1.1.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== +nise@^5.1.9: + version "5.1.9" + resolved "https://registry.yarnpkg.com/nise/-/nise-5.1.9.tgz#0cb73b5e4499d738231a473cd89bd8afbb618139" + integrity sha512-qOnoujW4SV6e40dYxJOb3uvuoPHtmLzIk4TFo+j0jPJoC+5Z9xja5qH5JZobEPsa8+YYphMrOSwnrshEhG2qww== + dependencies: + "@sinonjs/commons" "^3.0.0" + "@sinonjs/fake-timers" "^11.2.2" + "@sinonjs/text-encoding" "^0.7.2" + just-extend "^6.2.0" + path-to-regexp "^6.2.1" + no-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d" @@ -6102,9 +6440,9 @@ no-case@^3.0.4: tslib "^2.0.3" node-abi@^3.3.0: - version "3.56.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.56.0.tgz#ca807d5ff735ac6bbbd684ae3ff2debc1c2a40a7" - integrity sha512-fZjdhDOeRcaS+rcpve7XuwHBmktS1nS1gzgghwKUQQ8nTy2FdSDr6ZT8k6YhvlJeHmmQMYiT/IH9hfco5zeW2Q== + version "3.62.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.62.0.tgz#017958ed120f89a3a14a7253da810f5d724e3f36" + integrity sha512-CPMcGa+y33xuL1E0TcNIu4YyaZCxnnvkVaEXrsosR3FxN+fV8xvb7Mzpb7IgKler10qeMkE6+Dp8qJhpzdq35g== dependencies: semver "^7.3.5" @@ -6128,7 +6466,12 @@ node-addon-api@^5.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== -node-fetch@^2.6.12: +node-domexception@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + +node-fetch@^2.6.12, node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -6136,9 +6479,9 @@ node-fetch@^2.6.12: whatwg-url "^5.0.0" node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: - version "4.8.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.0.tgz#3fee9c1731df4581a3f9ead74664369ff00d26dd" - integrity sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og== + version "4.8.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.1.tgz#976d3ad905e71b76086f4f0b0d3637fe79b6cda5" + integrity sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw== node-releases@^2.0.14: version "2.0.14" @@ -6242,39 +6585,41 @@ object.assign@^4.1.4, object.assign@^4.1.5: object-keys "^1.1.1" object.entries@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.7.tgz#2b47760e2a2e3a752f39dd874655c61a7f03c131" - integrity sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA== + version "1.1.8" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.8.tgz#bffe6f282e01f4d17807204a24f8edd823599c41" + integrity sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" object.fromentries@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.7.tgz#71e95f441e9a0ea6baf682ecaaf37fa2a8d7e616" - integrity sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA== + version "2.0.8" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.8.tgz#f7195d8a9b97bd95cbc1999ea939ecd1a2b00c65" + integrity sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-object-atoms "^1.0.0" object.hasown@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.3.tgz#6a5f2897bb4d3668b8e79364f98ccf971bda55ae" - integrity sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA== + version "1.1.4" + resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.4.tgz#e270ae377e4c120cdcb7656ce66884a6218283dc" + integrity sha512-FZ9LZt9/RHzGySlBARE3VF+gE26TxR38SdmqOqliuTnl9wrKulaQs+4dee1V+Io8VfxqzAfHu6YuRgUy8OHoTg== dependencies: - define-properties "^1.2.0" - es-abstract "^1.22.1" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-object-atoms "^1.0.0" object.values@^1.1.6, object.values@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.7.tgz#617ed13272e7e1071b43973aa1655d9291b8442a" - integrity sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng== + version "1.2.0" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.2.0.tgz#65405a9d92cee68ac2d303002e0b8470a4d9ab1b" + integrity sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" oboe@2.1.5: version "2.1.5" @@ -6305,17 +6650,31 @@ open@^7.4.2: is-docker "^2.0.0" is-wsl "^2.1.1" +openai@^4.38.2: + version "4.45.0" + resolved "https://registry.yarnpkg.com/openai/-/openai-4.45.0.tgz#cfec91b228b94c29b833666972692a44d2f64b79" + integrity sha512-uszUQrl9eQPCA9a7Zml+Eizb3mG0JDd8zUl528OM6Ccn039dqbOmUivL5s8zUM6iJMRMvNGRMXS9yuuR1Bv2sw== + dependencies: + "@types/node" "^18.11.18" + "@types/node-fetch" "^2.6.4" + abort-controller "^3.0.0" + agentkeepalive "^4.2.1" + form-data-encoder "1.7.2" + formdata-node "^4.3.2" + node-fetch "^2.6.7" + web-streams-polyfill "^3.2.1" + optionator@^0.9.3: - version "0.9.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" - integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== dependencies: - "@aashutoshrathi/word-wrap" "^1.2.3" deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" + word-wrap "^1.2.5" os-browserify@^0.3.0: version "0.3.0" @@ -6521,12 +6880,12 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-scurry@^1.10.1: - version "1.10.1" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698" - integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== +path-scurry@^1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.0.tgz#332d64e9726bf667fb348e5a1c71005c09ad741a" + integrity sha512-LNHTaVkzaYaLGlO+0u3rQTz7QrHTFOuKyba9JMTQutkmtNew8dw8wOD7mTU/5fCPZzCWpfW0XnQKzY61P0aTaw== dependencies: - lru-cache "^9.1.1 || ^10.0.0" + lru-cache "^10.2.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" path-to-regexp@0.1.7: @@ -6541,6 +6900,11 @@ path-to-regexp@^1.7.0: dependencies: isarray "0.0.1" +path-to-regexp@^6.2.1: + version "6.2.2" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.2.tgz#324377a83e5049cbecadc5554d6a63a9a4866b36" + integrity sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw== + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -6613,14 +6977,14 @@ postcss-value-parser@^3.3.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== -postcss@^8.4.35: - version "8.4.35" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.35.tgz#60997775689ce09011edf083a549cea44aabe2f7" - integrity sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA== +postcss@^8.4.38: + version "8.4.38" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" + integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== dependencies: nanoid "^3.3.7" picocolors "^1.0.0" - source-map-js "^1.0.2" + source-map-js "^1.2.0" prebuild-install@^7.0.1: version "7.1.2" @@ -6695,6 +7059,14 @@ promise-retry@^2.0.1: err-code "^2.0.2" retry "^0.12.0" +prop-types-extra@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/prop-types-extra/-/prop-types-extra-1.1.1.tgz#58c3b74cbfbb95d304625975aa2f0848329a010b" + integrity sha512-59+AHNnHYCdiC+vMwY52WmvP5dM3QLeoumYuEyceQDi9aEhtwN9zIQ2ZNo25sMyXnbh32h+P1ezDsUpUH3JAew== + dependencies: + react-is "^16.3.2" + warning "^4.0.0" + prop-types@^15.5.4, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" @@ -6772,9 +7144,9 @@ qs@6.11.0: side-channel "^1.0.4" qs@^6.11.2: - version "6.12.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.12.0.tgz#edd40c3b823995946a8a0b1f208669c7a200db77" - integrity sha512-trVZiI6RMOkO476zLGaBIzszOdFPnCCXHPG9kn0yuS1uz6xdVxPfZdB3vUig9pxPFDM9BRAgz/YUIVQ1/vuiUg== + version "6.12.1" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.12.1.tgz#39422111ca7cbdb70425541cba20c7d7b216599a" + integrity sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ== dependencies: side-channel "^1.0.6" @@ -6859,13 +7231,31 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +react-bootstrap@^2.10.2: + version "2.10.2" + resolved "https://registry.yarnpkg.com/react-bootstrap/-/react-bootstrap-2.10.2.tgz#3b609eb0170e31b3d9ace297d3a016c202a42642" + integrity sha512-UvB7mRqQjivdZNxJNEA2yOQRB7L9N43nBnKc33K47+cH90/ujmnMwatTCwQLu83gLhrzAl8fsa6Lqig/KLghaA== + dependencies: + "@babel/runtime" "^7.22.5" + "@restart/hooks" "^0.4.9" + "@restart/ui" "^1.6.8" + "@types/react-transition-group" "^4.4.6" + classnames "^2.3.2" + dom-helpers "^5.2.1" + invariant "^2.2.4" + prop-types "^15.8.1" + prop-types-extra "^1.1.0" + react-transition-group "^4.4.5" + uncontrollable "^7.2.1" + warning "^4.0.3" + react-dom@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" - integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4" + integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== dependencies: loose-envify "^1.1.0" - scheduler "^0.23.0" + scheduler "^0.23.2" react-hint@^3.2.1: version "3.2.1" @@ -6873,11 +7263,11 @@ react-hint@^3.2.1: integrity sha512-kQgH64w8xil47NdMvh87QADj91xeKhO5ZmzQJJ9iT9PqL4K1/ggGrdeIiUnCLpZH3RP0nAWtFWPe4VQG9bzCtg== react-hook-form@^7.51.0: - version "7.51.0" - resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.51.0.tgz#757ae71b37c26e00590bd3788508287dcc5ecdaf" - integrity sha512-BggOy5j58RdhdMzzRUHGOYhSz1oeylFAv6jUSG86OvCIvlAvS7KvnRY7yoAf2pfEiPN7BesnR0xx73nEk3qIiw== + version "7.51.4" + resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.51.4.tgz#c3a47aeb22b699c45de9fc12b58763606cb52f0c" + integrity sha512-V14i8SEkh+V1gs6YtD0hdHYnoL4tp/HX/A45wWQN15CYr9bFRmmRdYStSO5L65lCCZRF+kYiSKhm9alqbcdiVA== -react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0: +react-is@^16.13.1, react-is@^16.3.2, react-is@^16.6.0, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -6898,9 +7288,9 @@ react-modal@^3.16.1: warning "^4.0.3" react-modern-drawer@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/react-modern-drawer/-/react-modern-drawer-1.2.2.tgz#cee2d3355a1ac7ac0842d3fba33a28cd8f7f2464" - integrity sha512-SXUNjofHzeoEas0kdMWWafuF2+vwdtbQD1cpkHxo7oyFj3v+2l2CMeJjc/GodYsnxVhSiYj75xosMJXXed9ykQ== + version "1.3.1" + resolved "https://registry.yarnpkg.com/react-modern-drawer/-/react-modern-drawer-1.3.1.tgz#07db41bf5a45c7177b61e49c26e3950061c227ab" + integrity sha512-bT4KLgrnu98dL9NUpiHbg6dpp4zRH7M+VlS1zK6zCFgn6OLxjGEBRTf2ZYfVcibLGTkoRJxfD5l7zTqWtDLp+w== react-motion@^0.5.2: version "0.5.2" @@ -6912,17 +7302,17 @@ react-motion@^0.5.2: raf "^3.1.0" react-redux@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-9.1.0.tgz#46a46d4cfed4e534ce5452bb39ba18e1d98a8197" - integrity sha512-6qoDzIO+gbrza8h3hjMA9aq4nwVFCKFtY2iLxCtVT38Swyy2C/dJCGBXHeHLtx6qlg/8qzc2MrhOeduf5K32wQ== + version "9.1.2" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-9.1.2.tgz#deba38c64c3403e9abd0c3fbeab69ffd9d8a7e4b" + integrity sha512-0OA4dhM1W48l3uzmv6B7TXPCGmokUU4p1M44DGN2/D9a1FjVPukVjER1PcPX97jIg6aUeLq1XJo1IpfbgULn0w== dependencies: "@types/use-sync-external-store" "^0.0.3" use-sync-external-store "^1.0.0" react-refresh@^0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.0.tgz#4e02825378a5f227079554d4284889354e5f553e" - integrity sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ== + version "0.14.2" + resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9" + integrity sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA== react-router-dom@4.3.1: version "4.3.1" @@ -6973,7 +7363,7 @@ react-textarea-autosize@^8.5.3: use-composed-ref "^1.3.0" use-latest "^1.2.1" -react-transition-group@^4.3.0: +react-transition-group@^4.3.0, react-transition-group@^4.4.5: version "4.4.5" resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.5.tgz#e53d4e3f3344da8521489fbef8f2581d42becdd1" integrity sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g== @@ -6996,9 +7386,9 @@ react-virtualized@9.20.1: react-lifecycles-compat "^3.0.4" react@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" - integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== + version "18.3.1" + resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" + integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== dependencies: loose-envify "^1.1.0" @@ -7064,15 +7454,15 @@ reflect-metadata@^0.1.13: integrity sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A== reflect.getprototypeof@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.5.tgz#e0bd28b597518f16edaf9c0e292c631eb13e0674" - integrity sha512-62wgfC8dJWrmxv44CA36pLDnP6KKl3Vhxb7PL+8+qrrFMMoJij4vgiMP8zV4O8+CBMXY1mHxI5fITGHXFHVmQQ== + version "1.0.6" + resolved "https://registry.yarnpkg.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz#3ab04c32a8390b770712b7a8633972702d278859" + integrity sha512-fmfw4XgoDke3kdI6h4xcUz1dG8uaiv5q9gcEwLS4Pnth2kxT+GZ7YehS1JTMGBQmtV7Y4GFGbs2re2NqhdozUg== dependencies: - call-bind "^1.0.5" + call-bind "^1.0.7" define-properties "^1.2.1" - es-abstract "^1.22.3" - es-errors "^1.0.0" - get-intrinsic "^1.2.3" + es-abstract "^1.23.1" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" globalthis "^1.0.3" which-builtin-type "^1.1.3" @@ -7086,7 +7476,7 @@ regenerator-runtime@^0.14.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== -regexp.prototype.flags@^1.5.0, regexp.prototype.flags@^1.5.2: +regexp.prototype.flags@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz#138f644a3350f981a858c44f6bb1a61ff59be334" integrity sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw== @@ -7233,26 +7623,29 @@ roarr@^2.15.3: semver-compare "^1.0.0" sprintf-js "^1.1.2" -rollup@^4.2.0: - version "4.12.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.12.1.tgz#0659cb02551cde4c5b210e9bd3af050b5b5b415d" - integrity sha512-ggqQKvx/PsB0FaWXhIvVkSWh7a/PCLQAsMjBc+nA2M8Rv2/HG0X6zvixAB7KyZBRtifBUhy5k8voQX/mRnABPg== +rollup@^4.13.0: + version "4.17.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.17.2.tgz#26d1785d0144122277fdb20ab3a24729ae68301f" + integrity sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ== dependencies: "@types/estree" "1.0.5" optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.12.1" - "@rollup/rollup-android-arm64" "4.12.1" - "@rollup/rollup-darwin-arm64" "4.12.1" - "@rollup/rollup-darwin-x64" "4.12.1" - "@rollup/rollup-linux-arm-gnueabihf" "4.12.1" - "@rollup/rollup-linux-arm64-gnu" "4.12.1" - "@rollup/rollup-linux-arm64-musl" "4.12.1" - "@rollup/rollup-linux-riscv64-gnu" "4.12.1" - "@rollup/rollup-linux-x64-gnu" "4.12.1" - "@rollup/rollup-linux-x64-musl" "4.12.1" - "@rollup/rollup-win32-arm64-msvc" "4.12.1" - "@rollup/rollup-win32-ia32-msvc" "4.12.1" - "@rollup/rollup-win32-x64-msvc" "4.12.1" + "@rollup/rollup-android-arm-eabi" "4.17.2" + "@rollup/rollup-android-arm64" "4.17.2" + "@rollup/rollup-darwin-arm64" "4.17.2" + "@rollup/rollup-darwin-x64" "4.17.2" + "@rollup/rollup-linux-arm-gnueabihf" "4.17.2" + "@rollup/rollup-linux-arm-musleabihf" "4.17.2" + "@rollup/rollup-linux-arm64-gnu" "4.17.2" + "@rollup/rollup-linux-arm64-musl" "4.17.2" + "@rollup/rollup-linux-powerpc64le-gnu" "4.17.2" + "@rollup/rollup-linux-riscv64-gnu" "4.17.2" + "@rollup/rollup-linux-s390x-gnu" "4.17.2" + "@rollup/rollup-linux-x64-gnu" "4.17.2" + "@rollup/rollup-linux-x64-musl" "4.17.2" + "@rollup/rollup-win32-arm64-msvc" "4.17.2" + "@rollup/rollup-win32-ia32-msvc" "4.17.2" + "@rollup/rollup-win32-x64-msvc" "4.17.2" fsevents "~2.3.2" run-parallel@^1.1.9: @@ -7262,7 +7655,7 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -safe-array-concat@^1.1.0: +safe-array-concat@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.2.tgz#81d77ee0c4e8b863635227c721278dd524c20edb" integrity sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q== @@ -7319,10 +7712,10 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.3.0.tgz#a5dbe77db3be05c9d1ee7785dbd3ea9de51593d0" integrity sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA== -scheduler@^0.23.0: - version "0.23.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" - integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== +scheduler@^0.23.2: + version "0.23.2" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3" + integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== dependencies: loose-envify "^1.1.0" @@ -7365,11 +7758,9 @@ semver@^6.2.0, semver@^6.3.1: integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.2.1, semver@^7.3.2, semver@^7.3.5, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4: - version "7.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" - integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== - dependencies: - lru-cache "^6.0.0" + version "7.6.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" + integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== send@0.18.0: version "0.18.0" @@ -7435,7 +7826,7 @@ set-function-length@^1.2.1: gopd "^1.0.1" has-property-descriptors "^1.0.2" -set-function-name@^2.0.0, set-function-name@^2.0.1: +set-function-name@^2.0.1, set-function-name@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.2.tgz#16a705c5a0dc2f5e638ca96d8a8cd4e1c2b90985" integrity sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ== @@ -7530,6 +7921,18 @@ simple-update-notifier@2.0.0: dependencies: semver "^7.5.3" +sinon@^17.0.1: + version "17.0.2" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-17.0.2.tgz#470894bcc2d24b01bad539722ea46da949892405" + integrity sha512-uihLiaB9FhzesElPDFZA7hDcNABzsVHwr3YfmM9sBllVwab3l0ltGlRV1XhpNfIacNDLGD1QRZNLs5nU5+hTuA== + dependencies: + "@sinonjs/commons" "^3.0.1" + "@sinonjs/fake-timers" "^11.2.2" + "@sinonjs/samsam" "^8.0.0" + diff "^5.2.0" + nise "^5.1.9" + supports-color "^7" + slash@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" @@ -7613,10 +8016,10 @@ sort-keys@^1.0.0: dependencies: is-plain-obj "^1.0.0" -source-map-js@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" - integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== +source-map-js@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" + integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== source-map-support@^0.5.19: version "0.5.21" @@ -7708,46 +8111,50 @@ string-width@^5.0.1, string-width@^5.1.2: strip-ansi "^7.0.1" string.prototype.matchall@^4.0.10: - version "4.0.10" - resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz#a1553eb532221d4180c51581d6072cd65d1ee100" - integrity sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ== + version "4.0.11" + resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz#1092a72c59268d2abaad76582dccc687c0297e0a" + integrity sha512-NUdh0aDavY2og7IbBPenWqR9exH+E26Sv8e0/eTe1tltDGZL+GtBkDAnnyBtmekfK6/Dq3MkcGtzXFEd1LQrtg== dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - get-intrinsic "^1.2.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + get-intrinsic "^1.2.4" + gopd "^1.0.1" has-symbols "^1.0.3" - internal-slot "^1.0.5" - regexp.prototype.flags "^1.5.0" - set-function-name "^2.0.0" - side-channel "^1.0.4" + internal-slot "^1.0.7" + regexp.prototype.flags "^1.5.2" + set-function-name "^2.0.2" + side-channel "^1.0.6" -string.prototype.trim@^1.2.8: - version "1.2.8" - resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" - integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== +string.prototype.trim@^1.2.9: + version "1.2.9" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz#b6fa326d72d2c78b6df02f7759c73f8f6274faa4" + integrity sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw== dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.0" + es-object-atoms "^1.0.0" -string.prototype.trimend@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e" - integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== +string.prototype.trimend@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz#3651b8513719e8a9f48de7f2f77640b26652b229" + integrity sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ== dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" -string.prototype.trimstart@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" - integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== +string.prototype.trimstart@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz#7ee834dda8c7c17eff3118472bb35bfedaa34dde" + integrity sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg== dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" string_decoder@^1.0.0, string_decoder@^1.1.1: version "1.3.0" @@ -7839,7 +8246,7 @@ supports-color@^5.3.0, supports-color@^5.5.0: dependencies: has-flag "^3.0.0" -supports-color@^7.1.0: +supports-color@^7, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== @@ -7921,9 +8328,9 @@ tar@^4.0.2: yallist "^3.1.1" tar@^6.1.12: - version "6.2.0" - resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.0.tgz#b14ce49a79cb1cd23bc9b016302dea5474493f73" - integrity sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ== + version "6.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" + integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A== dependencies: chownr "^2.0.0" fs-minipass "^2.0.0" @@ -8038,7 +8445,7 @@ ts-api-utils@^1.0.1: resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== -tslib@^2.0.3, tslib@^2.1.0, tslib@^2.2.0, tslib@^2.6.2: +tslib@^2.0.3, tslib@^2.1.0, tslib@^2.2.0, tslib@^2.4.0, tslib@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== @@ -8074,6 +8481,11 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" +type-detect@4.0.8, type-detect@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + type-fest@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934" @@ -8129,10 +8541,10 @@ typed-array-byte-offset@^1.0.2: has-proto "^1.0.3" is-typed-array "^1.1.13" -typed-array-length@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.5.tgz#57d44da160296d8663fd63180a1802ebf25905d5" - integrity sha512-yMi0PlwuznKHxKmcpoOdeLwxBoVPkqZxd7q2FgMkmD3bNwvF5VW0+UlUQ1k1vmktTu4Yu13Q0RIxEP8+B+wloA== +typed-array-length@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.6.tgz#57155207c76e64a3457482dfdc1c9d1d3c4c73a3" + integrity sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g== dependencies: call-bind "^1.0.7" for-each "^0.3.3" @@ -8149,9 +8561,9 @@ typedarray-to-buffer@^3.1.5: is-typedarray "^1.0.0" typescript@^5.3.3: - version "5.4.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372" - integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ== + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== ultron@~1.1.0: version "1.1.1" @@ -8168,6 +8580,21 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +uncontrollable@^7.2.1: + version "7.2.1" + resolved "https://registry.yarnpkg.com/uncontrollable/-/uncontrollable-7.2.1.tgz#1fa70ba0c57a14d5f78905d533cf63916dc75738" + integrity sha512-svtcfoTADIB0nT9nltgjujTi7BzVmwjZClOmskKu/E8FW9BXzg9os8OLr4f8Dlnk0rYWJIWr4wv9eKUXiQvQwQ== + dependencies: + "@babel/runtime" "^7.6.3" + "@types/react" ">=16.9.11" + invariant "^2.2.4" + react-lifecycles-compat "^3.0.4" + +uncontrollable@^8.0.1: + version "8.0.4" + resolved "https://registry.yarnpkg.com/uncontrollable/-/uncontrollable-8.0.4.tgz#a0a8307f638795162fafd0550f4a1efa0f8c5eb6" + integrity sha512-ulRWYWHvscPFc0QQXvyJjY6LIXU56f0h8pQFvhxiKk5V1fcI8gp9Ht9leVAhrVjzqMw0BgjspBINx9r6oyJUvQ== + underscore@~1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.4.4.tgz#61a6a32010622afa07963bf325203cf12239d604" @@ -8219,11 +8646,11 @@ unzip-crx-3@^0.2.0: yaku "^0.16.6" update-browserslist-db@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" - integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== + version "1.0.15" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.15.tgz#60ed9f8cba4a728b7ecf7356f641a31e3a691d97" + integrity sha512-K9HWH62x3/EalU1U6sjSZiylm9C8tgq2mSvshZpqc7QE69RaA2qjhkW2HlNA0tFpEbtyFz7HTqbSdN4MSwUodA== dependencies: - escalade "^3.1.1" + escalade "^3.1.2" picocolors "^1.0.0" uri-js@^4.2.2: @@ -8264,9 +8691,9 @@ use-latest@^1.2.1: use-isomorphic-layout-effect "^1.1.1" use-sync-external-store@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" - integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== + version "1.2.2" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz#c3b6390f3a30eba13200d2302dcdf1e7b57b2ef9" + integrity sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw== utf-8-validate@^5.0.2: version "5.0.10" @@ -8377,13 +8804,13 @@ vite-plugin-svgr@^4.2.0: "@svgr/plugin-jsx" "^8.1.0" vite@^5.0.12: - version "5.1.5" - resolved "https://registry.yarnpkg.com/vite/-/vite-5.1.5.tgz#bdbc2b15e8000d9cc5172f059201178f9c9de5fb" - integrity sha512-BdN1xh0Of/oQafhU+FvopafUp6WaYenLU/NFoL5WyJL++GxkNfieKzBhM24H3HVsPQrlAqB7iJYTHabzaRed5Q== + version "5.2.11" + resolved "https://registry.yarnpkg.com/vite/-/vite-5.2.11.tgz#726ec05555431735853417c3c0bfb36003ca0cbd" + integrity sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ== dependencies: - esbuild "^0.19.3" - postcss "^8.4.35" - rollup "^4.2.0" + esbuild "^0.20.1" + postcss "^8.4.38" + rollup "^4.13.0" optionalDependencies: fsevents "~2.3.3" @@ -8392,13 +8819,23 @@ vm-browserify@^1.0.1: resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== -warning@^4.0.1, warning@^4.0.3: +warning@^4.0.0, warning@^4.0.1, warning@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3" integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w== dependencies: loose-envify "^1.0.0" +web-streams-polyfill@4.0.0-beta.3: + version "4.0.0-beta.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz#2898486b74f5156095e473efe989dcf185047a38" + integrity sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug== + +web-streams-polyfill@^3.2.1: + version "3.3.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" + integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== + web3-bzz@1.10.4: version "1.10.4" resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.10.4.tgz#dcc787970767d9004c73d11d0eeef774ce16b880" @@ -8705,16 +9142,16 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== -which-typed-array@^1.1.14, which-typed-array@^1.1.2, which-typed-array@^1.1.9: - version "1.1.14" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.14.tgz#1f78a111aee1e131ca66164d8bdc3ab062c95a06" - integrity sha512-VnXFiIW8yNn9kIHN88xvZ4yOWchftKDsRJ8fEPacX/wl1lOvBrhsJ/OeJCXq7B0AaijRuqgzSKalJoPk+D8MPg== +which-typed-array@^1.1.14, which-typed-array@^1.1.15, which-typed-array@^1.1.2, which-typed-array@^1.1.9: + version "1.1.15" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.15.tgz#264859e9b11a649b388bfaaf4f767df1f779b38d" + integrity sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA== dependencies: - available-typed-arrays "^1.0.6" - call-bind "^1.0.5" + available-typed-arrays "^1.0.7" + call-bind "^1.0.7" for-each "^0.3.3" gopd "^1.0.1" - has-tostringtag "^1.0.1" + has-tostringtag "^1.0.2" which@^2.0.1: version "2.0.2" @@ -8723,6 +9160,11 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +word-wrap@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== + "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" @@ -8865,9 +9307,9 @@ yaml@^1.10.0: integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== yaml@^2.2.2: - version "2.4.1" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.1.tgz#2e57e0b5e995292c25c75d2658f0664765210eed" - integrity sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg== + version "2.4.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.2.tgz#7a2b30f2243a5fc299e1f14ca58d475ed4bc5362" + integrity sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA== yargs-parser@^18.1.2: version "18.1.3"