File tree 1 file changed +42
-13
lines changed
1 file changed +42
-13
lines changed Original file line number Diff line number Diff line change @@ -131,19 +131,48 @@ impl FungibleProxy {
131
131
. to_string ( )
132
132
. into_bytes ( ) ;
133
133
134
- Promise :: new ( token_address. to_string ( ) )
135
- . function_call (
136
- "ft_transfer" . into ( ) ,
137
- main_transfer_args,
138
- YOCTO_DEPOSIT ,
139
- BASIC_GAS * 2 ,
140
- )
141
- . function_call (
142
- "ft_transfer" . into ( ) ,
143
- fee_transfer_args,
144
- YOCTO_DEPOSIT ,
145
- BASIC_GAS * 2 ,
146
- ) . then ( ext_self:: on_transfer_with_reference (
134
+ // Some tokens revert when calling `ft_transfer` with 0
135
+ let payment_promise =
136
+ if main_amount > 0 && args. fee_amount . 0 > 0 {
137
+ // Main case: amount and fee
138
+ Promise :: new ( token_address. to_string ( ) )
139
+ . function_call (
140
+ "ft_transfer" . into ( ) ,
141
+ main_transfer_args,
142
+ YOCTO_DEPOSIT ,
143
+ BASIC_GAS * 2 ,
144
+ )
145
+ . function_call (
146
+ "ft_transfer" . into ( ) ,
147
+ fee_transfer_args,
148
+ YOCTO_DEPOSIT ,
149
+ BASIC_GAS * 2 ,
150
+ )
151
+ } else if main_amount > 0 {
152
+ // No fee
153
+ Promise :: new ( token_address. to_string ( ) )
154
+ . function_call (
155
+ "ft_transfer" . into ( ) ,
156
+ main_transfer_args,
157
+ YOCTO_DEPOSIT ,
158
+ BASIC_GAS * 2 ,
159
+ )
160
+ } else if args. fee_amount . 0 > 0 {
161
+ // Only fee payment
162
+ Promise :: new ( token_address. to_string ( ) )
163
+ . function_call (
164
+ "ft_transfer" . into ( ) ,
165
+ fee_transfer_args,
166
+ YOCTO_DEPOSIT ,
167
+ BASIC_GAS * 2 ,
168
+ )
169
+ } else {
170
+ // No payment
171
+ Promise :: new ( token_address. to_string ( ) )
172
+ } ;
173
+
174
+ payment_promise
175
+ . then ( ext_self:: on_transfer_with_reference (
147
176
args,
148
177
token_address,
149
178
payer,
You can’t perform that action at this time.
0 commit comments