Skip to content

Commit

Permalink
Fix: hex to bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Jan 19, 2022
1 parent d879ddb commit cfa4906
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/chain/tezos/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,20 @@ func (t *Tezos) Initiate(ctx context.Context, args chain.InitiateArgs) error {
Entrypoint: "initiate",
},
}
hashed, err := args.HashedSecret.Bytes()
if err != nil {
return err
}

var value []byte
var err error
switch args.Contract {
case t.cfg.Contract:
tx.Amount = args.Amount.String()

value, err = t.tezContract.BuildInitiateParameters(ctx, atomextez.InitiateParameters{
Participant: tezgen.Address(args.Participant),
Settings: atomextez.Settings{
HashedSecret: tezgen.Bytes(args.HashedSecret),
HashedSecret: tezgen.Bytes(hashed),
RefundTime: tezgen.NewTimestamp(args.RefundTime),
Payoff: tezgen.NewInt(args.PayOff.BigInt().Int64()),
},
Expand All @@ -302,7 +306,7 @@ func (t *Tezos) Initiate(ctx context.Context, args chain.InitiateArgs) error {
value, err = contract.BuildInitiateParameters(ctx, atomexteztoken.Initiate{
TokenAddress: tezgen.Address(args.TokenAddress),
Participant: tezgen.Address(args.Participant),
HashedSecret: tezgen.Bytes(args.HashedSecret),
HashedSecret: tezgen.Bytes(hashed),
RefundTime: tezgen.NewTimestamp(args.RefundTime),
PayoffAmount: tezgen.NewInt(args.PayOff.BigInt().Int64()),
TotalAmount: tezgen.NewInt(args.Amount.BigInt().Int64()),
Expand Down

0 comments on commit cfa4906

Please sign in to comment.