Skip to content

Commit 7dfbaff

Browse files
committed
swap out fo sdk
1 parent 33a1d4d commit 7dfbaff

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

packages/common/src/allo/backends/allo-v2.ts

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
AlloAbi,
33
Allo as AlloV2Contract,
44
CreateProfileArgs,
5+
DirectAllocationStrategy,
56
DirectGrantsLiteStrategy,
67
DirectGrantsLiteStrategyTypes,
78
DonationVotingMerkleDistributionDirectTransferStrategyAbi,
@@ -1496,19 +1497,40 @@ export class AlloV2 implements Allo {
14961497
_token = getAddress(NATIVE);
14971498
}
14981499

1499-
const encodeData = utils.defaultAbiCoder.encode(
1500-
["address", "uint256", "address", "uint256"],
1501-
[args.recipient, args.amount, _token, args.nonce]
1500+
1501+
const strategy = new DirectAllocationStrategy({
1502+
chain: this.chainId,
1503+
poolId: poolId,
1504+
});
1505+
1506+
const txData = strategy.getAllocateData(
1507+
{
1508+
profileOwner: args.recipient,
1509+
amount: BigInt(args.amount.toString()),
1510+
token: _token,
1511+
nonce: args.nonce,
1512+
},
15021513
);
15031514

1504-
const tx = await sendTransaction(this.transactionSender, {
1505-
address: this.allo.address(),
1506-
abi: AlloAbi,
1507-
functionName: "allocate",
1508-
args: [poolId, encodeData as Hex],
1509-
value: args.tokenAddress === zeroAddress ? args.amount : 0n,
1515+
const tx = await sendRawTransaction(this.transactionSender, {
1516+
to: txData.to,
1517+
data: txData.data,
1518+
value: BigInt(txData.value),
15101519
});
15111520

1521+
// const encodeData = utils.defaultAbiCoder.encode(
1522+
// ["address", "uint256", "address", "uint256"],
1523+
// [args.recipient, args.amount, _token, args.nonce]
1524+
// );
1525+
1526+
// const tx = await sendTransaction(this.transactionSender, {
1527+
// address: this.allo.address(),
1528+
// abi: AlloAbi,
1529+
// functionName: "allocate",
1530+
// args: [poolId, encodeData as Hex],
1531+
// value: args.tokenAddress === zeroAddress ? args.amount : 0n,
1532+
// });
1533+
15121534
emit("transaction", tx);
15131535

15141536
if (tx.type === "error") {

0 commit comments

Comments
 (0)