The Organigram Protocol is a Solidity framework for building incorruptible governance systems on Ethereum.
By assembling three simple concepts, it allows for the automated execution of any business rules in a decentralized and auditable manner:
For comprehensive documentation, please visit our official website.
Install the NPM package with:
# npm:npm install @organigram/protocol# pnpm: pnpm add @organigram/protocol
With this package, you can directly interact with the Organigram Protocol smart contracts in your Solidity and JavaScript code, or use our official clients to build your own applications on top of the protocol.
Import contract sources in your solidity code:
import "@organigram/protocol/Organ.sol";
Import contracts artifacts in your JS code:
import OrganContractABI from '@organigram/protocol/abi/Organ.sol/Organ.json' with { type: 'json' }import { getContract, type Abi } from 'viem'const contract = getContract({ address: getAddress(address as Address), abi: OrganContractABI.abi as Abi, client: { // ... viem client configuration }})
Use the official JavaScript/TypeScript client, which deploys and operates the contracts, and the React components, which draw them.
This package uses Foundry (Forge/Anvil) for local development. Install the Foundry toolchain with:
curl -L https://foundry.paradigm.xyz | bashfoundryup
Start a local node for development with Anvil:
pnpm anvil
Compile the contracts with:
pnpm build
Deploy protocol contracts to a list of networks:
pnpm deploy:protocol <comma-separated list of network names or chain ids>
Requires a .env with MNEMONIC and NEXT_PUBLIC_THIRDWEB_CLIENT_ID. The deployer account must have enough funds on each target network to cover deployment costs.
For example:
pnpm deploy:protocol mainnet,base,11155111
To deploy to the local Anvil node:
pnpm deploy:protocol anvil
By default, network RPC URLs are built from Thirdweb. You can override a specific network with RPC_URL_<chain id>, or RPC_URL_<network name>, for example RPC_URL_11155111.
The deployment script will also accept an optional --resume flag to resume the last run if the deployment has failed.
We are looking for Solidity developers and testers to keep our contracts secure and up-to-date. Please create issues in our Github page, fork and create Pull-Requests, or contact us on our Discord or at hello@organigram.ai.
The OrganigramClient contract is the entry point of the protocol on each chain. It keeps the registry of procedure types and deploys organs, assets and procedures as clones of their implementations, one by one or as a whole organigram in a single transaction. A clone address depends on its salt and on the account deploying it, so that nobody can take an address someone else predicted.
Entry point of the protocol on a chain: the registry of procedure types, and the factory of organs, assets and procedures, deployed as clones of their implementations.
constructor(string cid, address trustedForwarder, bytes32 salt);
Implementation that assets are cloned from.
function asset() view returns (address);
Deploy a single asset clone and initialize it as an ERC-20 token.
function deployAsset(string name, string symbol, uint256 initialSupply, bytes32 salt) returns (address clone);
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Token name. |
symbol | string | Token symbol. |
initialSupply | uint256 | Initial token supply minted to the caller. |
salt | bytes32 | Deterministic clone salt. |
| Returns |
| Name | Type | Description |
|---|---|---|
clone | address | Address of the deployed asset clone. |
Deploy several asset clones in one call.
function deployAssets((string, string, uint256, bytes32, bool, address)[] batch) returns (address[] clones);
Parameters
| Name | Type | Description |
|---|---|---|
batch | (string, string, uint256, bytes32, bool, address)[] | Asset deployment payloads. |
| Returns |
| Name | Type | Description |
|---|---|---|
clones | address[] | Addresses of the deployed asset clones. |
Deploy a single organ clone and initialize it.
function deployOrgan(address[] _permissionAddresses, bytes2[] _permissionValues, string cid, (address, string)[] entries, bytes32 salt) returns (address clone);
Parameters
| Name | Type | Description |
|---|---|---|
_permissionAddresses | address[] | Addresses receiving permissions on the organ. |
_permissionValues | bytes2[] | Permission bitmasks aligned with _permissionAddresses. |
cid | string | Metadata CID assigned to the deployed organ. |
entries | (address, string)[] | Initial entries stored on the organ. |
salt | bytes32 | Deterministic clone salt. |
| Returns |
| Name | Type | Description |
|---|---|---|
clone | address | Address of the deployed organ clone. |
Deploy a complete organigram in one transaction.
function deployOrganigram((address[], bytes2[], string, (address, string)[], bytes32)[] organBatch, (string, string, uint256, bytes32, bool, address)[] assetBatch, (address, bytes, bytes32)[] procedureBatch) returns (address[] organsDeployed, address[] assetsDeployed, address[] proceduresDeployed);
Parameters
| Name | Type | Description |
|---|---|---|
organBatch | (address[], bytes2[], string, (address, string)[], bytes32)[] | Organ deployment payloads. |
assetBatch | (string, string, uint256, bytes32, bool, address)[] | Asset deployment payloads. |
procedureBatch | (address, bytes, bytes32)[] | Procedure deployment payloads. |
| Returns |
| Name | Type | Description |
|---|---|---|
organsDeployed | address[] | Addresses of the deployed organs. |
assetsDeployed | address[] | Addresses of the deployed assets. |
proceduresDeployed | address[] | Addresses of the deployed procedures. |
Deploy several organ clones in one call.
function deployOrgans((address[], bytes2[], string, (address, string)[], bytes32)[] batch) returns (address[] clones);
Parameters
| Name | Type | Description |
|---|---|---|
batch | (address[], bytes2[], string, (address, string)[], bytes32)[] | Organ deployment payloads. |
| Returns |
| Name | Type | Description |
|---|---|---|
clones | address[] | Addresses of the deployed organ clones. |
Deploy one procedure clone from a registered procedure implementation.
function deployProcedure(address procedureType, bytes data, bytes32 salt) returns (address procedure);
Parameters
| Name | Type | Description |
|---|---|---|
procedureType | address | Registered procedure implementation to clone. |
data | bytes | Optional initialization calldata executed immediately after deployment. |
salt | bytes32 | Deterministic clone salt. |
| Returns |
| Name | Type | Description |
|---|---|---|
procedure | address | Address of the deployed procedure clone. |
Deploy several procedure clones in one call.
function deployProcedures((address, bytes, bytes32)[] batch) returns (address[] created);
Parameters
| Name | Type | Description |
|---|---|---|
batch | (address, bytes, bytes32)[] | Procedure deployment payloads. |
| Returns |
| Name | Type | Description |
|---|---|---|
created | address[] | Addresses of the deployed procedure clones. |
Implementation that equity tokens are cloned from.
function equityToken() view returns (address);
Return whether an address is the trusted ERC-2771 forwarder.
function isTrustedForwarder(address forwarder) view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
forwarder | address | The forwarder address to test. |
Implementation that organs are cloned from.
function organ() view returns (address);
Account allowed to register procedure types.
function owner() view returns (address);
Organ listing the registered procedure types.
function proceduresRegistry() view returns (address);
Register supported procedure implementations in the procedures registry.
function registerProcedures((address, string)[] entries);
Parameters
| Name | Type | Description |
|---|---|---|
entries | (address, string)[] | Registry entries that point to valid procedure implementations. |
Return the trusted ERC-2771 forwarder used by this contract.
function trustedForwarder() view returns (address);
An asset was deployed.
event assetDeployed(address asset);
An organ was deployed.
event organDeployed(address organ);
A procedure was deployed from a registered procedure type.
event procedureDeployed(address procedureType, address procedure);
An organ is a group: a registry of entries, each an address, a document reference or both, a list of permissions, and a balance of ether and tokens. Every change requires a permission held by the caller. Organs can also call outside contracts, but only the calls listed in their execution whitelist.
A group of an organization: a registry of entries, each an address, a document reference or both, a list of permissions, and a balance of ether and tokens.
Every change requires a permission held by the caller. In a governed organization, procedures hold those permissions, so that every change goes through a decision.
It has every function and event of IOrgan, and the ones below.
constructor();
Initialize a freshly cloned organ.
function initialize(address[] permissionAddresses, bytes2[] permissionValues, string cid, (address, string)[] entries, address forwarder);
Parameters
| Name | Type | Description |
|---|---|---|
permissionAddresses | address[] | |
permissionValues | bytes2[] | |
cid | string | Content identifier describing the organ metadata. |
entries | (address, string)[] | Initial entries stored on the organ. |
forwarder | address |
Return whether an address is the trusted ERC-2771 forwarder.
function isTrustedForwarder(address forwarder) view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
forwarder | address | The forwarder address to test. |
ERC-1155 hook accepting tokens. ERC-1155 tokens are not recorded by the organ.
function onERC1155BatchReceived(address arg0, address arg1, uint256[] arg2, uint256[] arg3, bytes arg4) returns (bytes4);
ERC-1155 hook accepting a token. ERC-1155 tokens are not recorded by the organ.
function onERC1155Received(address arg0, address arg1, uint256 arg2, uint256 arg3, bytes arg4) returns (bytes4);
ERC-721 hook recording a token sent to the organ.
function onERC721Received(address operator, address from, uint256 tokenId, bytes arg3) returns (bytes4);
Tell whether the organ supports an interface: ERC-165, IOrgan, and the ERC-777, ERC-721 and ERC-1155 receivers.
function supportsInterface(bytes4 interfaceId) view returns (bool);
ERC-777 hook recording tokens sent to the organ.
function tokensReceived(address operator, address from, address to, uint256 amount, bytes arg4, bytes arg5);
Send ERC-20 tokens held by the organ. Requires the WITHDRAW_COINS permission.
The second parameter is ignored.
function transferCoins(address token, address arg1, address to, uint256 amount);
Send an ERC-721 token held by the organ. Requires the WITHDRAW_COLLECTIBLES permission.
The second parameter is ignored.
function transferCollectible(address token, address arg1, address to, uint256 tokenId);
Send ether held by the organ. Requires the WITHDRAW_ETHER permission.
function transferEther(address to, uint256 value);
Return the trusted ERC-2771 forwarder used by this contract.
function trustedForwarder() view returns (address);
The organ sent ether.
event etherTransferred(address from, address to, uint256 amount);
Triggered when the contract has been initialized or reinitialized.
event Initialized(uint64 version);
The functions organs expose to procedures and applications: entries, permissions, metadata and whitelisted calls.
Append entries to the organ directory.
function addEntries((address, string)[] entries) returns (uint256[] indexes);
Parameters
| Name | Type | Description |
|---|---|---|
entries | (address, string)[] | Entries to append. |
| Returns |
| Name | Type | Description |
|---|---|---|
indexes | uint256[] | Indexes assigned to the newly inserted entries. |
Grant permissions to one address or procedure.
function addPermission(address permissionAddress, bytes2 permissionValue);
Parameters
| Name | Type | Description |
|---|---|---|
permissionAddress | address | Address receiving the permission bitmask. |
permissionValue | bytes2 | Permission bitmask to grant. |
Execute an external call that has been approved by a whitelist policy.
The organ validates the call against the policy configured for target + selector before forwarding the call. Every configured constraint must pass.
function executeWhitelisted(address target, uint256 value, bytes data) returns (bytes result);
Parameters
| Name | Type | Description |
|---|---|---|
target | address | The external contract to call. |
value | uint256 | The amount of native token to forward with the call. |
data | bytes | The encoded calldata forwarded to target. |
| Returns |
| Name | Type | Description |
|---|---|---|
result | bytes | The raw return data produced by the external call. |
Return summary information about a call policy.
function getCallPolicy(address target, bytes4 selector) view returns (bool enabled, uint256 constraintsLength, uint256 whitelistedAddressesLength);
Parameters
| Name | Type | Description |
|---|---|---|
target | address | The external contract keyed by the policy. |
selector | bytes4 | The function selector keyed by the policy. |
| Returns |
| Name | Type | Description |
|---|---|---|
enabled | bool | Whether the policy exists and is active. |
constraintsLength | uint256 | The number of parameter constraints configured on the policy. |
whitelistedAddressesLength | uint256 | The number of addresses stored in the policy whitelist. |
Return one parameter constraint of a call policy.
function getCallPolicyConstraint(address target, bytes4 selector, uint256 index) view returns (uint8 paramIndex, uint8 constraintType, bytes32 minValue, bytes32 maxValue, bytes32 exactValue);
Parameters
| Name | Type | Description |
|---|---|---|
target | address | The external contract keyed by the policy. |
selector | bytes4 | The function selector keyed by the policy. |
index | uint256 | The position of the constraint inside the policy. |
| Returns |
| Name | Type | Description |
|---|---|---|
paramIndex | uint8 | The zero-based calldata argument index constrained by this rule. |
constraintType | uint8 | The type of validation applied to that argument. |
minValue | bytes32 | The lower bound used by range constraints. |
maxValue | bytes32 | The upper bound used by range constraints. |
exactValue | bytes32 | The exact value used by exact-match constraints. |
Return one stored entry.
function getEntry(uint256 index) view returns ((address, string) entry);
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | Index of the entry to read. |
| Returns |
| Name | Type | Description |
|---|---|---|
entry | (address, string) | Entry payload stored at index. |
Find the index of one entry address.
function getEntryIndexForAddress(address addr) view returns (uint256 index);
Parameters
| Name | Type | Description |
|---|---|---|
addr | address | Address stored in the entry. |
| Returns |
| Name | Type | Description |
|---|---|---|
index | uint256 | Index of the entry associated with addr. |
Return the core summary of the organ.
function getOrgan() view returns (string cid, uint256 permissionsLength, uint256 entriesLength, uint256 entriesCount, bytes4 interfaceId);
Returns
| Name | Type | Description |
|---|---|---|
cid | string | Metadata CID currently attached to the organ. |
permissionsLength | uint256 | Number of permission entries configured on the organ. |
entriesLength | uint256 | Number of allocated entry slots. |
entriesCount | uint256 | Number of active entries. |
interfaceId | bytes4 | ERC-165 interface id implemented by the organ. |
Return one permission entry by index.
function getPermission(uint256 index) view returns (address addr, bytes2 perms);
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | Index of the permission entry to read. |
| Returns |
| Name | Type | Description |
|---|---|---|
addr | address | Address holding the permission. |
perms | bytes2 | Permission bitmask held by addr. |
Return the permission bitmask assigned to one address.
function getPermissions(address addr) view returns (bytes2 perms);
Parameters
| Name | Type | Description |
|---|---|---|
addr | address | Address to inspect. |
| Returns |
| Name | Type | Description |
|---|---|---|
perms | bytes2 | Permission bitmask currently assigned to addr. |
Initialize a freshly cloned organ.
function initialize(address[] procedures, bytes2[] permissions, string cid, (address, string)[] entries, address trustedForwarder);
Parameters
| Name | Type | Description |
|---|---|---|
procedures | address[] | Addresses that receive permissions on the organ. |
permissions | bytes2[] | Permission bitmasks aligned with procedures. |
cid | string | Content identifier describing the organ metadata. |
entries | (address, string)[] | Initial entries stored on the organ. |
trustedForwarder | address | ERC-2771 forwarder trusted by the organ. |
Check whether an address is present in a call policy whitelist.
function isCallPolicyWhitelistedAddress(address target, bytes4 selector, address candidate) view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
target | address | The external contract keyed by the policy. |
selector | bytes4 | The function selector keyed by the policy. |
candidate | address | The address to test against the whitelist. |
Remove a previously configured external call policy.
function removeCallPolicy(address target, bytes4 selector);
Parameters
| Name | Type | Description |
|---|---|---|
target | address | The external contract whose policy should be removed. |
selector | bytes4 | The function selector whose policy should be removed. |
Remove entries from the organ directory.
function removeEntries(uint256[] indexes);
Parameters
| Name | Type | Description |
|---|---|---|
indexes | uint256[] | Indexes to remove. |
Remove every permission bit from one address or procedure.
function removePermission(address permissionAddress);
Parameters
| Name | Type | Description |
|---|---|---|
permissionAddress | address | Address whose permissions should be removed. |
Replace one entry at a fixed index.
function replaceEntry(uint256 index, (address, string) entry);
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | Index of the entry to replace. |
entry | (address, string) | New entry payload stored at index. |
Replace one permission holder with another.
function replacePermission(address oldPermission, address newPermission, bytes2 newPermissionValue);
Parameters
| Name | Type | Description |
|---|---|---|
oldPermission | address | Address currently holding the permission. |
newPermission | address | Address that should receive the permission instead. |
newPermissionValue | bytes2 | Permission bitmask assigned to newPermission. |
Configure a whitelist policy for an external call path.
Policies are keyed by target + selector. Each policy can constrain calldata arguments with NONE, EXACT, RANGE, SELF, or WHITELISTED_ADDRESS. The whitelist is only consulted by constraints that use WHITELISTED_ADDRESS.
function setCallPolicy(address target, bytes4 selector, (uint8, uint8, bytes32, bytes32, bytes32)[] constraints, address[] whitelistedAddresses);
Parameters
| Name | Type | Description |
|---|---|---|
target | address | The external contract the organ may call. |
selector | bytes4 | The function selector allowed on target. |
constraints | (uint8, uint8, bytes32, bytes32, bytes32)[] | The calldata constraints that must be satisfied to execute the call. |
whitelistedAddresses | address[] | The addresses accepted by whitelist-based constraints. |
Update the metadata CID of the organ.
function updateCid(string cid);
Parameters
| Name | Type | Description |
|---|---|---|
cid | string | New content identifier describing the organ. |
Storage layout and rules of organs, linked into the Organ contract.
Permission to add entries.
function PERMISSION_ADD_ENTRIES() view returns (bytes2);
Permission to grant permissions.
function PERMISSION_ADD_PERMISSIONS() view returns (bytes2);
Permission to make the organ call a whitelisted outside contract.
function PERMISSION_EXECUTE_WHITELISTED() view returns (bytes2);
Permission to change the calls the organ may make to outside contracts.
function PERMISSION_MANAGE_EXECUTION_WHITELIST() view returns (bytes2);
Permission to remove entries.
function PERMISSION_REMOVE_ENTRIES() view returns (bytes2);
Permission to revoke permissions.
function PERMISSION_REMOVE_PERMISSIONS() view returns (bytes2);
Permission to replace the metadata reference.
function PERMISSION_UPDATE_METADATA() view returns (bytes2);
Permission to send tokens held by the organ.
function PERMISSION_WITHDRAW_COINS() view returns (bytes2);
Permission to send ERC-721 tokens held by the organ.
function PERMISSION_WITHDRAW_COLLECTIBLES() view returns (bytes2);
Permission to send ether held by the organ.
function PERMISSION_WITHDRAW_ETHER() view returns (bytes2);
The organ may no longer call a function of an outside contract.
event callPolicyRemoved(address indexed caller, address indexed target, bytes4 indexed selector);
The organ may now call a function of an outside contract.
event callPolicySet(address indexed caller, address indexed target, bytes4 indexed selector);
An address was allowed as an argument of a whitelisted call.
event callPolicyWhitelistedAddressAdded(bytes32 indexed policyKey, address indexed candidate);
An address is no longer allowed as an argument of a whitelisted call.
event callPolicyWhitelistedAddressRemoved(bytes32 indexed policyKey, address indexed candidate);
The metadata reference of the organ changed.
event cidUpdated(address from, string cid);
The organ received tokens.
event coinsReceived(address operator, address from, address to, uint256 amount);
The organ sent tokens.
event coinsTransferred(address operator, address from, address to, uint256 amount);
The organ received an ERC-721 token.
event collectibleReceived(address operator, address from, uint256 tokenId);
The organ sent an ERC-721 token.
event collectibleTransferred(address operator, address to, uint256 tokenId);
An entry was added to the organ.
event entryAdded(address from, uint256 index, address addr, string cid);
An entry was removed from the organ.
event entryRemoved(address from, uint256 index);
The organ received ether.
event etherReceived(address from, uint256 amount);
The organ sent ether.
event etherTransferred(address from, address to, uint256 amount);
An address received permissions on the organ.
event permissionAdded(address from, address permissionAddress, bytes2 permissionValue);
An address lost its permissions on the organ.
event permissionRemoved(address from, address permissionAddress);
The organ made a whitelisted call to an outside contract.
event whitelistedExecution(address indexed caller, address indexed target, bytes4 indexed selector, uint256 value);
A procedure lets the members of some organs change other organs through proposals. Proposers submit a list of operations; with moderation, moderators present or block it; deciders adopt or reject it, and adoption runs the operations. Every action has a …BySig variant that verifies an EIP-712 signature, so that a relayer can submit it on behalf of the signer.
Lets the members of some organs change other organs through proposals: lists of operations that proposers submit, moderators may present or block, and deciders adopt or reject.
Adoption runs the operations. Every action has a …BySig variant verifying an EIP-712 signature, so that a relayer can submit it on behalf of the signer.
constructor();
Apply proposal.
function applyProposal(uint256 proposalKey);
Settle a proposal with an application signed by any account, relayed by another.
function applyProposalBySig(uint256 proposalKey, uint256 nonce, uint256 deadline, bytes signature);
Block a proposal as a moderator, with a reason.
function blockProposal(uint256 proposalKey, string reason);
Block a proposal with a block signed by a moderator, relayed by any account.
function blockProposalBySig(uint256 proposalKey, string reason, uint256 nonce, uint256 deadline, bytes signature);
returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.
function eip712Domain() view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions);
Lets an operation target safely identify the proposal currently being applied.
function getExecutionContext() view returns (bool isApplying, uint256 proposalKey, address proposalCreator);
Read the next signature nonce of an account.
function getNonce(address account) view returns (uint256);
Read the metadata reference, the roles and the proposal count of the procedure.
function getProcedure() view returns (string cid, address proposers, address moderators, address deciders, bool withModeration, uint256 proposalsLength, bytes4 interfaceId);
Read one proposal.
function getProposal(uint256 proposalKey) view returns ((address, string, string, bool, bool, bool, bool, (uint256, address, bytes, uint256, bool)[]));
Initialize a procedure clone with its roles.
function initialize(string _cid, address _proposers, address _moderators, address _deciders, bool _withModeration, address _trustedForwarder);
Parameters
| Name | Type | Description |
|---|---|---|
_cid | string | Reference to the procedure metadata. |
_proposers | address | Organ whose members may submit proposals, or a single address. |
_moderators | address | Organ whose members may present or block proposals. |
_deciders | address | Organ whose members adopt or reject proposals, or a single address. |
_withModeration | bool | Whether proposals must be presented by a moderator before the decision. |
_trustedForwarder | address | Forwarder relaying gasless transactions. |
ERC-165 interface identifier of procedures.
function INTERFACE_ID() view returns (bytes4);
Tell whether an operation may only be proposed by the account it concerns.
function isOwnerBoundProposalOperation(bytes operationData) pure returns (bool);
Return whether an address is the trusted ERC-2771 forwarder.
function isTrustedForwarder(address forwarder) view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
forwarder | address | The forwarder address to test. |
When moderation is enabled, moderators must accept the proposal.
function presentProposal(uint256 proposalKey);
Present a proposal with a presentation signed by a moderator, relayed by any account.
function presentProposalBySig(uint256 proposalKey, uint256 nonce, uint256 deadline, bytes signature);
Public API : Proposals creation and update.
function propose(string cid, (uint256, address, bytes, uint256, bool)[] operations) returns (uint256 proposalKey);
Submit a proposal signed by a proposer, relayed by any account.
function proposeBySig(string cid, (uint256, address, bytes, uint256, bool)[] operations, uint256 nonce, uint256 deadline, bytes signature) returns (uint256 proposalKey);
Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
function supportsInterface(bytes4 interfaceId) view returns (bool);
Transfers the proposal creator's equity; the token emits the movement record.
function transferEquity(address asset, address recipient, uint256 amount, string movementCid);
Return the trusted ERC-2771 forwarder used by this contract.
function trustedForwarder() view returns (address);
Revert unless the creator of a proposal may propose this operation.
function validateProposalCreator(address creator, bytes operationData) view;
MAY be emitted to signal that the domain could have changed.
event EIP712DomainChanged();
Triggered when the contract has been initialized or reinitialized.
event Initialized(uint64 version);
A procedure in which any one member of the deciders organ adopts or rejects a proposal alone.
It has every function and event of Procedure, and the ones below.
Initialize a procedure clone with its roles.
function initialize(string _cid, address _proposers, address _moderators, address _deciders, bool _withModeration, address _trustedForwarder);
Parameters
| Name | Type | Description |
|---|---|---|
_cid | string | Reference to the procedure metadata. |
_proposers | address | Organ whose members may submit proposals, or a single address. |
_moderators | address | Organ whose members may present or block proposals. |
_deciders | address | Organ whose members adopt or reject proposals, or a single address. |
_withModeration | bool | Whether proposals must be presented by a moderator before the decision. |
_trustedForwarder | address | Forwarder relaying gasless transactions. |
Apply the nomination.
function nominate(uint256 proposalKey);
Parameters
| Name | Type | Description |
|---|---|---|
proposalKey | uint256 | The key used to identify the proposal. |
Adopt a proposal with an adoption signed by a decider, relayed by any account.
function nominateBySig(uint256 proposalKey, uint256 nonce, uint256 deadline, bytes signature);
Reject a nomination without applying its proposal operations.
function reject(uint256 proposalKey);
Parameters
| Name | Type | Description |
|---|---|---|
proposalKey | uint256 | The proposal to reject. |
A proposal was settled.
event ProposalApplied(uint256 indexed proposalKey);
A procedure in which the members of the deciders organ vote on each proposal.
The vote opens when a proposal is presented. Once it is over, anyone calls applyProposal to count the ballots and settle the proposal.
It has every function and event of Procedure, and the ones below.
Count votes when election is ended.
@todo Handle delegation of Votes.
function count(uint256 proposalKey) view returns (bool approved);
Returns
| Name | Type | Description |
|---|---|---|
approved | bool | True if the proposal is adopted. |
Get information about a current election
function getElection(uint256 _proposalKey) view returns (uint256 start, bool hasVoted, uint256 votesCount);
Returns
| Name | Type | Description |
|---|---|---|
start | uint256 | The UNIX time when the election started. |
hasVoted | bool | True if the voter has voted. |
votesCount | uint256 | The number of votes cast so far. |
Get the current vote split and the eligible voting base.
ERC20VoteProcedure overrides this to use snapshot voting power.
function getElectionResults(uint256 proposalKey) view returns (uint256 approvals, uint256 objections, uint256 eligibleVotes);
Returns
| Name | Type | Description |
|---|---|---|
approvals | uint256 | The number of approving votes. |
objections | uint256 | The number of rejecting votes. |
eligibleVotes | uint256 | The number of votes eligible to participate. |
Initialize the procedure.
function initialize(string _cid, address _proposers, address _moderators, address _deciders, bool _withModeration, address _trustedForwarder, uint32 _quorumSize, uint32 _voteDuration, uint32 _majoritySize);
Share of the ballots that must approve, in thousandths of a percent.
function majoritySize() view returns (uint32);
Share of the voters who must vote, in thousandths of a percent.
function quorumSize() view returns (uint32);
Create a election.
function vote(uint256 proposalKey, bool approval);
Cast a vote signed by a decider, relayed by any account.
function voteBySig(uint256 proposalKey, bool approval, uint256 nonce, uint256 deadline, bytes signature);
Duration of a vote, in seconds.
function voteDuration() view returns (uint32);
A proposal was settled.
event ProposalApplied(uint256 indexed proposalKey);
A moderator blocked a proposal.
event ProposalBlocked(address indexed moderator, uint256 indexed proposalKey, string reason);
A proposal was submitted.
event ProposalCreated(address indexed creator, uint256 indexed proposalKey);
A moderator presented a proposal to the deciders.
event ProposalPresented(address indexed presenter, uint256 indexed proposalKey);
A vote procedure in which each ballot weighs the token balance of the voter.
Ballots weigh balances held just before the vote opened, so tokens moved during the vote do not count twice.
It has every function and event of VoteProcedure, and the ones below.
Initialize an ERC-20 vote whose roles are held by organ members, token holders or nobody.
function initialize(string _metadata, address _proposers, address _moderators, address _deciders, bool _withModeration, address _trustedForwarder, uint32 _quorumSize, uint32 _voteDuration, uint32 _majoritySize, address _tokenContract, uint8[3] _roleModes);
Parameters
| Name | Type | Description |
|---|---|---|
_metadata | string | |
_proposers | address | |
_moderators | address | |
_deciders | address | |
_withModeration | bool | |
_trustedForwarder | address | |
_quorumSize | uint32 | |
_voteDuration | uint32 | |
_majoritySize | uint32 | |
_tokenContract | address | |
_roleModes | uint8[3] | Role modes of the proposers, moderators and voters. |
Initialize the procedure.
function initialize(string _metadata, address _proposers, address _moderators, address _deciders, bool _withModeration, address _trustedForwarder, uint32 _quorumSize, uint32 _voteDuration, uint32 _majoritySize, address _tokenContract);
Parameters
| Name | Type | Description |
|---|---|---|
_metadata | string | The procedure metadata. |
_proposers | address | The organ whose entries will be allowed to propose proposals. |
_moderators | address | The organ whose entries will be allowed to moderate proposals. |
_deciders | address | The organ whose entries will be allowed to adopt or refect proposals. |
_withModeration | bool | Whether or not the procedure requires moderation. |
_trustedForwarder | address | The trusted forwarder contract. |
_quorumSize | uint32 | The minimum percentage of votes required to validate a election. |
_voteDuration | uint32 | Duration of vote in seconds. |
_majoritySize | uint32 | The minimum percentage of votes required to validate a election. |
_tokenContract | address | The ERC20 token contract representing the rights to vote. |
Initialize an ERC-20 vote with optional member-majority validation.
function initialize(string _metadata, address _proposers, address _moderators, address _deciders, bool _withModeration, address _trustedForwarder, uint32 _quorumSize, uint32 _voteDuration, uint32 _majoritySize, address _tokenContract, uint8[3] _roleModes, bool _requireMemberMajority);
Whether moderators are organ members, token holders, or nobody.
function moderatorMode() view returns (uint8);
Whether proposers are organ members, token holders, or nobody.
function proposerMode() view returns (uint8);
When voters come from an organ, require a majority of its members in addition to the usual token-weighted quorum and majority.
function requireMemberMajority() view returns (bool);
tokenContract is an ERC20Votes-compatible token representing the rights to vote.
function tokenContract() view returns (address);
Whether voters are organ members or token holders.
function voterMode() view returns (uint8);
Storage layout and rules of proposals, linked into procedure contracts.
Utils.
function isInOrgan(address organ, address caller) view returns (bool);
A proposal was settled.
event ProposalApplied(uint256 indexed proposalKey);
A moderator blocked a proposal.
event ProposalBlocked(address indexed moderator, uint256 indexed proposalKey, string reason);
A proposal was submitted.
event ProposalCreated(address indexed creator, uint256 indexed proposalKey);
A moderator presented a proposal to the deciders.
event ProposalPresented(address indexed presenter, uint256 indexed proposalKey);
Assets are ERC-20 tokens with voting checkpoints, so that a vote can weigh balances at a past moment. An EquityToken represents company shares: its transfers must be approved by a procedure.
An ERC-20 token with voting checkpoints, held by organs.
constructor();
Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
function allowance(address owner, address spender) view returns (uint256);
See {IERC20-approve}. NOTE: If value is the maximum uint256, the allowance is not updated on transferFrom. This is semantically equivalent to an infinite approval. Requirements: - spender cannot be the zero address.
function approve(address spender, uint256 value) returns (bool);
Returns the value of tokens owned by account.
function balanceOf(address account) view returns (uint256);
Get the pos-th checkpoint for account.
function checkpoints(address account, uint32 pos) view returns ((uint48, uint208));
Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting), in which case {CLOCK_MODE} should be overridden as well to match.
function clock() view returns (uint48);
Machine-readable description of the clock as specified in ERC-6372.
function CLOCK_MODE() view returns (string);
Returns the number of decimals used to get its user representation. For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5.05 (505 / 10 ** 2). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for display purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
function decimals() view returns (uint8);
Delegates votes from the sender to delegatee.
function delegate(address delegatee);
Delegates votes from signer to delegatee.
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s);
Returns the delegate that account has chosen.
function delegates(address account) view returns (address);
returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.
function eip712Domain() view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions);
Returns the total supply of votes available at a specific moment in the past. If the clock() is configured to use block numbers, this will return the value at the end of the corresponding block. NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. Votes that have not been delegated are still part of total supply, even though they would not participate in a vote. Requirements: - timepoint must be in the past. If operating using block numbers, the block must be already mined.
function getPastTotalSupply(uint256 timepoint) view returns (uint256);
Returns the amount of votes that account had at a specific moment in the past. If the clock() is configured to use block numbers, this will return the value at the end of the corresponding block. Requirements: - timepoint must be in the past. If operating using block numbers, the block must be already mined.
function getPastVotes(address account, uint256 timepoint) view returns (uint256);
Returns the current amount of votes that account has.
function getVotes(address account) view returns (uint256);
Initialize an asset clone and mint its supply.
function initialize(string name_, string symbol_, address initialReceiver_, uint256 initialSupply_);
Parameters
| Name | Type | Description |
|---|---|---|
name_ | string | Token name. |
symbol_ | string | Token symbol. |
initialReceiver_ | address | Account receiving the initial supply. |
initialSupply_ | uint256 | Supply minted at initialization. |
Returns the name of the token.
function name() view returns (string);
Returns the next unused nonce for an address.
function nonces(address owner) view returns (uint256);
Get number of checkpoints for account.
function numCheckpoints(address account) view returns (uint32);
Returns the symbol of the token, usually a shorter version of the name.
function symbol() view returns (string);
Returns the value of tokens in existence.
function totalSupply() view returns (uint256);
See {IERC20-transfer}. Requirements: - to cannot be the zero address. - the caller must have a balance of at least value.
function transfer(address to, uint256 value) returns (bool);
See {IERC20-transferFrom}. Skips emitting an {Approval} event indicating an allowance update. This is not required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve]. NOTE: Does not update the allowance if the current allowance is the maximum uint256. Requirements: - from and to cannot be the zero address. - from must have a balance of at least value. - the caller must have allowance for from's tokens of at least value.
function transferFrom(address from, address to, uint256 value) returns (bool);
Emitted when the allowance of a spender for an owner is set by a call to {approve}. value is the new allowance.
event Approval(address indexed owner, address indexed spender, uint256 value);
Emitted when an account changes their delegate.
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
Emitted when a token transfer or delegate change results in changes to a delegate's number of voting units.
event DelegateVotesChanged(address indexed delegate, uint256 previousVotes, uint256 newVotes);
MAY be emitted to signal that the domain could have changed.
event EIP712DomainChanged();
Triggered when the contract has been initialized or reinitialized.
event Initialized(uint64 version);
Emitted when value tokens are moved from one account (from) to another (to). Note that value may be zero.
event Transfer(address indexed from, address indexed to, uint256 value);
ERC-20 representation of equity settled by an approved procedure.
It has every function and event of Asset, and the ones below.
constructor();
Role of the procedures that change which procedures hold a role.
function ADMIN_PROCEDURE_ROLE() view returns (bytes32);
Initialize an equity token clone and mint its supply.
function initialize(string name_, string symbol_, address initialHolder_, uint256 initialSupply_, address transferProcedure_);
Parameters
| Name | Type | Description |
|---|---|---|
name_ | string | Token name. |
symbol_ | string | Token symbol. |
initialHolder_ | address | Account receiving the initial supply. |
initialSupply_ | uint256 | Supply minted at initialization. |
transferProcedure_ | address | Procedure settling transfers, which also receives the admin role. |
Tell whether a procedure holds a role.
function isProcedureAuthorized(bytes32 role, address procedure) view returns (bool);
Tell whether a procedure may settle transfers.
function isTransferProcedure(address procedure) view returns (bool);
Grant or revoke a transfer or administration procedure through governance.
function setProcedureAuthorization(bytes32 role, address procedure, bool authorized);
Settles a transfer of the applying proposal's creator and records the movement.
function settleTransfer(address recipient, uint256 amount, string movementCid);
Role of the procedures that settle transfers.
function TRANSFER_PROCEDURE_ROLE() view returns (bytes32);
Checks the transfer conditions during proposal creation.
function validateTransfer(address creator, address recipient, uint256 amount, string movementCid) view;
Movement record of a settled transfer, from which the register of share movements is built.
event MovementSettled(address indexed procedure, uint256 indexed proposalKey, address indexed seller, address recipient, uint256 amount, string movementCid);
A procedure received or lost a role.
event ProcedureAuthorizationUpdated(bytes32 indexed role, address indexed procedure, bool authorized);
The MetaGasStation is the trusted forwarder of the protocol contracts: it relays transactions signed by users who hold no ether, and the contracts read the original signer instead of the relayer.
Trusted forwarder of the protocol contracts: it relays requests signed by accounts that hold no ether, and the contracts read the signer instead of the relayer.
constructor(string name);
returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.
function eip712Domain() view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions);
Executes a request on behalf of signature's signer using the ERC-2771 protocol. The gas provided to the requested call may not be exactly the amount requested, but the call will not run out of gas. Will revert if the request is invalid or the call reverts, in this case the nonce is not consumed. Requirements: - The request value should be equal to the provided msg.value. - The request should be valid according to {verify}.
function execute((address, address, uint256, uint256, uint48, bytes, bytes) request) payable;
Batch version of {execute} with optional refunding and atomic execution. In case a batch contains at least one invalid request (see {verify}), the request will be skipped and the refundReceiver parameter will receive back the unused requested value at the end of the execution. This is done to prevent reverting the entire batch when a request is invalid or has already been submitted. If the refundReceiver is the address(0), this function will revert when at least one of the requests was not valid instead of skipping it. This could be useful if a batch is required to get executed atomically (at least at the top-level). For example, refunding (and thus atomicity) can be opt-out if the relayer is using a service that avoids including reverted transactions. Requirements: - The sum of the requests' values should be equal to the provided msg.value. - All of the requests should be valid (see {verify}) when refundReceiver is the zero address. NOTE: Setting a zero refundReceiver guarantees an all-or-nothing requests execution only for the first-level forwarded calls. In case a forwarded request calls to a contract with another subcall, the second-level call may revert without the top-level call reverting.
function executeBatch((address, address, uint256, uint256, uint48, bytes, bytes)[] requests, address refundReceiver) payable;
Returns the next unused nonce for an address.
function nonces(address owner) view returns (uint256);
Returns true if a request is valid for a provided signature at the current block timestamp. A transaction is considered valid when the target trusts this forwarder, the request hasn't expired (deadline is not met), and the signer matches the from parameter of the signed request. NOTE: A request may return false here but it won't cause {executeBatch} to revert if a refund receiver is provided.
function verify((address, address, uint256, uint256, uint48, bytes, bytes) request) view returns (bool);
MAY be emitted to signal that the domain could have changed.
event EIP712DomainChanged();
Emitted when a ForwardRequest is executed. NOTE: An unsuccessful forward request could be due to an invalid signature, an expired deadline, or simply a revert in the requested call. The contract guarantees that the relayer is not able to force the requested call to run out of gas.
event ExecutedForwardRequest(address indexed signer, uint256 nonce, bool success);
Edit this page
On this page:
© 2026 Organigram SAS
All Rights Reserved.