Skip to content

Commit

Permalink
mvp of v2.1 sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
veganbeef committed Nov 8, 2024
1 parent 81e6984 commit 3ed4abb
Show file tree
Hide file tree
Showing 101 changed files with 8,502 additions and 14,940 deletions.
23 changes: 15 additions & 8 deletions dist/Allo/Allo.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,31 @@ export declare class Allo {
getBaseFee(): Promise<bigint>;
getTreasury(): Promise<string>;
getRegistry(): Promise<string>;
isCloneableStrategy(): Promise<boolean>;
isCloneableStrategy(strategy: `0x${string}`): Promise<boolean>;
getPool(poolId: bigint): Promise<Pool>;
isTrustedForwarder(forwarder: `0x${string}`): Promise<boolean>;
getOwner(): Promise<`0x${string}`>;
getAllo(): Promise<`0x${string}`>;
createPoolWithCustomStrategy({ profileId, strategy, initStrategyData, token, amount, metadata, managers, }: CreatePoolArgs): TransactionData;
createPool({ profileId, strategy, initStrategyData, token, amount, metadata, managers, }: CreatePoolArgs): TransactionData;
updatePoolMetadata({ poolId, metadata, }: UpdateMetaDataArgs): TransactionData;
updateRegistry(registry: `0x${string}`): TransactionData;
updateTreasury(registry: `0x${string}`): TransactionData;
updateTreasury(treasury: `0x${string}`): TransactionData;
updatePercentFee(percentage: bigint): TransactionData;
updateBaseFee(percentage: bigint): TransactionData;
addToCloneableStrategies(strategy: `0x${string}`): TransactionData;
removeFromCloneableStrategies(strategy: `0x${string}`): TransactionData;
addPoolManager(poolId: bigint, manager: `0x${string}`): TransactionData;
removePoolManager(poolId: bigint, manager: `0x${string}`): TransactionData;
addPoolManagers(poolId: bigint, managers: `0x${string}`[]): TransactionData;
removePoolManagers(poolId: bigint, managers: `0x${string}`[]): TransactionData;
addPoolManagersInMultiplePools(poolIds: bigint[], managers: `0x${string}`[]): TransactionData;
removePoolManagersInMultiplePools(poolIds: bigint[], managers: `0x${string}`[]): TransactionData;
recoverFunds(token: `0x${string}`, recipient: `0x${string}`): TransactionData;
registerRecipient(poolId: bigint, strategyData: `0x${string}`): TransactionData;
batchRegisterRecipient(poolIds: bigint[], strategyData: `0x${string}`[]): TransactionData;
registerRecipient(poolId: bigint, recipientAddresses: `0x${string}`[], data: `0x${string}`): TransactionData;
batchRegisterRecipient(poolIds: bigint[], recipientAddresses: `0x${string}`[][], // question: should this be updated to be an array of objects, one per pool?
data: `0x${string}`[]): TransactionData;
fundPool(poolId: bigint, amount: bigint): TransactionData;
allocate(poolId: bigint, strategyData: `0x${string}`): TransactionData;
batchAllocate(poolIds: bigint[], strategyData: `0x${string}`[]): TransactionData;
allocate(poolId: bigint, recipients: `0x${string}`[], amounts: bigint[], data: `0x${string}`): TransactionData;
batchAllocate(poolIds: bigint[], recipients: `0x${string}`[][], // question: should this be updated to be an array of objects, one per pool?
amounts: bigint[][], values: bigint[], datas: `0x${string}`[]): TransactionData;
distribute(poolId: bigint, recipientId: `0x${string}`[], strategyData: `0x${string}`): TransactionData;
}
114 changes: 79 additions & 35 deletions dist/Allo/Allo.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Allo {
address() {
return this.addr;
}
// Read only funcitons
// Read-only functions
getFeeDenominator() {
return __awaiter(this, void 0, void 0, function* () {
const denominator = yield this.contract.read.getFeeDenominator();
Expand All @@ -54,46 +54,64 @@ class Allo {
}
getStrategy(poolId) {
return __awaiter(this, void 0, void 0, function* () {
const strategyAddress = this.contract.read.getStrategy([poolId]);
const strategyAddress = yield this.contract.read.getStrategy([poolId]);
return strategyAddress;
});
}
getPercentFee() {
return __awaiter(this, void 0, void 0, function* () {
const percentage = this.contract.read.getPercentFee();
const percentage = yield this.contract.read.getPercentFee();
return percentage;
});
}
getBaseFee() {
return __awaiter(this, void 0, void 0, function* () {
const baseFee = this.contract.read.getBaseFee();
const baseFee = yield this.contract.read.getBaseFee();
return baseFee;
});
}
getTreasury() {
return __awaiter(this, void 0, void 0, function* () {
const treasuryAddress = this.contract.read.getTreasury();
const treasuryAddress = yield this.contract.read.getTreasury();
return treasuryAddress;
});
}
getRegistry() {
return __awaiter(this, void 0, void 0, function* () {
const registryAddress = this.contract.read.getRegistry();
const registryAddress = yield this.contract.read.getRegistry();
return registryAddress;
});
}
isCloneableStrategy() {
isCloneableStrategy(strategy) {
return __awaiter(this, void 0, void 0, function* () {
const isCloneable = this.contract.read.isCloneableStrategy();
const isCloneable = yield this.contract.read.isCloneableStrategy([strategy]);
return isCloneable;
});
}
getPool(poolId) {
return __awaiter(this, void 0, void 0, function* () {
const pool = this.contract.read.getPool([poolId]);
const pool = yield this.contract.read.getPool([poolId]);
return pool;
});
}
isTrustedForwarder(forwarder) {
return __awaiter(this, void 0, void 0, function* () {
const isTrusted = yield this.contract.read.isTrustedForwarder([forwarder]);
return isTrusted;
});
}
getOwner() {
return __awaiter(this, void 0, void 0, function* () {
const owner = yield this.contract.read.owner();
return owner;
});
}
getAllo() {
return __awaiter(this, void 0, void 0, function* () {
const alloAddress = yield this.contract.read.getAllo();
return alloAddress;
});
}
// Write functions
createPoolWithCustomStrategy({ profileId, strategy, initStrategyData, token, amount, metadata, managers, }) {
const data = (0, viem_1.encodeFunctionData)({
Expand Down Expand Up @@ -148,7 +166,7 @@ class Allo {
const data = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "updatePoolMetadata",
args: [poolId, metadata],
args: [poolId, [metadata.protocol, metadata.pointer]],
});
return {
to: this.addr,
Expand All @@ -168,11 +186,11 @@ class Allo {
value: "0",
};
}
updateTreasury(registry) {
updateTreasury(treasury) {
const data = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "updateRegistry",
args: [registry],
functionName: "updateTreasury",
args: [treasury],
});
return {
to: this.addr,
Expand Down Expand Up @@ -228,23 +246,47 @@ class Allo {
value: "0",
};
}
addPoolManager(poolId, manager) {
addPoolManagers(poolId, managers) {
const data = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "addPoolManager",
args: [poolId, manager],
functionName: "addPoolManagers",
args: [poolId, managers],
});
return {
to: this.addr,
data: data,
value: "0",
};
}
removePoolManager(poolId, manager) {
removePoolManagers(poolId, managers) {
const data = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "removePoolManager",
args: [poolId, manager],
functionName: "removePoolManagers",
args: [poolId, managers],
});
return {
to: this.addr,
data: data,
value: "0",
};
}
addPoolManagersInMultiplePools(poolIds, managers) {
const data = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "addPoolManagersInMultiplePools",
args: [poolIds, managers],
});
return {
to: this.addr,
data: data,
value: "0",
};
}
removePoolManagersInMultiplePools(poolIds, managers) {
const data = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "removePoolManagersInMultiplePools",
args: [poolIds, managers],
});
return {
to: this.addr,
Expand All @@ -265,27 +307,28 @@ class Allo {
};
}
// Strategy functions
registerRecipient(poolId, strategyData) {
const data = (0, viem_1.encodeFunctionData)({
registerRecipient(poolId, recipientAddresses, data) {
const encodedData = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "registerRecipient",
args: [poolId, strategyData],
args: [poolId, recipientAddresses, data],
});
return {
to: this.addr,
data: data,
data: encodedData,
value: "0",
};
}
batchRegisterRecipient(poolIds, strategyData) {
const data = (0, viem_1.encodeFunctionData)({
batchRegisterRecipient(poolIds, recipientAddresses, // question: should this be updated to be an array of objects, one per pool?
data) {
const encodedData = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "batchRegisterRecipient",
args: [poolIds, strategyData],
args: [poolIds, recipientAddresses, data],
});
return {
to: this.addr,
data: data,
data: encodedData,
value: "0",
};
}
Expand All @@ -301,27 +344,28 @@ class Allo {
value: "0",
};
}
allocate(poolId, strategyData) {
const data = (0, viem_1.encodeFunctionData)({
allocate(poolId, recipients, amounts, data) {
const encodedData = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "allocate",
args: [poolId, strategyData],
args: [poolId, recipients, amounts, data],
});
return {
to: this.addr,
data: data,
data: encodedData,
value: "0",
};
}
batchAllocate(poolIds, strategyData) {
const data = (0, viem_1.encodeFunctionData)({
batchAllocate(poolIds, recipients, // question: should this be updated to be an array of objects, one per pool?
amounts, values, datas) {
const encodedData = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "batchAllocate",
args: [poolIds, strategyData],
args: [poolIds, recipients, amounts, values, datas],
});
return {
to: this.addr,
data: data,
data: encodedData,
value: "0",
};
}
Expand Down
Loading

0 comments on commit 3ed4abb

Please sign in to comment.