File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ export default class Proxy {
83
83
)
84
84
85
85
// Tx2: approve proxy contract transfers of DAI Token
86
- await this . daiToken . methods . approve ( proxyAddr , '-1' ) . send ( { from : user } )
86
+ await this . daiToken . methods . approve ( proxyAddr , '-1' ) . send ( { from : user , gas : gasLimit } )
87
87
88
88
return proxy
89
89
}
@@ -156,10 +156,17 @@ export default class Proxy {
156
156
* Ask the user to approve his DAI for this proxy
157
157
* @param {address } proxyAddr Address of the proxy
158
158
* @param {address } user User of the system - a CFD party
159
+ * @param {Number } gasLimit How much gas we are willing to spent
160
+ * @param {Number } gasPrice Price of the gas
161
+ (if undefined, will use the default value from config file)
159
162
* @return {Number } Allowed amount by the user for this proxy
160
163
*/
161
- approve ( proxyAddr , user ) {
162
- return this . daiToken . methods . approve ( proxyAddr , '-1' ) . send ( { from : user } )
164
+ approve ( proxyAddr , user , gasLimit = 100000 , gasPrice = undefined ) {
165
+ return this . daiToken . methods . approve ( proxyAddr , '-1' ) . send ( {
166
+ from : user ,
167
+ gas : gasLimit ,
168
+ gasPrice : gasPrice || this . config . gasPrice ,
169
+ } )
163
170
}
164
171
165
172
/**
You can’t perform that action at this time.
0 commit comments