-
Notifications
You must be signed in to change notification settings - Fork 1
/
contract_bridge.go
50 lines (44 loc) · 1.63 KB
/
contract_bridge.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package gosuilending
import (
"context"
"github.com/coming-chat/go-sui/v2/sui_types"
"github.com/coming-chat/go-sui/v2/types"
)
type (
BindingArgs struct {
WormholeMessageCoins []sui_types.ObjectID // vector<Coin<SUI>>
WormholeMessageAmount string
DolaChainId uint16
BindAddress string
}
UnbindingArgs struct {
WormholeMessageCoins []sui_types.ObjectID // vector<Coin<SUI>>
WormholeMessageAmount string
DolaChainId uint16
UnbindAddress string
}
)
func (c *Contract) SendBinding(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, bindingArgs BindingArgs, callOptions CallOptions) (*types.TransactionBytes, error) {
args := []any{
*c.poolState,
*c.wormholeState,
bindingArgs.WormholeMessageCoins,
bindingArgs.WormholeMessageAmount,
bindingArgs.DolaChainId,
bindingArgs.BindAddress,
}
resp, err := c.client.MoveCall(ctx, signer, *c.bridgePoolPackageId, "bridge_pool", "send_binding", typeArgs, args, callOptions.Gas, types.NewSafeSuiBigInt(callOptions.GasBudget))
return resp, err
}
func (c *Contract) SendingUnbinding(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, unbindingArgs UnbindingArgs, callOptions CallOptions) (*types.TransactionBytes, error) {
args := []any{
*c.poolState,
*c.wormholeState,
unbindingArgs.WormholeMessageCoins,
unbindingArgs.WormholeMessageAmount,
unbindingArgs.DolaChainId,
unbindingArgs.UnbindAddress,
}
resp, err := c.client.MoveCall(ctx, signer, *c.bridgePoolPackageId, "bridge_pool", "send_unbinding", typeArgs, args, callOptions.Gas, types.NewSafeSuiBigInt(callOptions.GasBudget))
return resp, err
}