diff --git a/abi.go b/abi.go index a2afbf3..01af01f 100644 --- a/abi.go +++ b/abi.go @@ -3,8 +3,12 @@ package main import ( "context" _ "embed" + "encoding/base64" "encoding/hex" "fmt" + "log" + "strings" + "github.com/CosmWasm/wasmd/x/wasm" "github.com/JackalLabs/mulberry/jackal/uploader" evmTypes "github.com/JackalLabs/mulberry/types" @@ -13,8 +17,6 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "log" - "strings" ) var ABI = `[ @@ -74,7 +76,6 @@ func init() { } func handleLog(vLog *types.Log, w *wallet.Wallet, q *uploader.Queue) { - event := struct { Sender common.Address Merkle string @@ -115,9 +116,11 @@ func handleLog(vLog *types.Log, w *wallet.Wallet, q *uploader.Queue) { var hours int64 = 100 * 365 * 24 + merkleBase64 := base64.StdEncoding.EncodeToString(merkleRoot) + storageMsg := evmTypes.ExecuteMsg{ PostFile: &evmTypes.ExecuteMsgPostFile{ - Merkle: merkleRoot, + Merkle: merkleBase64, FileSize: int64(event.Size), ProofInterval: 3600, ProofType: 0, @@ -163,5 +166,4 @@ func handleLog(vLog *types.Log, w *wallet.Wallet, q *uploader.Queue) { log.Println(res.RawLog) log.Println(res.TxHash) - } diff --git a/jackal/uploader/queue.go b/jackal/uploader/queue.go index 24cfa69..7c21f1c 100644 --- a/jackal/uploader/queue.go +++ b/jackal/uploader/queue.go @@ -49,7 +49,7 @@ func (q *Queue) Listen() { go func() { for !q.stopped { time.Sleep(time.Minute * 10) - q.UpdateGecko() // updating price oracle every 5 minutes + _ = q.UpdateGecko() // updating price oracle every 5 minutes, we don't care about errors tbh } }() } @@ -129,7 +129,6 @@ func (q *Queue) UpdateGecko() error { } func (q *Queue) GetCost(kbs int64, hours int64) int64 { - pricePerTBPerMonth := 15.0 * float64(kbs) * float64(hours) quantifiedPricePerTBPerMonth := pricePerTBPerMonth / 3.0 diff --git a/main.go b/main.go index 96f1a6f..bb016b0 100644 --- a/main.go +++ b/main.go @@ -3,14 +3,15 @@ package main import ( "context" "fmt" + "log" + "os" + "time" + "github.com/JackalLabs/mulberry/jackal/uploader" jWallet "github.com/JackalLabs/mulberry/jackal/wallet" walletTypes "github.com/desmos-labs/cosmos-go-wallet/types" "github.com/ethereum/go-ethereum" "github.com/joho/godotenv" - "log" - "os" - "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -30,6 +31,10 @@ func main() { GasPrice: "0.02ujkl", GasAdjustment: 1.5, }) + if err != nil { + log.Fatal(err) + return + } log.Printf("Address: %s\n", w.AccAddress())