MCPcopy Create free account
hub / github.com/Sifchain/sifnode / TestOpenPosition

Function TestOpenPosition

cmd/siftest/test.go:238–256  ·  view source on GitHub ↗
(clientCtx client.Context, txf tx.Factory, key keyring.Info)

Source from the content-addressed store, hash-verified

236}
237
238func TestOpenPosition(clientCtx client.Context, txf tx.Factory, key keyring.Info) error {
239 msg := types.MsgOpen{
240 Signer: key.GetAddress().String(),
241 CollateralAsset: "rowan",
242 CollateralAmount: sdk.NewUint(100),
243 BorrowAsset: "ceth",
244 Position: types.Position_LONG,
245 Leverage: sdk.NewDec(2),
246 }
247
248 res, err := buildAndBroadcast(clientCtx, txf, key, &msg)
249 if err != nil {
250 panic(err)
251 }
252
253 log.Print(res)
254
255 return err
256}
257
258func buildAndBroadcast(clientCtx client.Context, txf tx.Factory, key keyring.Info, msg sdk.Msg) (*sdk.TxResponse, error) {
259 txb, err := tx.BuildUnsignedTx(txf, msg)

Callers 1

runTestFunction · 0.85

Calls 3

buildAndBroadcastFunction · 0.85
StringMethod · 0.45
GetAddressMethod · 0.45

Tested by

no test coverage detected