func TopupFAddress() { const fBalanceThreshold uint64 = 20000000 //0.2 fBalance, err := factom.GetFactoidBalance(FaucetAddress) if err != nil { panic(err) } if fBalance < int64(fBalanceThreshold) { panic(fmt.Sprintf("Balance is too low - %v vs %v", fBalance/100000000.0, fBalanceThreshold/100000000.0)) } tx, err := factom.SendFactoid(FaucetAddress, FAddressStr, fBalanceThreshold) if err != nil { panic(err) } fmt.Printf("F Topup tx - %v\n", tx) for i := 0; ; i++ { i = i % 3 time.Sleep(5 * time.Second) ack, err := factom.FactoidACK(tx, "") if err != nil { panic(err) } str, err := primitives.EncodeJSONString(ack) if err != nil { panic(err) } fmt.Printf("Topup ack - %v", str) for j := 0; j < i+1; j++ { fmt.Printf(".") } fmt.Printf(" \r") if ack.Status != "DBlockConfirmed" { continue } fmt.Printf("Topup ack - %v\n", str) break } fBalance, _, err = CheckFactomBalance() if err != nil { panic(err) } if uint64(fBalance) < fBalanceThreshold { panic("Balance was not increased!") } }
func TopupECAddress() { //fmt.Printf("TopupECAddress - %v, %v\n", FAddressStr, ECAddressStr) const ecBalanceThreshold uint64 = 10 tx, err := factom.BuyExactEC(FAddressStr, ECAddressStr, uint64(ecBalanceThreshold)) //tx, err := factom.BuyExactEC(FaucetAddress, ECAddressStr, uint64(ecBalanceThreshold)) if err != nil { panic(err) } fmt.Printf("EC Topup tx - %v\n", tx) for i := 0; ; i++ { i = i % 3 time.Sleep(5 * time.Second) ack, err := factom.FactoidACK(tx, "") if err != nil { panic(err) } str, err := primitives.EncodeJSONString(ack) if err != nil { panic(err) } fmt.Printf("Topup ack - %v", str) for j := 0; j < i+1; j++ { fmt.Printf(".") } fmt.Printf(" \r") if ack.Status != "DBlockConfirmed" { continue } fmt.Printf("Topup ack - %v\n", str) break } _, ecBalance, err := CheckFactomBalance() if err != nil { panic(err) } if uint64(ecBalance) < ecBalanceThreshold { panic("Balance was not increased!") } }
func (e *IncreaseServerCount) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *ECBlockBody) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *DirectoryBlock) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *EBlockHeader) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *ServerFault) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *MsgAck) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *DataResponse) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *AddServerMsg) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *RequestBlock) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *DBStateMissing) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *MsgGetEntryData) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e ByteStore) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (s *FactoidSignature) JSONString() (string, error) { return primitives.EncodeJSONString(s) }
func (e *MsgFactoidTX) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *FactoidTransaction) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *FEREntry) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *AdminBlock) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *EndOfMinuteEntry) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *SignatureBlock) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *AddAuditServer) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *MsgRevealChain) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *Heartbeat) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *EntryBlockResponse) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *ServerIndexNumber) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *Bounce) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *IncreaseBalance) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *AddFederatedServer) JSONString() (string, error) { return primitives.EncodeJSONString(e) }
func (e *CommitEntryMsg) JSONString() (string, error) { return primitives.EncodeJSONString(e) }