From 01de5749f2dd6e1b107984d57e3dc710de91c936 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 24 Aug 2023 19:34:20 +0000 Subject: [PATCH] build based on 0ff0b46 --- latest/api/index.html | 124 +++++++++++++++--------------- latest/bugs/index.html | 2 +- latest/build-a-binary/index.html | 2 +- latest/call-julia/index.html | 2 +- latest/calling-another/index.html | 2 +- latest/configuration/index.html | 2 +- latest/contributing/index.html | 2 +- latest/index.html | 2 +- latest/output/index.html | 2 +- latest/provided-binary/index.html | 2 +- latest/search/index.html | 2 +- 11 files changed, 72 insertions(+), 72 deletions(-) diff --git a/latest/api/index.html b/latest/api/index.html index 23b255f..605fbd2 100644 --- a/latest/api/index.html +++ b/latest/api/index.html @@ -19,7 +19,7 @@ julia> SemioticOpt.x(alg) 2-element Vector{Float64}: 2.5 - 2.5source
AllocationOpt.allocatablesubgraphsMethod
 allocatablesubgraphs(s::FlexTable, config::AbstractDict)

For the subgraphs s return a view of the subgraphs on which we can allocate.

julia> using AllocationOpt
+ 2.5
source
AllocationOpt.allocatablesubgraphsMethod
 allocatablesubgraphs(s::FlexTable, config::AbstractDict)

