@@ -122,12 +122,10 @@ task("deploy-pool-from-factory", "deploys a pie smart pool from the factory")
122
122
const tokenAmounts : BigNumberish [ ] = [ ] ;
123
123
const tokenWeights : BigNumberish [ ] = [ ] ;
124
124
125
-
126
-
127
125
for ( const token of tokens ) {
128
126
tokenAddresses . push ( token . address ) ;
129
- tokenWeights . push ( constants . WeiPerEther . mul ( token . weight ) . div ( 2 ) ) ;
130
-
127
+ tokenWeights . push ( parseEther ( token . weight ) . div ( 2 ) ) ;
128
+
131
129
// Calc amount
132
130
let amount = new BigNumber ( ( config . initialValue / token . value * token . weight / 100 * config . initialSupply * 10 ** token . decimals ) . toString ( ) ) ;
133
131
tokenAmounts . push ( amount ) ;
@@ -224,25 +222,25 @@ task("deploy-smart-pool-complete")
224
222
225
223
for ( const token of tokens ) {
226
224
tokenAddresses . push ( token . address ) ;
227
- tokenWeights . push ( constants . WeiPerEther . mul ( token . weight ) . div ( 2 ) ) ;
228
-
225
+ tokenWeights . push ( parseEther ( token . weight ) . div ( 2 ) ) ;
226
+
229
227
// Calc amount
230
- let amount = new BigNumber ( ( config . initialValue / token . value * token . weight / 100 * config . initialSupply * 10 ** token . decimals ) . toString ( ) ) ;
228
+ const amount = new BigNumber ( Math . floor ( ( config . initialValue / token . value * token . weight / 100 * config . initialSupply * 10 ** token . decimals ) ) . toString ( ) ) ;
231
229
tokenAmounts . push ( amount ) ;
232
230
233
231
// Approve factory to spend token
234
232
const tokenContract = IERC20Factory . connect ( token . address , signers [ 0 ] ) ;
235
233
236
234
const allowance = await tokenContract . allowance ( await signers [ 0 ] . getAddress ( ) , factory . address ) ;
237
235
if ( allowance . lt ( amount ) ) {
238
- const approveTx = await tokenContract . approve ( factory . address , constants . WeiPerEther ) ;
236
+ const approveTx = await tokenContract . approve ( factory . address , constants . MaxUint256 ) ;
239
237
console . log ( `Approved: ${ token . address } tx: ${ approveTx . hash } ` ) ;
240
238
await approveTx . wait ( 1 ) ;
241
239
}
242
-
240
+
243
241
}
244
242
245
- const tx = await factory . newProxiedSmartPool ( name , symbol , initialSupply , tokenAddresses , tokenAmounts , tokenWeights , cap ) ;
243
+ const tx = await factory . newProxiedSmartPool ( name , symbol , initialSupply , tokenAddresses , tokenAmounts , tokenWeights , cap , { gasLimit : 8000000 } ) ;
246
244
const receipt = await tx . wait ( 2 ) ; //wait for 2 confirmations
247
245
const event = receipt . events . pop ( ) ;
248
246
console . log ( `Deployed smart pool at : ${ event . address } ` ) ;
@@ -329,7 +327,6 @@ task("deploy-balancer-pool", "deploys a balancer pool from a factory")
329
327
console . log ( `Deployed balancer pool at : ${ event . address } ` ) ;
330
328
} ) ;
331
329
332
- //npx buidler balancer-bind-token --pool 0xfE682598599015d9f0EE4A4B56dE1CEfd27Cb7d5 --token 0x363BE4b8F3a341f720AbCDC666b1FB769BE73852 --balance 0.07 --decimals 6 --weight 3.5 --network kovan
333
330
task ( "balancer-bind-token" , "binds a token to a balancer pool" )
334
331
. addParam ( "pool" , "the address of the Balancer pool" )
335
332
. addParam ( "token" , "address of the token to bind" )
@@ -378,7 +375,7 @@ task("balancer-set-controller")
378
375
. setAction ( async ( taskArgs , { ethers } ) => {
379
376
const signers = await ethers . getSigners ( ) ;
380
377
const pool = IBPoolFactory . connect ( taskArgs . pool , signers [ 0 ] ) ;
381
-
378
+
382
379
const tx = await pool . setController ( taskArgs . controller ) ;
383
380
const receipt = await tx . wait ( 1 ) ;
384
381
0 commit comments