mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-06 04:10:31 +08:00
Support BDFL orgs
This commit is contained in:
@@ -18,22 +18,30 @@
|
||||
Success,
|
||||
}
|
||||
|
||||
enum Governance {
|
||||
BDFL = "bdfl",
|
||||
Quorum = "quorum",
|
||||
}
|
||||
|
||||
const orgTypes = [
|
||||
{ label: "Single signer", value: "bdfl" },
|
||||
{ label: "Quorum", value: "dao" },
|
||||
{ label: "Single signer", value: Governance.BDFL },
|
||||
{ label: "Quorum", value: Governance.Quorum },
|
||||
];
|
||||
|
||||
let state = State.Idle;
|
||||
let error: Err | null = null;
|
||||
let org: Org | null = null;
|
||||
let governance: string = "bdfl";
|
||||
let governance = Governance.BDFL;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const createOrg = async () => {
|
||||
state = State.Signing;
|
||||
|
||||
try {
|
||||
let tx = await Org.create(owner, config);
|
||||
let tx = governance === Governance.Quorum
|
||||
? await Org.createMultiSig([owner], 1, config)
|
||||
: await Org.create(owner, config);
|
||||
|
||||
state = State.Pending;
|
||||
|
||||
let receipt = await tx.wait();
|
||||
@@ -48,7 +56,10 @@
|
||||
};
|
||||
|
||||
const onGovernanceChanged = (event: { detail: string }) => {
|
||||
governance = event.detail;
|
||||
switch (event.detail) {
|
||||
case "bdfl": governance = Governance.BDFL; break;
|
||||
case "quorum": governance = Governance.Quorum; break;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -90,7 +101,7 @@
|
||||
{:else if state === State.Signing}
|
||||
<div class="highlight">Confirm transaction in your wallet</div>
|
||||
{:else if state === State.Pending}
|
||||
<div class="highlight">Waiting for transaction to be processed</div>
|
||||
<div class="highlight">Waiting for transaction to be processed...</div>
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
|
||||
+18
-1
@@ -6,6 +6,7 @@ import { assert } from '@app/error';
|
||||
import type { Config } from '@app/config';
|
||||
|
||||
const orgFactoryAbi = [
|
||||
"function createOrg(address) returns (address)",
|
||||
"function createOrg(address[], uint256) returns (address)",
|
||||
"event OrgCreated(address, address)",
|
||||
];
|
||||
@@ -59,6 +60,22 @@ export class Org {
|
||||
}
|
||||
}
|
||||
|
||||
static async createMultiSig(
|
||||
owners: [string],
|
||||
threshold: number,
|
||||
config: Config,
|
||||
): Promise<TransactionResponse> {
|
||||
const orgFactory = new ethers.Contract(
|
||||
config.orgFactory.address,
|
||||
orgFactoryAbi,
|
||||
config.signer
|
||||
);
|
||||
|
||||
return orgFactory['createOrg(address[],uint256)'](owners, threshold, {
|
||||
gasLimit: config.gasLimits.createOrg
|
||||
});
|
||||
}
|
||||
|
||||
static async create(
|
||||
owner: string,
|
||||
config: Config,
|
||||
@@ -69,7 +86,7 @@ export class Org {
|
||||
config.signer
|
||||
);
|
||||
|
||||
return orgFactory.createOrg([owner], 1, {
|
||||
return orgFactory['createOrg(address)'](owner, {
|
||||
gasLimit: config.gasLimits.createOrg
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
"address": "0x59b5eee36f5fa52400A136Fd4630Ee2bF126a4C0"
|
||||
},
|
||||
"orgFactory": {
|
||||
"address": "0x2007bcEf1247CD03Bb4262eF420D6487368f473B"
|
||||
"address": "0xe1814B14430CF14f0950A29FF26217115B815676"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user