@@ -92,6 +92,15 @@ export function getDirectAllocationPoolId(chainId: number) {
9292 }
9393}
9494
95+ export function getDirectAllocationStrategyAddress ( chainId : number ) {
96+ switch ( chainId ) {
97+ case 11155111 :
98+ return "0xd60BCfa8714949c478d88da51A7450703A32Cf35" ;
99+ default :
100+ return undefined ;
101+ }
102+ }
103+
95104export class AlloV2 implements Allo {
96105 private transactionSender : TransactionSender ;
97106 private ipfsUploader : IpfsUploader ;
@@ -1469,14 +1478,25 @@ export class AlloV2 implements Allo {
14691478
14701479 const poolId = BigInt ( args . poolId ) ;
14711480
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+
14721492 if ( args . tokenAddress === zeroAddress || ! args . requireTokenApproval ) {
14731493 emit ( "tokenApprovalStatus" , success ( null ) ) ;
14741494 } else {
14751495 const approvalTx = await sendTransaction ( this . transactionSender , {
14761496 address : args . tokenAddress ,
14771497 abi : Erc20ABI ,
14781498 functionName : "approve" ,
1479- args : [ this . allo . address ( ) , args . amount ] ,
1499+ args : [ strategyAddress , args . amount ] ,
14801500 } ) ;
14811501
14821502 if ( approvalTx . type === "error" ) {
@@ -1502,11 +1522,6 @@ export class AlloV2 implements Allo {
15021522 _token = getAddress ( NATIVE ) ;
15031523 }
15041524
1505- const strategy = new DirectAllocationStrategy ( {
1506- chain : this . chainId ,
1507- poolId : poolId ,
1508- } ) ;
1509-
15101525 const txData = strategy . getAllocateData ( {
15111526 profileOwner : args . recipient ,
15121527 amount : BigInt ( args . amount . toString ( ) ) ,
0 commit comments