-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Edits all additions, updates what to build page * Add dev tooling page back to sidebar * fixes broken links error * fix typo * save how-to index page properly * Add back simple contract to make sidebar carets same size
- Loading branch information
1 parent
d786cb9
commit 1d188a8
Showing
9 changed files
with
117 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: Dev Tooling | ||
description: An up-to-date list of software to help you build on SUAVE | ||
--- | ||
|
||
Here is an up-to-date list of software and repositories to help you build on [SUAVE Rigil](/technical/specs/rigil): | ||
|
||
- [Golang SDK](/how-to/interact-with-suave/golang-sdk) | ||
- [Typescript SDK: SUAVE-viem](/how-to/interact-with-suave/typescript-sdk) | ||
- [Example Golang Script](/how-to/interact-with-suave/deploy-and-test-example-suapp) | ||
- [SUAVE Rigil Specs](/technical/specs/rigil) | ||
- [SUAPP Examples Repo](https://github.com/flashbots/suapp-examples) | ||
- [suave-geth repo](https://github.com/flashbots/suave-geth) | ||
- [SAUVE Forge](https://github.com/flashbots/suave-geth/blob/main/suave/sol/libraries/SuaveForge.sol) |
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,93 @@ | ||
--- | ||
title: Create Contracts | ||
description: Deploy a precompiled exxample contract on SUAVE | ||
--- | ||
|
||
This sub-section of guides will walk you through creating and deploying increasingly complex smart contracts. | ||
|
||
We've written a number of example smart contracts to help get you started thinking about what's possible. | ||
|
||
This script uses the [golang SDK](/how-to/interact-with-suave/golang-sdk), and deploys an example contract we've already set up to keep things maximally simple. | ||
|
||
Inside `suave-geth` repo, create a new file in `suave/devenv/cmd` called `deploy.go`: | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"crypto/ecdsa" | ||
"fmt" | ||
|
||
_ "embed" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/crypto" | ||
"github.com/ethereum/go-ethereum/rpc" | ||
"github.com/ethereum/go-ethereum/suave/e2e" | ||
"github.com/ethereum/go-ethereum/suave/sdk" | ||
) | ||
|
||
var ( | ||
// This is the address we used when starting the MEVM | ||
exNodeEthAddr = common.HexToAddress("b5feafbdd752ad52afb7e1bd2e40432a485bbb7f") | ||
exNodeNetAddr = "http://localhost:8545" | ||
// This account is funded in your local SUAVE network | ||
// address: 0xBE69d72ca5f88aCba033a063dF5DBe43a4148De0 | ||
fundedAccount = newPrivKeyFromHex( | ||
"91ab9a7e53c220e6210460b65a7a3bb2ca181412a8a7b43ff336b3df1737ce12" | ||
) | ||
) | ||
|
||
var ( | ||
mevShareArtifact = e2e.MevShareBidContract | ||
) | ||
|
||
func main() { | ||
rpcClient, _ := rpc.Dial(exNodeNetAddr) | ||
mevmClt := sdk.NewClient(rpcClient, fundedAccount.priv, exNodeEthAddr) | ||
|
||
var mevShareContract *sdk.Contract | ||
_ = mevShareContract | ||
|
||
txnResult, err := sdk.DeployContract(mevShareArtifact.Code, mevmClt) | ||
if err != nil { | ||
fmt.Errorf("Failed to deploy contract: %v", err) | ||
} | ||
receipt, err := txnResult.Wait() | ||
if err != nil { | ||
fmt.Errorf("Failed to wait for transaction result: %v", err) | ||
} | ||
if receipt.Status == 0 { | ||
fmt.Errorf("Failed to deploy contract: %v", err) | ||
} | ||
|
||
fmt.Printf("- Example contract deployed: %s\n", receipt.ContractAddress) | ||
mevShareContract = sdk.GetContract(receipt.ContractAddress, mevShareArtifact.Abi, mevmClt) | ||
} | ||
|
||
// Helpers, not unique to SUAVE | ||
|
||
type privKey struct { | ||
priv *ecdsa.PrivateKey | ||
} | ||
|
||
func newPrivKeyFromHex(hex string) *privKey { | ||
key, err := crypto.HexToECDSA(hex) | ||
if err != nil { | ||
panic(fmt.Sprintf("failed to parse private key: %v", err)) | ||
} | ||
return &privKey{priv: key} | ||
} | ||
``` | ||
|
||
If you now run: | ||
|
||
```bash | ||
go run suave/devenv/cmd/deploy.go | ||
``` | ||
|
||
You should see the address of your new example contract printed in the terminal. | ||
|
||
The important parts to note when deploying contracts are the call to [`e2e`](https://github.com/flashbots/suave-geth/blob/main/suave/e2e/contracts.go), which helps generate ABIs and bytecode for contracts, and the `sdk.DeplyContract` and `sdk.GetContract`. | ||
|
||
If you're able to generate the necessary ABIs and bytecode, you should be able to deploy any contract you like using the above pattern. |
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