For the subgraphs s return a view of the subgraphs on which we can allocate.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> s = flextable([
             Dict("ipfsHash" => "Qma", "signalledTokens" => 10,),
@@ -38,7 +38,7 @@
      signalledTokens  ipfsHash
    ┌──────────────────────────
  1 │ 20               Qmb
- 2 │ 5                Qmc
source
AllocationOpt.allocate_actionMethod
allocate_action(::Val{:actionqueue}, a::FlexTable, t::FlexTable, config::AbstractDict)

Create and push allocate actions to the action queue.

julia> using AllocationOpt
+ 2 │ 5                Qmc
source
AllocationOpt.allocate_actionMethod
allocate_action(::Val{:actionqueue}, a::FlexTable, t::FlexTable, config::AbstractDict)

Create and push allocate actions to the action queue.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> a = flextable([
             Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa")
@@ -53,7 +53,7 @@
 julia> TheGraphData.client!(config["indexer_url"])
 julia> AllocationOpt.allocate_action(Val(:actionqueue), a, t, Dict())
 1-element Vector{Dict{String, Any}}:
- Dict("amount" => "2", "priority" => 0, "status" => AllocationOpt.queued, "source" => "AllocationOpt", "reason" => "Expected profit: 0", "type" => AllocationOpt.allocate, "deploymentID" => "Qmb")
source
AllocationOpt.allocate_actionMethod
allocate_action(::Val{:none}, a, t, config)

Do nothing.

julia> using AllocationOpt
+ Dict("amount" => "2", "priority" => 0, "status" => AllocationOpt.queued, "source" => "AllocationOpt", "reason" => "Expected profit: 0", "type" => AllocationOpt.allocate, "deploymentID" => "Qmb")
source
AllocationOpt.allocate_actionMethod
allocate_action(::Val{:none}, a, t, config)

Do nothing.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> a = flextable([
             Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa")
@@ -62,10 +62,10 @@
             Dict("amount" => "1", "profit" => "0", "ipfshash" => "Qma"),
             Dict("amount" => "2", "profit" => "0", "ipfshash" => "Qmb"),
         ])
-julia> AllocationOpt.allocate_action(Val(:none), a, t, Dict())
source
AllocationOpt.allocate_actionMethod
allocate_action(::Val{:rules}, a::FlexTable, t::FlexTable, config::AbstractDict)

Print the rules that allocates to new subgraphs.

```julia julia> using AllocationOpt julia> using TheGraphData julia> a = flextable([ Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa") ]) julia> t = flextable([ Dict("amount" => "1", "profit" => "0", "ipfshash" => "Qma"), Dict("amount" => "2", "profit" => "0", "ipfshash" => "Qmb"), ]) julia> AllocationOpt.allocate_action(Val(:rules), a, t, Dict()) graph indexer rules set Qmb decisionBasis always allocationAmount 2 1-element Vector{String}: "graph indexer rules set Qmb decisionBasis always allocationAmount 2"

source
AllocationOpt.aqueryMethod
aquery(id::AbstractString)

Return the components of a GraphQL query for active allocations of indexer id.

For use with the TheGraphData.jl package.

julia> using AllocationOpt
+julia> AllocationOpt.allocate_action(Val(:none), a, t, Dict())
source
AllocationOpt.allocate_actionMethod
allocate_action(::Val{:rules}, a::FlexTable, t::FlexTable, config::AbstractDict)

Print the rules that allocates to new subgraphs.

```julia julia> using AllocationOpt julia> using TheGraphData julia> a = flextable([ Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa") ]) julia> t = flextable([ Dict("amount" => "1", "profit" => "0", "ipfshash" => "Qma"), Dict("amount" => "2", "profit" => "0", "ipfshash" => "Qmb"), ]) julia> AllocationOpt.allocate_action(Val(:rules), a, t, Dict()) graph indexer rules set Qmb decisionBasis always allocationAmount 2 1-element Vector{String}: "graph indexer rules set Qmb decisionBasis always allocationAmount 2"

source
AllocationOpt.aqueryMethod
aquery(id::AbstractString)

Return the components of a GraphQL query for active allocations of indexer id.

For use with the TheGraphData.jl package.

julia> using AllocationOpt
 julia> id = "0xa"
 julia> value, args, fields = AllocationOpt.aquery(id)
-("allocations", Dict{String, Union{Dict{String, String}, String}}("where" => Dict("status" => "Active", "indexer" => "0xa")), ["allocatedTokens", "id", "subgraphDeployment{ipfsHash}"])

Extended Help

You can find TheGraphData.jl at https://github.com/semiotic-ai/TheGraphData.jl

source
AllocationOpt.availablestakeMethod
available(::Val{:indexer}, x)

The tokens available for the indexer to allocate in table x.

julia> using AllocationOpt
+("allocations", Dict{String, Union{Dict{String, String}, String}}("where" => Dict("status" => "Active", "indexer" => "0xa")), ["allocatedTokens", "id", "subgraphDeployment{ipfsHash}"])

Extended Help

You can find TheGraphData.jl at https://github.com/semiotic-ai/TheGraphData.jl

source
AllocationOpt.availablestakeMethod
available(::Val{:indexer}, x)

The tokens available for the indexer to allocate in table x.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict(
@@ -75,16 +75,16 @@
     ),
 ])
 julia> AllocationOpt.availablestake(Val(:indexer), x)
-25.0
source
AllocationOpt.bestprofitpernzMethod
bestprofitpernz(ixs::AbstractVector{Integer}, profitmatrix::AbstractMatrix{Real})

Compute the best profit amongst the given ixs given profit matrix p

julia> using AllocationOpt
+25.0
source
AllocationOpt.bestprofitpernzMethod
bestprofitpernz(ixs::AbstractVector{Integer}, profitmatrix::AbstractMatrix{Real})

Compute the best profit amongst the given ixs given profit matrix p

julia> using AllocationOpt
 julia> ixs = Dict([1] => [1], [2] => [2])
 julia> profitmatrix = [[2.5 5.0]; [2.5 1.0]]
 julia> AllocationOpt.bestprofitpernz.(values(ixs), Ref(profitmatrix))
 2-element Vector{NamedTuple{(:profit, :index), Tuple{Float64, Int64}}}:
  (profit = 5.0, index = 1)
- (profit = 6.0, index = 2)
source
AllocationOpt.blockissuanceMethod
blockissuance(::Val{:network}, x)

The tokens issued per block.

```julia julia> using AllocationOpt julia> using TheGraphData julia> n = flextable([ Dict( "id" => 1, "networkGRTIssuancePerBlock" => 1, "epochLength" => 28, "totalTokensSignalled" => 2, "currentEpoch" => 1, ) ]) julia> AllocationOpt.blockissuance(Val(:network), n) 1

source
AllocationOpt.blocksperepochMethod
blocksperepoch(::Val{:network}, x)

The number of blocks in each epoch.

```julia julia> using AllocationOpt julia> using TheGraphData julia> n = flextable([ Dict( "id" => 1, "networkGRTIssuancePerBlock" => 1, "epochLength" => 28, "totalTokensSignalled" => 2, "currentEpoch" => 1, ) ]) julia> AllocationOpt.blocksperepoch(Val(:network), n) 28

source
AllocationOpt.closeipfsMethod
closeipfs(existingipfs, proposedipfs, frozenlist)

Get the list of the ipfs hashes of allocations to close.

julia> using AllocationOpt
+ (profit = 6.0, index = 2)
source
AllocationOpt.blockissuanceMethod
blockissuance(::Val{:network}, x)

The tokens issued per block.

```julia julia> using AllocationOpt julia> using TheGraphData julia> n = flextable([ Dict( "id" => 1, "networkGRTIssuancePerBlock" => 1, "epochLength" => 28, "totalTokensSignalled" => 2, "currentEpoch" => 1, ) ]) julia> AllocationOpt.blockissuance(Val(:network), n) 1

source
AllocationOpt.blocksperepochMethod
blocksperepoch(::Val{:network}, x)

The number of blocks in each epoch.

```julia julia> using AllocationOpt julia> using TheGraphData julia> n = flextable([ Dict( "id" => 1, "networkGRTIssuancePerBlock" => 1, "epochLength" => 28, "totalTokensSignalled" => 2, "currentEpoch" => 1, ) ]) julia> AllocationOpt.blocksperepoch(Val(:network), n) 28

source
AllocationOpt.closeipfsMethod
closeipfs(existingipfs, proposedipfs, frozenlist)

Get the list of the ipfs hashes of allocations to close.

julia> using AllocationOpt
 julia> AllocationOpt.closeipfs(["Qma"], ["Qmb"], String[])
 1-element Vector{String}:
- "Qma"
source
AllocationOpt.configuredefaults!Method
configuredefaults!(config::AbstractDict)

Set default values for the config dictionary if the value was not specified in the config file.

Config Specification

  • id::String: The ID of the indexer for whom we're optimising. No default value.
  • network_subgraph_endpoint::String: The network subgraph endpoint to query. By default, "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet"
  • writedir::String: The directory to which to write the results of optimisation. If don't specify readdir, writedir also specifies the path to which to save the input data tables. By default, "."
  • readdir::Union{String, Nothing}: The directory from which to read saved data tables. This speeds up the process as we won't have to query the network subgraph for the relevant data. If you don't specify readdir, we will query your specified network_subgraph_endpoint for the data and write it to CSV files in writedir. This way, you can use your previous writedir as your readdir in future runs. By default, nothing
  • whitelist::Vector{String}: A list of subgraph IPFS hashes that you want to consider as candidates to which to allocate. If you leave this empty, we'll assume all subgraphs are in the whitelist. By default, String[]
  • blacklist::Vector{String}: A list of subgraph IPFS hashes that you do not want to consider allocating to. For example, this list could include broken subgraphs or subgraphs that you don't want to index. By default, String[]
  • frozenlist::Vector{String}: If you have open allocations that you don't want to change, add the corresponding subgraph IPFS hashes to this list. By default, String[]
  • pinnedlist::Vector{String}: If you have subgraphs that you absolutely want to be allocated to, even if only with a negligible amount of GRT, add it to this list. By default, String[]
  • allocation_lifetime::Integer: The number of epochs for which you expect the allocations the optimiser finds to be open. By default, 28
  • gas::Real: The estimated gas cost in GRT to open/close allocations. By default, 100
  • min_signal::Real: The minimum amount of signal in GRT that must be on a subgraph in order for you to consider allocating to it. By default, 1000
  • max_allocations::Integer: The maximum number of new allocations you'd like the optimiser to consider opening. By default, 10
  • num_reported_options::Integer: The number of proposed allocation strategies to report. For example, if you select 10 we'd report best 10 allocation strategies ranked by profit. By default, 1
  • verbose::Bool: If true, the optimiser will print details about what it is doing to stdout. By default, false
  • execution_mode::String: How the optimiser should execute the allocation strategies it finds. Options are "none", which won't do anything, "actionqueue", which will push actions to the action queue, and "rules", which will generate indexing rules. By default, "none"
  • indexer_url::Union{String, Nothing}: The URL of the indexer management server you want to execute the allocation strategies on. If you specify "actionqueue", you must also specify indexer_url. By default, nothing
  • opt_mode::String: We support two optimisation modes. One is "fast". This mode is fast, but may not find the optimal strategy. This mode is also used to the top num_reported_options allocation strategies. The other mode is "optimal". This mode is slower, but it satisfy stronger optimality conditions. It will find strategies at least as good as "fast", but not guaranteed to be better. In general, we recommend exploring config options using "fast" mode first, and then using "optimal" mode to find the optimal allocation. By default, "optimal"
julia> using AllocationOpt
+ "Qma"
source
AllocationOpt.configuredefaults!Method
configuredefaults!(config::AbstractDict)

Set default values for the config dictionary if the value was not specified in the config file.

Config Specification

  • id::String: The ID of the indexer for whom we're optimising. No default value.
  • network_subgraph_endpoint::String: The network subgraph endpoint to query. By default, "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet"
  • writedir::String: The directory to which to write the results of optimisation. If don't specify readdir, writedir also specifies the path to which to save the input data tables. By default, "."
  • readdir::Union{String, Nothing}: The directory from which to read saved data tables. This speeds up the process as we won't have to query the network subgraph for the relevant data. If you don't specify readdir, we will query your specified network_subgraph_endpoint for the data and write it to CSV files in writedir. This way, you can use your previous writedir as your readdir in future runs. By default, nothing
  • whitelist::Vector{String}: A list of subgraph IPFS hashes that you want to consider as candidates to which to allocate. If you leave this empty, we'll assume all subgraphs are in the whitelist. By default, String[]
  • blacklist::Vector{String}: A list of subgraph IPFS hashes that you do not want to consider allocating to. For example, this list could include broken subgraphs or subgraphs that you don't want to index. By default, String[]
  • frozenlist::Vector{String}: If you have open allocations that you don't want to change, add the corresponding subgraph IPFS hashes to this list. By default, String[]
  • pinnedlist::Vector{String}: If you have subgraphs that you absolutely want to be allocated to, even if only with a negligible amount of GRT, add it to this list. By default, String[]
  • allocation_lifetime::Integer: The number of epochs for which you expect the allocations the optimiser finds to be open. By default, 28
  • gas::Real: The estimated gas cost in GRT to open/close allocations. By default, 100
  • min_signal::Real: The minimum amount of signal in GRT that must be on a subgraph in order for you to consider allocating to it. By default, 1000
  • max_allocations::Integer: The maximum number of new allocations you'd like the optimiser to consider opening. By default, 10
  • num_reported_options::Integer: The number of proposed allocation strategies to report. For example, if you select 10 we'd report best 10 allocation strategies ranked by profit. By default, 1
  • verbose::Bool: If true, the optimiser will print details about what it is doing to stdout. By default, false
  • execution_mode::String: How the optimiser should execute the allocation strategies it finds. Options are "none", which won't do anything, "actionqueue", which will push actions to the action queue, and "rules", which will generate indexing rules. By default, "none"
  • indexer_url::Union{String, Nothing}: The URL of the indexer management server you want to execute the allocation strategies on. If you specify "actionqueue", you must also specify indexer_url. By default, nothing
  • opt_mode::String: We support two optimisation modes. One is "fast". This mode is fast, but may not find the optimal strategy. This mode is also used to the top num_reported_options allocation strategies. The other mode is "optimal". This mode is slower, but it satisfy stronger optimality conditions. It will find strategies at least as good as "fast", but not guaranteed to be better. In general, we recommend exploring config options using "fast" mode first, and then using "optimal" mode to find the optimal allocation. By default, "optimal"
julia> using AllocationOpt
 julia> config = Dict{String, Any}("id" => "0xa")
 julia> config = AllocationOpt.configuredefaults!(config)
 Dict{String, Any} with 16 entries:
@@ -102,7 +102,7 @@
   "min_signal"                => 1000
   "network_subgraph_endpoint" => "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet"
   "whitelist"                 => String[]
-  ⋮                           => ⋮
source
AllocationOpt.correcttypes!Method
correcttypes!(i::FlexTable, a::FlexTable, s::FlexTable, n::FlexTable)

Convert all tables to be in GRT.

julia> using AllocationOpt
+  ⋮                           => ⋮
source
AllocationOpt.correcttypes!Method
correcttypes!(i::FlexTable, a::FlexTable, s::FlexTable, n::FlexTable)

Convert all tables to be in GRT.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> i = flextable([
     Dict(
@@ -134,7 +134,7 @@
         "currentEpoch" => 1,
     )
 ])
-julia> i, a, s, n = AllocationOpt.correcttypes!(i, a, s, n)
source
AllocationOpt.correcttypes!Method
correcttypes!(::Val{:allocation}, a::FlexTable)

Convert the string currency fields in the allocation table to be in GRT.

julia> using AllocationOpt
+julia> i, a, s, n = AllocationOpt.correcttypes!(i, a, s, n)
source
AllocationOpt.correcttypes!Method
correcttypes!(::Val{:allocation}, a::FlexTable)

Convert the string currency fields in the allocation table to be in GRT.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> a = flextable([
     Dict(
@@ -146,7 +146,7 @@
 FlexTable with 2 columns and 1 row:
      subgraphDeployment.ipfsHash  allocatedTokens
    ┌─────────────────────────────────────────────
- 1 │ Qma                          1.0e-18
source
AllocationOpt.correcttypes!Method
correcttypes!(::Val{:indexer}, i::FlexTable)

Convert the string currency fields in the indexer table to be in GRT.

julia> using AllocationOpt
+ 1 │ Qma                          1.0e-18
source
AllocationOpt.correcttypes!Method
correcttypes!(::Val{:indexer}, i::FlexTable)

Convert the string currency fields in the indexer table to be in GRT.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> i = flextable([
     Dict(
@@ -160,7 +160,7 @@
 FlexTable with 4 columns and 1 row:
      stakedTokens  delegatedTokens  id   lockedTokens
    ┌─────────────────────────────────────────────────
- 1 │ 1.0e-18       0.0              0xa  0.0
source
AllocationOpt.correcttypes!Method
correcttypes!(::Val{:network}, n::FlexTable)

Convert the string currency fields in the network table to be in GRT.

julia> using AllocationOpt
+ 1 │ 1.0e-18       0.0              0xa  0.0
source
AllocationOpt.correcttypes!Method
correcttypes!(::Val{:network}, n::FlexTable)

Convert the string currency fields in the network table to be in GRT.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> n = flextable([
     Dict(
@@ -175,7 +175,7 @@
 FlexTable with 6 columns and 1 row:
     totalTokensSignalled  currentEpoch  id  networkGRTIssuancePerBlock  epochLength
 ┌────────────────────────────────────────────────────────────────────────────────
-1 │ 2.0e-18               1             1   1.0e-18                     28
source
AllocationOpt.correcttypes!Method
correcttypes!(::Val{:subgraph}, s::FlexTable)

Convert the string currency fields in the subgraph table to be in GRT.

julia> using AllocationOpt
+1 │ 2.0e-18               1             1   1.0e-18                     28
source
AllocationOpt.correcttypes!Method
correcttypes!(::Val{:subgraph}, s::FlexTable)

Convert the string currency fields in the subgraph table to be in GRT.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> s = flextable([
     Dict(
@@ -189,7 +189,7 @@
 FlexTable with 4 columns and 1 row:
      deniedAt  stakedTokens  signalledTokens  ipfsHash
    ┌──────────────────────────────────────────────────
- 1 │ 0         1.0e-18       0.0              Qma
source
AllocationOpt.currentepochMethod
currentepoch(::Val{:network}, x)

The current epoch.

```julia julia> using AllocationOpt julia> using TheGraphData julia> n = flextable([ Dict( "id" => 1, "networkGRTIssuancePerBlock" => 1, "epochLength" => 28, "totalTokensSignalled" => 2, "currentEpoch" => 1, ) ]) julia> AllocationOpt.currentepoch(Val(:network), n) 1

source
AllocationOpt.delegationMethod
delegation(::Val{:indexer}, x)

The tokens delegated to the indexer in table x.

julia> using AllocationOpt
+ 1 │ 0         1.0e-18       0.0              Qma
source
AllocationOpt.currentepochMethod
currentepoch(::Val{:network}, x)

The current epoch.

```julia julia> using AllocationOpt julia> using TheGraphData julia> n = flextable([ Dict( "id" => 1, "networkGRTIssuancePerBlock" => 1, "epochLength" => 28, "totalTokensSignalled" => 2, "currentEpoch" => 1, ) ]) julia> AllocationOpt.currentepoch(Val(:network), n) 1

source
AllocationOpt.delegationMethod
delegation(::Val{:indexer}, x)

The tokens delegated to the indexer in table x.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict(
@@ -197,7 +197,7 @@
     ),
 ])
 julia> AllocationOpt.delegation(Val(:indexer), x)
-10
source
AllocationOpt.deniedatMethod
deniedat(::Val{:subgraph}, x)

If this value is non-zero, the subgraph doesn't receive indexing rewards.

julia> using AllocationOpt
+10
source
AllocationOpt.deniedatMethod
deniedat(::Val{:subgraph}, x)

If this value is non-zero, the subgraph doesn't receive indexing rewards.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict("deniedAt" => 10,),
@@ -206,7 +206,7 @@
 julia> AllocationOpt.deniedat(Val(:subgraph), x)
 2-element view(transpose(lazystack(::Vector{Vector{Int64}})), :, 1) with eltype Int64:
  10
-  0
source
AllocationOpt.deniedzeroixsMethod
deniedzeroixs(s::FlexTable)

Find the indices of subgraphs that have "deniedAt" equal to zero.

julia> using AllocationOpt
+  0
source
AllocationOpt.deniedzeroixsMethod
deniedzeroixs(s::FlexTable)

Find the indices of subgraphs that have "deniedAt" equal to zero.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> s = flextable([
            Dict("ipfsHash" => "Qma", "signalledTokens" => 5.0, "deniedAt" => 0),
@@ -216,7 +216,7 @@
 julia> AllocationOpt.deniedzeroixs(s)
 2-element Vector{Int64}:
  1
- 3
source
AllocationOpt.dualMethod
dual(Ω, ψ, σ)

Analytic solution of the dual form of the optimisation problem given signals ψ, allocation vector Ω, and stake σ.

Note

You should probably not use this function directly. Use optimizeanalytic instead.

source
AllocationOpt.executeMethod
execute(
+ 3
source
AllocationOpt.dualMethod
dual(Ω, ψ, σ)

Analytic solution of the dual form of the optimisation problem given signals ψ, allocation vector Ω, and stake σ.

Note

You should probably not use this function directly. Use optimizeanalytic instead.

source
AllocationOpt.executeMethod
execute(
     a::FlexTable,
     ix::Integer,
     s::FlexTable,
@@ -236,11 +236,11 @@
         ])
 julia> config = Dict("execution_mode" => "none")
 julia> ix = 1
-julia> AllocationOpt.execute(a, ix, s, xs, ps, config)
source
AllocationOpt.formatconfig!Method
formatconfig!(config::AbstractDict)

Given a config, reformat values that need to be standardised.

julia> using AllocationOpt
+julia> AllocationOpt.execute(a, ix, s, xs, ps, config)
source
AllocationOpt.formatconfig!Method
formatconfig!(config::AbstractDict)

Given a config, reformat values that need to be standardised.

julia> using AllocationOpt
 julia> config = Dict("id" => "0xA")
 julia> AllocationOpt.formatconfig!(config)
 Dict{String, String} with 1 entry:
-  "id" => "0xa"
source
AllocationOpt.frozenMethod
frozen(a::FlexTable, config::AbstractDict)

The frozen stake of the indexer with allocations a.

julia> using AllocationOpt
+  "id" => "0xa"
source
AllocationOpt.frozenMethod
frozen(a::FlexTable, config::AbstractDict)

The frozen stake of the indexer with allocations a.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> a = flextable([
             Dict("subgraphDeployment.ipfsHash" => "Qma", "allocatedTokens" => 5),
@@ -248,13 +248,13 @@
        ])
 julia> config = Dict("frozenlist" => ["Qma", "Qmb"])
 julia> AllocationOpt.frozen(a, config)
-15.0
source
AllocationOpt.groupuniqueMethod
groupunique(x::AbstractVector)

Find the indices of each unique value in x

julia> using AllocationOpt
+15.0
source
AllocationOpt.groupuniqueMethod
groupunique(x::AbstractVector)

Find the indices of each unique value in x

julia> using AllocationOpt
 julia> x = [1, 2, 1, 3, 2, 3]
 julia> AllocationOpt.groupunique(x)
 Dict{Vector{Int64}, Vector{Int64}} with 3 entries:
   [3] => [4, 6]
   [1] => [1, 3]
-  [2] => [2, 5]
source
AllocationOpt.idMethod
id(::Val{:allocation}, x)

Get the allocation id for each allocation in x.

julia> using AllocationOpt
+  [2] => [2, 5]
source
AllocationOpt.idMethod
id(::Val{:allocation}, x)

Get the allocation id for each allocation in x.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict(
@@ -263,21 +263,21 @@
 ])
 julia> AllocationOpt.id(Val(:allocation), x)
 1-element view(lazystack(::Vector{Vector{String}}), 1, :) with eltype String:
- "0x1"
source
AllocationOpt.indexingrewardMethod
indexingreward(x::Real, Ω::Real, ψ::Real, Φ::Real, Ψ::Real)

The indexing rewards for the allocation scalar x given signals ψ, the existing allocation on subgraphs Ω, token issuance Φ, and total signal Ψ.

julia> using AllocationOpt
+ "0x1"
source
AllocationOpt.indexingrewardMethod
indexingreward(x::Real, Ω::Real, ψ::Real, Φ::Real, Ψ::Real)

The indexing rewards for the allocation scalar x given signals ψ, the existing allocation on subgraphs Ω, token issuance Φ, and total signal Ψ.

julia> using AllocationOpt
 julia> ψ = 0.0
 julia> Ω = 1.0
 julia> Φ = 1.0
 julia> Ψ = 2.0
 julia> x = 1.0
 julia> AllocationOpt.indexingreward(x, Ω, ψ, Φ, Ψ)
-0.0
source
AllocationOpt.indexingrewardMethod
indexingreward(
+0.0
source
AllocationOpt.indexingrewardMethod
indexingreward(
     ixs::AbstractArray{Integer},
     x::AbstractVector{Real},
     Ω::AbstractVector{Real},
     ψ::AbstractVector{Real},
     Φ::Real,
     Ψ::Real
-)

The indexing rewards for the allocation vector x given signals ψ, the existing allocations on subgraphs Ω, token issuance Φ, and total signal Ψ. Here ixs is a vector of indices Ω, and ψ. x will be filtered by SemioticOpt, so we don't do this here.

julia julia> using AllocationOpt julia> ixs = Int32[2] julia> ψ = [0.0, 1.0] julia> Ω = [1.0, 1.0] julia> Φ = 1.0 julia> Ψ = 2.0 julia> x = [0.0, 1.0] julia> AllocationOpt.indexingreward(ixs, x, Ω, ψ, Φ, Ψ) 0.25`

source
AllocationOpt.indexingrewardMethod
indexingreward(
+)

The indexing rewards for the allocation vector x given signals ψ, the existing allocations on subgraphs Ω, token issuance Φ, and total signal Ψ. Here ixs is a vector of indices Ω, and ψ. x will be filtered by SemioticOpt, so we don't do this here.

julia julia> using AllocationOpt julia> ixs = Int32[2] julia> ψ = [0.0, 1.0] julia> Ω = [1.0, 1.0] julia> Φ = 1.0 julia> Ψ = 2.0 julia> x = [0.0, 1.0] julia> AllocationOpt.indexingreward(ixs, x, Ω, ψ, Φ, Ψ) 0.25`

source
AllocationOpt.indexingrewardMethod
indexingreward(
     x::AbstractVector{Real},
     Ω::AbstractVector{Real},
     ψ::AbstractVector{Real},
@@ -290,7 +290,7 @@
 julia> Ψ = 2.0
 julia> x = [0.0, 1.0]
 julia> AllocationOpt.indexingreward(x, Ω, ψ, Φ, Ψ)
-0.25
source
AllocationOpt.ipfshashMethod
ipfshash(::Val{:allocation}, x)

Get the ipfs hash of x when x is part of the allocation table.

julia> using AllocationOpt
+0.25
source
AllocationOpt.ipfshashMethod
ipfshash(::Val{:allocation}, x)

Get the ipfs hash of x when x is part of the allocation table.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict(
@@ -299,7 +299,7 @@
 ])
 julia> AllocationOpt.ipfshash(Val(:allocation), x)
 1-element view(lazystack(::Vector{Vector{String}}), 1, :) with eltype String:
- "Qma"
source
AllocationOpt.ipfshashMethod
ipfshash(::Val{:subgraph}, x)

Get the ipfs hash of x when x is part of the allocation table.

julia> using AllocationOpt
+ "Qma"
source
AllocationOpt.ipfshashMethod
ipfshash(::Val{:subgraph}, x)

Get the ipfs hash of x when x is part of the allocation table.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict(
@@ -308,14 +308,14 @@
 ])
 julia> AllocationOpt.ipfshash(Val(:subgraph), x)
 1-element view(lazystack(::Vector{Vector{String}}), 1, :) with eltype String:
- "Qma"
source
AllocationOpt.iqueryMethod
iquery(id::AbstractString)

Return the components of a GraphQL query for the stake of indexer id.

For use with the TheGraphData.jl package.

julia> using AllocationOpt
+ "Qma"
source
AllocationOpt.iqueryMethod
iquery(id::AbstractString)

Return the components of a GraphQL query for the stake of indexer id.

For use with the TheGraphData.jl package.

julia> using AllocationOpt
 julia> id = "0xa"
 julia> value, args, fields = AllocationOpt.iquery(id)
-("indexer", Dict{String, Union{Int64, Dict{String, String}, String}}("id" => "0xa"), ["delegatedTokens", "stakedTokens", "lockedTokens"])

Extended Help

You can find TheGraphData.jl at https://github.com/semiotic-ai/TheGraphData.jl

source
AllocationOpt.lipschitzconstantMethod
lipschitzconstant(ψ, Ω)

The Lipschitz constant of the indexing reward function given signals ψ and allocations Ω.

julia> using AllocationOpt
+("indexer", Dict{String, Union{Int64, Dict{String, String}, String}}("id" => "0xa"), ["delegatedTokens", "stakedTokens", "lockedTokens"])

Extended Help

You can find TheGraphData.jl at https://github.com/semiotic-ai/TheGraphData.jl

source
AllocationOpt.lipschitzconstantMethod
lipschitzconstant(ψ, Ω)

The Lipschitz constant of the indexing reward function given signals ψ and allocations Ω.

julia> using AllocationOpt
 julia> ψ = [0.0, 1.0]
 julia> Ω = [1.0, 1.0]
 julia> AllocationOpt.lipschitzconstant(ψ, Ω)
-2.0
source
AllocationOpt.lockedMethod
locked(::Val{:indexer}, x)

The locked tokens of the indexer in table x.

julia> using AllocationOpt
+2.0
source
AllocationOpt.lockedMethod
locked(::Val{:indexer}, x)

The locked tokens of the indexer in table x.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict(
@@ -323,7 +323,7 @@
     ),
 ])
 julia> AllocationOpt.locked(Val(:indexer), x)
-10
source
AllocationOpt.newtokenissuanceMethod
newtokenissuance(n::FlexTable, config::Dict)

How many new tokens are issued over the allocation lifetime given network parameters n. Calcualted by networkGRTIssuancePerBlock * epochLength * allocation_lifetime

julia> using AllocationOpt
+10
source
AllocationOpt.newtokenissuanceMethod
newtokenissuance(n::FlexTable, config::Dict)

How many new tokens are issued over the allocation lifetime given network parameters n. Calcualted by networkGRTIssuancePerBlock * epochLength * allocation_lifetime

julia> using AllocationOpt
 julia> using TheGraphData
 julia> n = flextable([
             Dict(
@@ -336,13 +336,13 @@
         ])
 julia> config = Dict("allocation_lifetime" => 1)
 julia> AllocationOpt.newtokenissuance(n, config)
-1.0
source
AllocationOpt.nonzeroMethod
nonzero(v::AbstractVector)

Get the non-zero elements of vector v.

julia> using AllocationOpt
+1.0
source
AllocationOpt.nonzeroMethod
nonzero(v::AbstractVector)

Get the non-zero elements of vector v.

julia> using AllocationOpt
 julia> v = [0.0, 1.0]
 julia> AllocationOpt.nonzero(v)
 1-element view(::Vector{Float64}, [2]) with eltype Float64:
- 1.0
source
AllocationOpt.nqueryMethod
nquery()

Return the components of a GraphQL query for network parameters.

For use with the TheGraphData.jl package.

julia> using AllocationOpt
+ 1.0
source
AllocationOpt.nqueryMethod
nquery()

Return the components of a GraphQL query for network parameters.

For use with the TheGraphData.jl package.

julia> using AllocationOpt
 julia> value, args, fields = AllocationOpt.nquery()
-("graphNetwork", Dict("id" => 1), ["id", "networkGRTIssuance", "epochLength", "totalTokensSignalled", "currentEpoch"])

Extended Help

You can find TheGraphData.jl at https://github.com/semiotic-ai/TheGraphData.jl

source
AllocationOpt.optimizeMethod
optimize(Ω, ψ, σ, K, Φ, Ψ, g, rixs, config::AbstractDict)

Find the optimal solution vector given allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, total signal Ψ, and gas in grt g. rixs are the indices of subgraphs that are eligible to receive indexing rewards.

Dispatches to optimize with the opt_mode key.

If opt_mode is fast, then run projected gradient descent with GSSP and Halpern. If opt_mode is optimal, then run Pairwise Greedy Optimisation.

julia> using AllocationOpt
+("graphNetwork", Dict("id" => 1), ["id", "networkGRTIssuance", "epochLength", "totalTokensSignalled", "currentEpoch"])

Extended Help

You can find TheGraphData.jl at https://github.com/semiotic-ai/TheGraphData.jl

source
AllocationOpt.optimizeMethod
optimize(Ω, ψ, σ, K, Φ, Ψ, g, rixs, config::AbstractDict)

Find the optimal solution vector given allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, total signal Ψ, and gas in grt g. rixs are the indices of subgraphs that are eligible to receive indexing rewards.

Dispatches to optimize with the opt_mode key.

If opt_mode is fast, then run projected gradient descent with GSSP and Halpern. If opt_mode is optimal, then run Pairwise Greedy Optimisation.

julia> using AllocationOpt
 julia> config = Dict("opt_mode" => "fast")
 julia> rixs = [1, 2]
 julia> Ω = [1.0, 1.0]
@@ -353,7 +353,7 @@
 julia> Ψ = 20.0
 julia> g = 0.01
 julia> xs, nonzeros, profits = AllocationOpt.optimize(Ω, ψ, σ, K, Φ, Ψ, g, rixs, config)
-([5.0 2.5; 0.0 2.5], Int32[1, 2], [0.4066666666666667 0.34714285714285714; 0.0 0.34714285714285714])
source
AllocationOpt.optimizeMethod
optimize(::Val{:fast}, Ω, ψ, σ, K, Φ, Ψ, g, rixs)

Find the optimal vectors for k ∈ [1,K] given allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, total signal Ψ, and gas in grt g. rixs are the indices of subgraphs that are eligible to receive indexing rewards.

julia> using AllocationOpt
+([5.0 2.5; 0.0 2.5], Int32[1, 2], [0.4066666666666667 0.34714285714285714; 0.0 0.34714285714285714])
source
AllocationOpt.optimizeMethod
optimize(::Val{:fast}, Ω, ψ, σ, K, Φ, Ψ, g, rixs)

Find the optimal vectors for k ∈ [1,K] given allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, total signal Ψ, and gas in grt g. rixs are the indices of subgraphs that are eligible to receive indexing rewards.

julia> using AllocationOpt
 julia> rixs = [1, 2]
 julia> Ω = [1.0, 1.0]
 julia> ψ = [10.0, 10.0]
@@ -363,7 +363,7 @@
 julia> Ψ = 20.0
 julia> g = 0.01
 julia> xs, nonzeros, profits = AllocationOpt.optimize(Val(:fast), Ω, ψ, σ, K, Φ, Ψ, g, rixs)
-([5.0 2.5; 0.0 2.5], Int32[1, 2], [0.4066666666666667 0.34714285714285714; 0.0 0.34714285714285714])
source
AllocationOpt.optimizeMethod
optimize(::Val{:optimal}, Ω, ψ, σ, K, Φ, Ψ, g, rixs)

Find the optimal solution vector given allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, total signal Ψ, and gas in grt g. rixs are the indices of subgraphs that are eligible to receive indexing rewards.

Example

julia> using AllocationOpt
+([5.0 2.5; 0.0 2.5], Int32[1, 2], [0.4066666666666667 0.34714285714285714; 0.0 0.34714285714285714])
source
AllocationOpt.optimizeMethod
optimize(::Val{:optimal}, Ω, ψ, σ, K, Φ, Ψ, g, rixs)

Find the optimal solution vector given allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, total signal Ψ, and gas in grt g. rixs are the indices of subgraphs that are eligible to receive indexing rewards.

Example

julia> using AllocationOpt
 julia> rixs = [1, 2]
 julia> Ω = [1.0, 1.0]
 julia> ψ = [10.0, 10.0]
@@ -375,14 +375,14 @@
 julia> xs, nonzeros, profits = AllocationOpt.optimize(
            Val(:optimal), Ω, ψ, σ, K, Φ, Ψ, g, rixs
        )
-([5.0 2.5; 0.0 2.5], Int32[1, 2], [0.4066666666666667 0.34714285714285714; 0.0 0.34714285714285714])
source
AllocationOpt.optimizeanalyticMethod
optimizeanalytic(Ω, ψ, σ)

Optimise analytically over existing allocation vector Ω, signals ψ, and stake σ.

julia> using AllocationOpt
+([5.0 2.5; 0.0 2.5], Int32[1, 2], [0.4066666666666667 0.34714285714285714; 0.0 0.34714285714285714])
source
AllocationOpt.optimizeanalyticMethod
optimizeanalytic(Ω, ψ, σ)

Optimise analytically over existing allocation vector Ω, signals ψ, and stake σ.

julia> using AllocationOpt
 julia> Ω = [1.0, 7.0]
 julia> ψ = [10.0, 5.0]
 julia> σ = 5.0
 julia> AllocationOpt.optimizeanalytic(Ω, ψ, σ)
 2-element Vector{Float64}:
  3.5283092056122474
- 1.4716907943877526
source
AllocationOpt.optimizekMethod
optimizek(::Val{:fast}, x₀, Ω, ψ, σ, k, Φ, Ψ)

Find the optimal k sparse vector given initial value x₀, allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, and total signal Ψ.

julia> using AllocationOpt
+ 1.4716907943877526
source
AllocationOpt.optimizekMethod
optimizek(::Val{:fast}, x₀, Ω, ψ, σ, k, Φ, Ψ)

Find the optimal k sparse vector given initial value x₀, allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, and total signal Ψ.

julia> using AllocationOpt
 julia> x₀ = [2.5, 2.5]
 julia> Ω = [1.0, 1.0]
 julia> ψ = [10.0, 10.0]
@@ -393,7 +393,7 @@
 julia> AllocationOpt.optimizek(Val(:fast), x₀, Ω, ψ, σ, k, Φ, Ψ)
 2-element Vector{Float64}:
  5.0
- 0.0
source
AllocationOpt.optimizekMethod
optimizek(::Val{:optimal}, x₀, Ω, ψ, σ, k, Φ, Ψ, g)

Find the optimal k sparse vector given allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, total signal Ψ, and gas g.

Example

julia> using AllocationOpt
+ 0.0
source
AllocationOpt.optimizekMethod
optimizek(::Val{:optimal}, x₀, Ω, ψ, σ, k, Φ, Ψ, g)

Find the optimal k sparse vector given allocations of other indexers Ω, signals ψ, available stake σ, new tokens issued Φ, total signal Ψ, and gas g.

Example

julia> using AllocationOpt
 julia> Ω = [1.0, 1.0]
 julia> ψ = [10.0, 10.0]
 julia> σ = 5.0
@@ -405,7 +405,7 @@
 julia> x = AllocationOpt.optimizek(Val(:optimal), x₀, Ω, ψ, σ, k, Φ, Ψ, g)
 2-element Vector{Float64}:
  5.0
- 0.0
source
AllocationOpt.pinnedMethod
pinned(config::AbstractDict)

The pinned vector of the indexer.

julia> using AllocationOpt
+ 0.0
source
AllocationOpt.pinnedMethod
pinned(config::AbstractDict)

The pinned vector of the indexer.

julia> using AllocationOpt
 julia> s = flextable([
     Dict("ipfsHash" => "Qma", "signalledTokens" => 5.0),
     Dict("ipfsHash" => "Qmb", "signalledTokens" => 10.0),
@@ -416,11 +416,11 @@
 3-element Vector{Float64}:
  0.1
  0.1
- 0.0
source
AllocationOpt.primalMethod
primal(Ω, ψ, ν)

Analytic solution of the primal form of the optimisation problem given signals ψ, allocations Ω, and a dual solution vector ν.

Note

You should probably not use this function directly. Use optimizeanalytic instead.

source
AllocationOpt.profitMethod
profit(r::Real, g::Real)

Compute the profit for one allocation with reward r and gas cost g.

julia> using AllocationOpt
+ 0.0
source
AllocationOpt.primalMethod
primal(Ω, ψ, ν)

Analytic solution of the primal form of the optimisation problem given signals ψ, allocations Ω, and a dual solution vector ν.

Note

You should probably not use this function directly. Use optimizeanalytic instead.

source
AllocationOpt.profitMethod
profit(r::Real, g::Real)

Compute the profit for one allocation with reward r and gas cost g.

julia> using AllocationOpt
 julia> r = 10
 julia> g = 1
 julia> AllocationOpt.profit(r, g)
-9
source
AllocationOpt.readMethod
read(config::AbstractDict)

Given a config, read the data in as flextables.

If you have specified a "readdir" in the config, this will read from CSV files in that directory. Otherwise, this will query the specified "network_subgraph_endpoint"

julia> using AllocationOpt
+9
source
AllocationOpt.readMethod
read(config::AbstractDict)

Given a config, read the data in as flextables.

If you have specified a "readdir" in the config, this will read from CSV files in that directory. Otherwise, this will query the specified "network_subgraph_endpoint"

julia> using AllocationOpt
 julia> config = Dict("verbose" => false, "readdir" => "mydatadir")
 julia> i, a, s, n = AllocationOpt.read(config)  # Read data from CSVs
julia> using AllocationOpt
 julia> config = Dict(
@@ -428,13 +428,13 @@
     "network_subgraph_endpoint" => "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet",
     "readdir" => nothing,
 )
-julia> i, a, s, n = AllocationOpt.read(config)  # Query GQL endpoint
source
AllocationOpt.readMethod
read(f::AbstractString, config::AbstractDict)

Read the CSV files from f and return the tables from those files.

julia> using AllocationOpt
-julia> i, a, s, n = AllocationOpt.read("myreaddir", Dict("verbose" => true))
source
AllocationOpt.readMethod
read(::Nothing, config::AbstractDict)

Query the required data from the provided endpoint in the config.

julia> using AllocationOpt
+julia> i, a, s, n = AllocationOpt.read(config)  # Query GQL endpoint
source
AllocationOpt.readMethod
read(f::AbstractString, config::AbstractDict)

Read the CSV files from f and return the tables from those files.

julia> using AllocationOpt
+julia> i, a, s, n = AllocationOpt.read("myreaddir", Dict("verbose" => true))
source
AllocationOpt.readMethod
read(::Nothing, config::AbstractDict)

Query the required data from the provided endpoint in the config.

julia> using AllocationOpt
 julia> config = Dict(
             "verbose" => true,
             "network_subgraph_endpoint" => "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet",
         )
-julia> i, a, s, n = AllocationOpt.read(nothing, config)
source
AllocationOpt.readconfigMethod
readconfig(p::AbstractString)

Read the config file from path p. The config file must be specifed as a TOML.

See configuredefaults! to see which fields you should specify in the config.

julia> using AllocationOpt
+julia> i, a, s, n = AllocationOpt.read(nothing, config)
source
AllocationOpt.readconfigMethod
readconfig(p::AbstractString)

Read the config file from path p. The config file must be specifed as a TOML.

See configuredefaults! to see which fields you should specify in the config.

julia> using AllocationOpt
 julia> path = "myconfig.toml"
 julia> config = AllocationOpt.readconfig(path)
 Dict{String, Any} with 13 entries:
@@ -450,7 +450,7 @@
   "min_signal"           => 1000
   "whitelist"            => Union{}[]
   "max_allocations"      => 5
-  "frozenlist"           => Union{}[]
source
AllocationOpt.reallocate_actionMethod
reallocate_action(::Val{:actionqueue}, a::FlexTable, t::FlexTable, config::AbstractDict)

Create and push reallocate actions to the action queue.

julia> using AllocationOpt
+  "frozenlist"           => Union{}[]
source
AllocationOpt.reallocate_actionMethod
reallocate_action(::Val{:actionqueue}, a::FlexTable, t::FlexTable, config::AbstractDict)

Create and push reallocate actions to the action queue.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> a = flextable([
             Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa")
@@ -463,7 +463,7 @@
 julia> TheGraphData.client!(config["indexer_url"])
 julia> AllocationOpt.reallocate_action(Val(:actionqueue), a, t, config)
 1-element Vector{Dict{String, Any}}:
- Dict("amount" => "1", "priority" => 0, "status" => AllocationOpt.queued, "allocationID" => "0xa", "source" => "AllocationOpt", "reason" => "Expected profit: 0", "type" => AllocationOpt.reallocate, "deploymentID" => "Qma")
source
AllocationOpt.reallocate_actionMethod
reallocate_action(::Val{:none}, a, t, config)

Do nothing.

```julia julia> using AllocationOpt julia> using TheGraphData julia> a = flextable([ Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa") ]) julia> t = flextable([ Dict("amount" => "1", "profit" => "0", "ipfshash" => "Qma"), Dict("amount" => "2", "profit" => "0", "ipfshash" => "Qmb"), ]) julia> AllocationOpt.reallocate_action(Val(:none), a, t, Dict())

source
AllocationOpt.reallocate_actionMethod
reallocate_action(::Val{:rules}, a::FlexTable, t::FlexTable, config::AbstractDict)

Print a rule that reallocates the old allocation with a new allocation amount

julia> using AllocationOpt
+ Dict("amount" => "1", "priority" => 0, "status" => AllocationOpt.queued, "allocationID" => "0xa", "source" => "AllocationOpt", "reason" => "Expected profit: 0", "type" => AllocationOpt.reallocate, "deploymentID" => "Qma")
source
AllocationOpt.reallocate_actionMethod
reallocate_action(::Val{:none}, a, t, config)

Do nothing.

```julia julia> using AllocationOpt julia> using TheGraphData julia> a = flextable([ Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa") ]) julia> t = flextable([ Dict("amount" => "1", "profit" => "0", "ipfshash" => "Qma"), Dict("amount" => "2", "profit" => "0", "ipfshash" => "Qmb"), ]) julia> AllocationOpt.reallocate_action(Val(:none), a, t, Dict())

source
AllocationOpt.reallocate_actionMethod
reallocate_action(::Val{:rules}, a::FlexTable, t::FlexTable, config::AbstractDict)

Print a rule that reallocates the old allocation with a new allocation amount

julia> using AllocationOpt
 julia> using TheGraphData
 julia> a = flextable([
             Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa")
@@ -476,7 +476,7 @@
 graph indexer rules stop Qma
 Check allocation status being closed before submitting: graph indexer rules set Qma decisionBasis always allocationAmount 1
 1-element Vector{String}:
- "graph indexer rules stop Qm" ⋯ 122 bytes ⋯ "asis always allocationAmount 1"
source
AllocationOpt.reportingtableMethod
reportingtable(
+ "graph indexer rules stop Qm" ⋯ 122 bytes ⋯ "asis always allocationAmount 1"
source
AllocationOpt.reportingtableMethod
reportingtable(
     s::FlexTable, xs::AbstractMatrix{Real}, ps::AbstractMatrix{Real}, i::Integer
 )

Construct a table for the strategy mapping the ipfshash, allocation amount, and profit

julia> using AllocationOpt
 julia> s = flextable([
@@ -491,10 +491,10 @@
      ipfshash  amount  profit
    ┌─────────────────────────
  1 │ Qma       2.5     3.0
- 2 │ Qmb       2.5     3.0
source
AllocationOpt.savenamesMethod
savenames(p::AbstractString)

Return a generator of the generic names of the CSV files containing the data with the path specified by p.

julia> using AllocationOpt
+ 2 │ Qmb       2.5     3.0
source
AllocationOpt.savenamesMethod
savenames(p::AbstractString)

Return a generator of the generic names of the CSV files containing the data with the path specified by p.

julia> using AllocationOpt
 julia> path = "mypath"
 julia> paths = AllocationOpt.savenames(path)
-Base.Generator{NTuple{4, String}, AllocationOpt.var"#1#2"{String}}(AllocationOpt.var"#1#2"{String}("mypath"), ("indexer.csv", "allocation.csv", "subgraph.csv", "network.csv"))
source
AllocationOpt.signalMethod
signal(::Val{:network}, x)

The total signal in the network

```julia julia> using AllocationOpt julia> using TheGraphData julia> n = flextable([ Dict( "id" => 1, "networkGRTIssuancePerBlock" => 1, "epochLength" => 28, "totalTokensSignalled" => 2, "currentEpoch" => 1, ) ]) julia> AllocationOpt.signal(Val(:network), n) 2

source
AllocationOpt.signalMethod
signal(::Val{:subgraph}, x)

The tokens signalled on the subgraphs in table x.

julia> using AllocationOpt
+Base.Generator{NTuple{4, String}, AllocationOpt.var"#1#2"{String}}(AllocationOpt.var"#1#2"{String}("mypath"), ("indexer.csv", "allocation.csv", "subgraph.csv", "network.csv"))
source
AllocationOpt.signalMethod
signal(::Val{:network}, x)

The total signal in the network

```julia julia> using AllocationOpt julia> using TheGraphData julia> n = flextable([ Dict( "id" => 1, "networkGRTIssuancePerBlock" => 1, "epochLength" => 28, "totalTokensSignalled" => 2, "currentEpoch" => 1, ) ]) julia> AllocationOpt.signal(Val(:network), n) 2

source
AllocationOpt.signalMethod
signal(::Val{:subgraph}, x)

The tokens signalled on the subgraphs in table x.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict("signalledTokens" => 10,),
@@ -503,7 +503,7 @@
 julia> AllocationOpt.signal(Val(:subgraph), x)
 2-element view(transpose(lazystack(::Vector{Vector{Int64}})), :, 1) with eltype Int64:
  10
-  5
source
AllocationOpt.sortprofits!Method
sortprofits!(NamedTuple{Tuple{Float64, Int64}})

Sort the nonzero best profits from highest to lowest

julia> using AllocationOpt
+  5
source
AllocationOpt.sortprofits!Method
sortprofits!(NamedTuple{Tuple{Float64, Int64}})

Sort the nonzero best profits from highest to lowest

julia> using AllocationOpt
 julia> popts = [
         (; :profit => 5.0, :index => 2),
         (; :profit => 6.0, :index => 1)
@@ -511,9 +511,9 @@
 julia> popts = AllocationOpt.sortprofits!(popts)
 2-element Vector{NamedTuple{(:profit, :index), Tuple{Float64, Int64}}}:
  (profit = 6.0, index = 1)
- (profit = 5.0, index = 2)
source
AllocationOpt.squeryMethod
squery()

Return the components of a GraphQL query for subgraphs.

For use with the TheGraphData.jl package.

julia> using AllocationOpt
+ (profit = 5.0, index = 2)
source
AllocationOpt.squeryMethod
squery()

Return the components of a GraphQL query for subgraphs.

For use with the TheGraphData.jl package.

julia> using AllocationOpt
 julia> value, args, fields = AllocationOpt.squery()
-("subgraphDeployments", Dict{String, Union{Dict{String, String}, String}}(), ["ipfsHash", "signalledTokens", "stakedTokens"])

Extended Help

You can find TheGraphData.jl at https://github.com/semiotic-ai/TheGraphData.jl

source
AllocationOpt.stakeMethod
stake(::Val{:allocation}, x)

Get the allocated tokens for each allocation in x.

julia> using AllocationOpt
+("subgraphDeployments", Dict{String, Union{Dict{String, String}, String}}(), ["ipfsHash", "signalledTokens", "stakedTokens"])

Extended Help

You can find TheGraphData.jl at https://github.com/semiotic-ai/TheGraphData.jl

source
AllocationOpt.stakeMethod
stake(::Val{:allocation}, x)

Get the allocated tokens for each allocation in x.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict(
@@ -522,7 +522,7 @@
 ])
 julia> AllocationOpt.stake(Val(:allocation), x)
 1-element view(transpose(lazystack(::Vector{Vector{Int64}})), :, 1) with eltype Int64:
- 1
source
AllocationOpt.stakeMethod
stake(::Val{:indexer}, x)

The tokens staked by the indexer in table x.

julia> using AllocationOpt
+ 1
source
AllocationOpt.stakeMethod
stake(::Val{:indexer}, x)

The tokens staked by the indexer in table x.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict(
@@ -530,7 +530,7 @@
     ),
 ])
 julia> AllocationOpt.stake(Val(:indexer), x)
-10
source
AllocationOpt.stakeMethod
stake(::Val{:subgraph}, x)

The tokens staked on the subgraphs in table x.

julia> using AllocationOpt
+10
source
AllocationOpt.stakeMethod
stake(::Val{:subgraph}, x)

The tokens staked on the subgraphs in table x.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> x = flextable([
     Dict("stakedTokens" => 10,),
@@ -539,7 +539,7 @@
 julia> AllocationOpt.stake(Val(:subgraph), x)
 2-element view(transpose(lazystack(::Vector{Vector{Int64}})), :, 1) with eltype Int64:
  10
-  5
source
AllocationOpt.strategydictMethod
strategydict(
+  5
source
AllocationOpt.strategydictMethod
strategydict(
     p::NamedTuple,
     xs::AbstractMatrix{Real},
     nonzeros::AbstractVector{Integer},
@@ -561,7 +561,7 @@
 julia> AllocationOpt.strategydict.(popts, Ref(xs), Ref(nonzeros), Ref(fs), Ref(profits))
 2-element Vector{Dict{String, Any}}:
  Dict("num_allocations" => 2, "profit" => 6.0, "allocations" => Dict{String, Any}[Dict("allocationAmount" => "2.5", "profit" => 3.0, "deploymentID" => "Qma"), Dict("allocationAmount" => "2.5", "profit" => 3.0, "deploymentID" => "Qmb")])
- Dict("num_allocations" => 1, "profit" => 5.0, "allocations" => Dict{String, Any}[Dict("allocationAmount" => "5", "profit" => 5.0, "deploymentID" => "Qma")])
source
AllocationOpt.subtractindexer!Method
subtractindexer!(a::FlexTable, s::FlexTable)

Subtract the indexer's allocated tokens from the total allocated tokens on each subgraph.

julia> using AllocationOpt
+ Dict("num_allocations" => 1, "profit" => 5.0, "allocations" => Dict{String, Any}[Dict("allocationAmount" => "5", "profit" => 5.0, "deploymentID" => "Qma")])
source
AllocationOpt.subtractindexer!Method
subtractindexer!(a::FlexTable, s::FlexTable)

Subtract the indexer's allocated tokens from the total allocated tokens on each subgraph.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> s = flextable([
             Dict("ipfsHash" => "Qmb", "stakedTokens" => 20),
@@ -573,9 +573,9 @@
             Dict("subgraphDeployment.ipfsHash" => "Qmb", "allocatedTokens" => 10, "id" => "0xb"),
         ])
 julia> a, s = AllocationOpt.subtractindexer!(a, s)
-(NamedTuple[(var"subgraphDeployment.ipfsHash" = "Qma", allocatedTokens = 5, id = "0xa"), (var"subgraphDeployment.ipfsHash" = "Qmb", allocatedTokens = 10, id = "0xb")], NamedTuple[(stakedTokens = 5.0, ipfsHash = "Qma"), (stakedTokens = 10, ipfsHash = "Qmb"), (stakedTokens = 5, ipfsHash = "Qmc")])
source
AllocationOpt.togrtMethod
togrt(x::AbstractString)

Convert x to GRT.

Note

This function is meant to be used with freshly queried data, so it operates on strings.

julia> using AllocationOpt
+(NamedTuple[(var"subgraphDeployment.ipfsHash" = "Qma", allocatedTokens = 5, id = "0xa"), (var"subgraphDeployment.ipfsHash" = "Qmb", allocatedTokens = 10, id = "0xb")], NamedTuple[(stakedTokens = 5.0, ipfsHash = "Qma"), (stakedTokens = 10, ipfsHash = "Qmb"), (stakedTokens = 5, ipfsHash = "Qmc")])
source
AllocationOpt.togrtMethod
togrt(x::AbstractString)

Convert x to GRT.

Note

This function is meant to be used with freshly queried data, so it operates on strings.

julia> using AllocationOpt
 julia> AllocationOpt.togrt("1")
-1.0e-18
source
AllocationOpt.unallocate_actionMethod
unallocate_action(::Val{:actionqueue}, a::FlexTable, t::FlexTable, config::AbstractDict)

Create and push the unallocate actions to the action queue.

```julia julia> using AllocationOpt julia> using TheGraphData julia> a = flextable([ Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa") ]) julia> t = flextable([ Dict("amount" => "2", "profit" => "0", "ipfshash" => "Qmb"), ]) julia> config = Dict( "frozenlist" => [], "indexerurl" => "http://localhost:18000" ) julia> TheGraphData.client!(config["indexerurl"]) julia> AllocationOpt.unallocate_action(Val(:actionqueue), a, t, config) 1-element Vector{Dict{String, Any}}: Dict("priority" => 0, "status" => AllocationOpt.queued, "allocationID" => "0xa", "source" => "AllocationOpt", "reason" => "AllocationOpt", "type" => AllocationOpt.unallocate, "deploymentID" => "Qma")

source
AllocationOpt.unallocate_actionMethod
unallocate_action(::Val{:none}, a, t, config)

Do nothing.

julia> using AllocationOpt
+1.0e-18
source
AllocationOpt.unallocate_actionMethod
unallocate_action(::Val{:actionqueue}, a::FlexTable, t::FlexTable, config::AbstractDict)

Create and push the unallocate actions to the action queue.

```julia julia> using AllocationOpt julia> using TheGraphData julia> a = flextable([ Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa") ]) julia> t = flextable([ Dict("amount" => "2", "profit" => "0", "ipfshash" => "Qmb"), ]) julia> config = Dict( "frozenlist" => [], "indexerurl" => "http://localhost:18000" ) julia> TheGraphData.client!(config["indexerurl"]) julia> AllocationOpt.unallocate_action(Val(:actionqueue), a, t, config) 1-element Vector{Dict{String, Any}}: Dict("priority" => 0, "status" => AllocationOpt.queued, "allocationID" => "0xa", "source" => "AllocationOpt", "reason" => "AllocationOpt", "type" => AllocationOpt.unallocate, "deploymentID" => "Qma")

source
AllocationOpt.unallocate_actionMethod
unallocate_action(::Val{:none}, a, t, config)

Do nothing.

julia> using AllocationOpt
 julia> a = flextable([
             Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa")
         ])
@@ -583,7 +583,7 @@
             Dict("amount" => "1", "profit" => "0", "ipfshash" => "Qma"),
             Dict("amount" => "2", "profit" => "0", "ipfshash" => "Qmb"),
         ])
-julia> AllocationOpt.unallocate_action(Val(:none), a, t, Dict())
source
AllocationOpt.unallocate_actionMethod
unallocate_action(::Val{:rules}, a::FlexTable, t::FlexTable, config::AbstractDict)

Print a rule that stops old allocations that the optimiser has not chosen and that aren't frozen.

julia> using AllocationOpt
+julia> AllocationOpt.unallocate_action(Val(:none), a, t, Dict())
source
AllocationOpt.unallocate_actionMethod
unallocate_action(::Val{:rules}, a::FlexTable, t::FlexTable, config::AbstractDict)

Print a rule that stops old allocations that the optimiser has not chosen and that aren't frozen.

julia> using AllocationOpt
 julia> a = flextable([
             Dict("subgraphDeployment.ipfsHash" => "Qma", "id" => "0xa")
         ])
@@ -593,7 +593,7 @@
 julia> AllocationOpt.unallocate_action(Val(:rules), a, t, Dict("frozenlist" => []))
 graph indexer rules stop Qma
 1-element Vector{String}:
- "graph indexer rules stop Qma"
source
AllocationOpt.writeMethod
write(i::FlexTable, a::FlexTable, s::FlexTable, n::FlexTable, config::AbstractDict)

Write the tables to the writedir specified in the config.

julia> using AllocationOpt
+ "graph indexer rules stop Qma"
source
AllocationOpt.writeMethod
write(i::FlexTable, a::FlexTable, s::FlexTable, n::FlexTable, config::AbstractDict)

Write the tables to the writedir specified in the config.

julia> using AllocationOpt
 julia> using TheGraphData
 julia> config = Dict("verbose" => true, "writedir" => "datadir")
 julia> t = flextable([
@@ -601,7 +601,7 @@
             Dict("ipfsHash" => "Qmb", "signalledTokens" => "2"),
         ])
 julia> i, a, s, n = repeat([t,], 4)
-juila> AllocationOpt.write(i, a, s, n, config)
source
AllocationOpt.writejsonMethod
function writejson(results::AbstractString, config::AbstractDict)

Write the optimized results to the writedir specified in the config.

julia> Using AllocationOpt
+juila> AllocationOpt.write(i, a, s, n, config)
source
AllocationOpt.writejsonMethod
function writejson(results::AbstractString, config::AbstractDict)

Write the optimized results to the writedir specified in the config.

julia> Using AllocationOpt
 julia> results = "{"strategies":[{"num_allocations":2,"profit":6.0,"allocations":[{"allocationAmount":2.5,"profit":3.0,"deploymentID":"Qma"},{"allocationAmount":2.5,"profit":3.0,"deploymentID":"Qmb"}]},{"num_allocations":1,"profit":5.0,"allocations":[{"allocationAmount":5.0,"profit":5.0,"deploymentID":"Qma"}]}]}"
 julia> config = Dict{"writedir" => "."}
-julia> AllocationOpt.writejson(results, config)
source
SemioticOpt.iterationMethod
iteration(f::Function, a::AnalyticOpt)

Perform the analytic optimisation.

source
SemioticOpt.x!Method
x!(a::AnalyticOpt, v)

In-place setting of a.x to v

See SemioticOpt.x.

source
SemioticOpt.xMethod
x(a::AnalyticOpt)

Return the current best guess for the solution.

source
+julia> AllocationOpt.writejson(results, config)source
SemioticOpt.iterationMethod
iteration(f::Function, a::AnalyticOpt)

Perform the analytic optimisation.

source
SemioticOpt.x!Method
x!(a::AnalyticOpt, v)

In-place setting of a.x to v

See SemioticOpt.x.

source
SemioticOpt.xMethod
x(a::AnalyticOpt)

Return the current best guess for the solution.

source
diff --git a/latest/bugs/index.html b/latest/bugs/index.html index ef460ad..b72011e 100644 --- a/latest/bugs/index.html +++ b/latest/bugs/index.html @@ -1,2 +1,2 @@ -Reporting Bugs · The Allocation Optimizer

Reporting Bugs

If something breaks, we hope you'll submit a bug report! There are a few things we'll need from you to reproduce the failure mode you're experiencing.

  1. Your config file
  2. The CSVs (if any) that the Optimizer saved.
  3. The stacktrace displaying the error message.
  4. The version of the Allocation Optimizer you are running.

These are a good place to start. We may ask you for more information as we investigate the bug.

+Reporting Bugs · The Allocation Optimizer

Reporting Bugs

If something breaks, we hope you'll submit a bug report! There are a few things we'll need from you to reproduce the failure mode you're experiencing.

  1. Your config file
  2. The CSVs (if any) that the Optimizer saved.
  3. The stacktrace displaying the error message.
  4. The version of the Allocation Optimizer you are running.

These are a good place to start. We may ask you for more information as we investigate the bug.

diff --git a/latest/build-a-binary/index.html b/latest/build-a-binary/index.html index 39d1cfb..d0b5c8a 100644 --- a/latest/build-a-binary/index.html +++ b/latest/build-a-binary/index.html @@ -2,4 +2,4 @@ Build Your Own Binary · The Allocation Optimizer

Build Your Own Binary

Compiling the binary yourself is an excellent way to use the Allocation Optimizer. You should use this route if a couple of reasons speak to you.

  1. You'd prefer not to trust a random binary off the internet.
  2. You have added your own features to the Allocation Optimizer, but would prefer the large, one-time cost of AOT compilation as opposed the small, every-time cost of JIT compilation.

In this documentation, we'll take you through the process of generating an app binary.

Note

You can instead compile to a sysimage or to a library, but we don't natively support those ourselves. Look through the PackageCompiler documentation for steps if you would prefer one of those options..

Install Julia! We prefer to use juliaup. You can install this via:

curl -fsSL https://install.julialang.org | sh
Note

As of writing this documentation, the latest version of Julia is v1.8. This the version the Allocation Optimizer currently uses, and the version juliaup will install by default. If juliaup begins to use v1.9, then you may need to use juliaup to manually install v1.8 via juliaup add 1.8. Then, you can either set the default to be v1.8 using juliaup default 1.8, or you can replace every time you see julia with julia +1.8 below.

Clone this repository and cd into it.

git clone https://github.com/graphprotocol/allocation-optimizer.git
 cd allocation-optimizer

Start Julia.

julia --project

Install the dependencies

julia> ]
 pkg> instantiate

Install a C-compiler such as GCC or Clang.

From the Julia REPL (the TUI that comes up when you use julia --project), compile your app.

julia> using PackageCompiler
-julia> create_app(".", "app")
Note

If you are still in Pkg mode, pkg>, hitting backspace will bring you back into the REPL.

Set up your configuration file. See Configuration for details.

Run the binary pointing at the configuration TOML that you would like to use.

./app/bin/AllocationOpt /path/to/your_config.toml
+julia> create_app(".", "app")
Note

If you are still in Pkg mode, pkg>, hitting backspace will bring you back into the REPL.

Set up your configuration file. See Configuration for details.

Run the binary pointing at the configuration TOML that you would like to use.

./app/bin/AllocationOpt /path/to/your_config.toml
diff --git a/latest/call-julia/index.html b/latest/call-julia/index.html index a1940d4..80ab99b 100644 --- a/latest/call-julia/index.html +++ b/latest/call-julia/index.html @@ -3,4 +3,4 @@ cd allocation-optimizer

Start Julia.

julia --project

Install the dependencies

julia> ]
 pkg> instantiate

Set up your configuration file. See Configuration for details.

From the Julia REPL (the TUI that comes up when you use julia --project), run the main function with the path to your config.

julia> using AllocationOpt
 julia> path = "config.toml"  # path to your config file
-julia> AllocationOpt.main(path)
Note

If you are still in Pkg mode, pkg>, hitting backspace will bring you back into the REPL.

+julia> AllocationOpt.main(path)
Note

If you are still in Pkg mode, pkg>, hitting backspace will bring you back into the REPL.

diff --git a/latest/calling-another/index.html b/latest/calling-another/index.html index b948746..aceda8a 100644 --- a/latest/calling-another/index.html +++ b/latest/calling-another/index.html @@ -70,4 +70,4 @@ execute(a, ix, fs, xs, profitmatrix, config) return nothing -end

For details on any of the specific functions called, look at the API Reference.

+end

For details on any of the specific functions called, look at the API Reference.

diff --git a/latest/configuration/index.html b/latest/configuration/index.html index b52b31c..e9e07c8 100644 --- a/latest/configuration/index.html +++ b/latest/configuration/index.html @@ -82,4 +82,4 @@ min_signal = 1000 verbose = false num_reported_options = 2 -execution_mode = "none" +execution_mode = "none" diff --git a/latest/contributing/index.html b/latest/contributing/index.html index fbc33a8..4ea560e 100644 --- a/latest/contributing/index.html +++ b/latest/contributing/index.html @@ -1,2 +1,2 @@ -Contributing · The Allocation Optimizer

Contributing

We're excited you are interested in contributing! Please follow the standards put forth in ColPrac to contribute to the Allocation Optimizer.

Most importantly, we'd like to emphasise a few points.

  • PRs should do a single thing.
    • We'd prefer that you submit ten small PRs that are easy to understand as compared with one massive PR that requires a full day of review.
  • PRs should add tests which cover the new or fixed functionality.
  • PRs introducing breaking changes should make this clear when opening the PR.
+Contributing · The Allocation Optimizer

Contributing

We're excited you are interested in contributing! Please follow the standards put forth in ColPrac to contribute to the Allocation Optimizer.

Most importantly, we'd like to emphasise a few points.

  • PRs should do a single thing.
    • We'd prefer that you submit ten small PRs that are easy to understand as compared with one massive PR that requires a full day of review.
  • PRs should add tests which cover the new or fixed functionality.
  • PRs introducing breaking changes should make this clear when opening the PR.
diff --git a/latest/index.html b/latest/index.html index 5052702..831a515 100644 --- a/latest/index.html +++ b/latest/index.html @@ -1,2 +1,2 @@ -Home · The Allocation Optimizer

The Allocation Optimizer

This repository contains the code for the Indexer Allocation Optimizer. The goal of this project is to enable indexers to quickly determine how to allocate so as to maximise their indexing rewards.

Warning

We do not optimise for query fees directly, as we expect signal on a subgraph to be proportional to the query fees, as was the intention behind curation. Query fee information is also not public. It is local to each gateway. As a result, we will never be able to optimise with respect to query fees unless this changes.

Note

By default, opt_mode="fast". Fast-mode is not guaranteed to converge to a global optimum. If you get strange results, you should try opt_mode="optimal". This mode is still experimental, and will take longer to run, but you may get more reasonable results with it.

We will focus on usage of the code in this documentation. We refer you to these blog posts for more technical details. We also plan to post a yellowpaper at some point diving into our approach in even more detail. Stay tuned for that! If interested in how the code works, take a peek Under The Hood!

There are a few different ways you can run the allocation optimizer.

+Home · The Allocation Optimizer

The Allocation Optimizer

This repository contains the code for the Indexer Allocation Optimizer. The goal of this project is to enable indexers to quickly determine how to allocate so as to maximise their indexing rewards.

Warning

We do not optimise for query fees directly, as we expect signal on a subgraph to be proportional to the query fees, as was the intention behind curation. Query fee information is also not public. It is local to each gateway. As a result, we will never be able to optimise with respect to query fees unless this changes.

Note

By default, opt_mode="fast". Fast-mode is not guaranteed to converge to a global optimum. If you get strange results, you should try opt_mode="optimal". This mode is still experimental, and will take longer to run, but you may get more reasonable results with it.

We will focus on usage of the code in this documentation. We refer you to these blog posts for more technical details. We also plan to post a yellowpaper at some point diving into our approach in even more detail. Stay tuned for that! If interested in how the code works, take a peek Under The Hood!

There are a few different ways you can run the allocation optimizer.

diff --git a/latest/output/index.html b/latest/output/index.html index f236ee2..7e8ab3b 100644 --- a/latest/output/index.html +++ b/latest/output/index.html @@ -50,4 +50,4 @@ graph indexer rules stop Qmaz1R8vcv9v3gUfksqiS9JUz7K9G8S5By3JYn8kTiiP5K graph indexer rules stop QmcBSr5R3K2M5tk8qeHFaX8pxAhdViYhcKD8ZegYuTcUhC graph indexer rules set QmT2Y7SHXGRt7EKXzFPYMjnrgX64PQr86EjbsHoDLNzwLy decisionBasis always allocationAmount 13539706.9 -graph indexer rules set QmXT4PhR9pwAUqkxg6tgqR8xWUsTYN7V8UgmqhrrimcqXf decisionBasis always allocationAmount 9194401.2

If instead you use "actionqueue" as the execution_mode, the Optimizer will populate your instance of the action queue.

+graph indexer rules set QmXT4PhR9pwAUqkxg6tgqR8xWUsTYN7V8UgmqhrrimcqXf decisionBasis always allocationAmount 9194401.2

If instead you use "actionqueue" as the execution_mode, the Optimizer will populate your instance of the action queue.

diff --git a/latest/provided-binary/index.html b/latest/provided-binary/index.html index ac3b2d3..28c2932 100644 --- a/latest/provided-binary/index.html +++ b/latest/provided-binary/index.html @@ -1,2 +1,2 @@ -Using The Provided Binary · The Allocation Optimizer

Using The Provided Binary

Using the provided binary has the advantage of being that only method that doesn't require that you use the Julia runtime. If you want to get running as quickly as possible, this is the path for you.

Note

We only release binaries for x86 Linux.

All you have to do is download the binary for the platform and release you want to use, unzip it, set up your configuration (Configuration) file, and run the binary from your terminal.

./path/to/unzipped/folder/bin/AllocationOpt /path/to/your_config.toml
+Using The Provided Binary · The Allocation Optimizer

Using The Provided Binary

Using the provided binary has the advantage of being that only method that doesn't require that you use the Julia runtime. If you want to get running as quickly as possible, this is the path for you.

Note

We only release binaries for x86 Linux.

All you have to do is download the binary for the platform and release you want to use, unzip it, set up your configuration (Configuration) file, and run the binary from your terminal.

./path/to/unzipped/folder/bin/AllocationOpt /path/to/your_config.toml
diff --git a/latest/search/index.html b/latest/search/index.html index 6d88f78..b94cd23 100644 --- a/latest/search/index.html +++ b/latest/search/index.html @@ -1,2 +1,2 @@ -Search · The Allocation Optimizer

Loading search...

    +Search · The Allocation Optimizer

    Loading search...