You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(order): add allowDeposit option to matchOrders
Add allowDeposit option to automatically deposit nRLC from wallet to account
when account balance is insufficient during order matching.
When set to true, automatically deposits nRLC from wallet to account and
executes matchOrders in a single transaction using approveAndCall.
- Add allowDeposit parameter to matchOrders method
- Implement automatic deposit of only missing amount via approveAndCall
- Add tests for allowDeposit scenarios including insufficient wallet balance
- Update documentation with concise description
|`options.allowDeposit?`|`boolean`| allow automatic deposit from wallet when account balance is insufficient when `true`, automatically deposits nRLC from wallet to account and executes matchOrders in a single transaction using `approveAndCall`_NB_: the requester's wallet must have sufficient nRLC balance before matching orders |
500
501
|`options.preflightCheck?`|`boolean`| - |
501
502
|`options.useVoucher?`|`boolean`| use a voucher contract to sponsor the deal |
502
503
|`options.voucherAddress?`|`string`| override the voucher contract to use, must be combined with `useVoucher: true` the user must be authorized by the voucher's owner to use it |
`Cost per task (${costPerTask}) is greater than requester account stake (${stake}). Orders can't be matched. If you are the requester, you should deposit to top up your account`,
1027
1033
);
1028
1034
}
1029
1035
if(stake.lt(totalCost)){
1036
+
if(allowDeposit){
1037
+
// Will handle deposit via approveAndCall
1038
+
return{insufficient: true, totalCost };
1039
+
}
1030
1040
thrownewError(
1031
1041
`Total cost for ${matchableVolume} tasks (${totalCost}) is greater than requester account stake (${stake}). Orders can't be matched. If you are the requester, you should deposit to top up your account or reduce your requestorder volume`,
0 commit comments