-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add network command line option and embedded configs (#137)
* chore: Source control cmd/lilypad * feat: Add embedded configs * feat: Add network option * chore: Remove hardcoded web3 and service defaults * chore: Lint fix out-of-order import * docs: Update controller address * feat: Add GCP deprecation notice (#138) feat: Add deprecation notice for GCP testnet * test: Add dev environment * build: Add network option to stack and Docker builds
- Loading branch information
Showing
30 changed files
with
264 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package options | ||
|
||
import ( | ||
"embed" | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/BurntSushi/toml" | ||
"github.com/lilypad-tech/lilypad/pkg/data" | ||
"github.com/lilypad-tech/lilypad/pkg/web3" | ||
) | ||
|
||
//go:embed configs | ||
var fs embed.FS | ||
|
||
type Config struct { | ||
Web3 web3.Web3Options `toml:"web3"` | ||
ServiceConfig data.ServiceConfig `toml:"services"` | ||
} | ||
|
||
// TODO(bgins) Check for user-defined config files | ||
func getConfig(network string) (*Config, error) { | ||
var config Config | ||
|
||
path := fmt.Sprintf("configs/%s.toml", network) | ||
config_toml, err := fs.ReadFile(path) | ||
if err != nil { | ||
return nil, fmt.Errorf("network %s does not exist", network) | ||
} | ||
|
||
_, err = toml.Decode(string(config_toml), &config) | ||
if err != nil { | ||
return nil, errors.New("unable to parse config file") | ||
} | ||
|
||
return &config, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[services] | ||
solver = "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" | ||
mediator = ["0x90F79bf6EB2c4f870365E785982E1f101E93b906"] | ||
|
||
[web3] | ||
rpc_url = "ws://localhost:8546" | ||
chain_id = 421614 | ||
controller_address = "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1" | ||
payments_address = "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6" | ||
storage_address = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" | ||
users_address = "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82" | ||
token_address = "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853" | ||
mediation_address = "0x0B306BF915C4d645ff596e518fAf3F9669b97016" | ||
jobcreator_address = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[services] | ||
solver = "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" | ||
mediator = ["0x90F79bf6EB2c4f870365E785982E1f101E93b906"] | ||
|
||
[web3] | ||
rpc_url = "wss://devnet-chain-ws.lilypad.tech" | ||
chain_id = 421614 | ||
controller_address = "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1" | ||
payments_address = "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6" | ||
storage_address = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" | ||
users_address = "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82" | ||
token_address = "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853" | ||
mediation_address = "0x0B306BF915C4d645ff596e518fAf3F9669b97016" | ||
jobcreator_address = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[services] | ||
solver = "0xe05e1b71955da4934938a6b16f97e1db9de6b764" | ||
mediator = ["0x7B49d6ee530B0A538D26E344f3B02E79ACa96De2"] | ||
|
||
[web3] | ||
rpc_url = "wss://arbitrum-sepolia.infura.io/ws/v3/07472a48382e4679ae818aad0c21cf90" | ||
chain_id = 421614 | ||
controller_address = "0xF2fD1B9b262982F12446149A27d8901Ac68dcB59" | ||
payments_address = "0x6f982192B4D225D67ED52A31308a602438882D6b" | ||
storage_address = "0xEB383625D7837aD49C1909f74d05a2db247CE0ca" | ||
users_address = "0x8FBAC8549fe9cb0630f7E30929C8256b9b67E68f" | ||
token_address = "0x0AabEbf21Cc4591475bb64e105267b3d55C7e0f1" | ||
mediation_address = "0x7B49d6ee530B0A538D26E344f3B02E79ACa96De2" | ||
jobcreator_address = "0x691ddE4710baFA7D0d7c02da32FeFB513CC870fA" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package options | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/davecgh/go-spew/spew" | ||
"github.com/lilypad-tech/lilypad/pkg/data" | ||
"github.com/lilypad-tech/lilypad/pkg/web3" | ||
) | ||
|
||
// TODO(bgins) Remove once users have migrated away from old testnet | ||
func CheckDeprecation(serviceOptions data.ServiceConfig, web3Options web3.Web3Options) { | ||
if web3Options.RpcURL == "ws://testnet.lilypad.tech:8546" { | ||
web3Options.PrivateKey = "*****" | ||
log.SetFlags(0) | ||
log.Fatal(fmt.Sprintf(`This testnet has been deprecated. Please remove all environment variables for RPC URL, chain ID, and contract addresses. | ||
Your environment currently contains: | ||
%v | ||
%v | ||
The new testnet environment will be set by default, and you will only need to set your private key. | ||
`, spew.Sdump(web3Options), spew.Sdump(serviceOptions))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.