Skip to content

Commit

Permalink
adding base64 encoding & lint
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Sep 12, 2024
1 parent 8564dbe commit de94cab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
12 changes: 7 additions & 5 deletions abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 = `[
Expand Down Expand Up @@ -74,7 +76,6 @@ func init() {
}

func handleLog(vLog *types.Log, w *wallet.Wallet, q *uploader.Queue) {

event := struct {
Sender common.Address
Merkle string
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -163,5 +166,4 @@ func handleLog(vLog *types.Log, w *wallet.Wallet, q *uploader.Queue) {

log.Println(res.RawLog)
log.Println(res.TxHash)

}
3 changes: 1 addition & 2 deletions jackal/uploader/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}()
}
Expand Down Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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())

Expand Down

0 comments on commit de94cab

Please sign in to comment.