@@ -92,6 +92,15 @@ export function getDirectAllocationPoolId(chainId: number) {
92
92
}
93
93
}
94
94
95
+ export function getDirectAllocationStrategyAddress ( chainId : number ) {
96
+ switch ( chainId ) {
97
+ case 11155111 :
98
+ return "0xd60BCfa8714949c478d88da51A7450703A32Cf35" ;
99
+ default :
100
+ return undefined ;
101
+ }
102
+ }
103
+
95
104
export class AlloV2 implements Allo {
96
105
private transactionSender : TransactionSender ;
97
106
private ipfsUploader : IpfsUploader ;
@@ -1469,14 +1478,25 @@ export class AlloV2 implements Allo {
1469
1478
1470
1479
const poolId = BigInt ( args . poolId ) ;
1471
1480
1481
+ const strategy = new DirectAllocationStrategy ( {
1482
+ chain : this . chainId ,
1483
+ poolId : poolId ,
1484
+ } ) ;
1485
+
1486
+ const strategyAddress = getDirectAllocationStrategyAddress ( this . chainId ) ;
1487
+
1488
+ if ( strategyAddress === undefined ) {
1489
+ return error ( new AlloError ( "Direct allocation strategy not found" ) ) ;
1490
+ }
1491
+
1472
1492
if ( args . tokenAddress === zeroAddress || ! args . requireTokenApproval ) {
1473
1493
emit ( "tokenApprovalStatus" , success ( null ) ) ;
1474
1494
} else {
1475
1495
const approvalTx = await sendTransaction ( this . transactionSender , {
1476
1496
address : args . tokenAddress ,
1477
1497
abi : Erc20ABI ,
1478
1498
functionName : "approve" ,
1479
- args : [ this . allo . address ( ) , args . amount ] ,
1499
+ args : [ strategyAddress , args . amount ] ,
1480
1500
} ) ;
1481
1501
1482
1502
if ( approvalTx . type === "error" ) {
@@ -1502,11 +1522,6 @@ export class AlloV2 implements Allo {
1502
1522
_token = getAddress ( NATIVE ) ;
1503
1523
}
1504
1524
1505
- const strategy = new DirectAllocationStrategy ( {
1506
- chain : this . chainId ,
1507
- poolId : poolId ,
1508
- } ) ;
1509
-
1510
1525
const txData = strategy . getAllocateData ( {
1511
1526
profileOwner : args . recipient ,
1512
1527
amount : BigInt ( args . amount . toString ( ) ) ,
0 commit comments