Org
This contract controls the Org entity.
function ETH_PLACEHOLDER() external view returns (address)
Placeholder address used in swapping method to denote usage of ETH instead of a token.
Name | Type | Description |
---|---|---|
_0 | address | undefined |
function authority() external view returns (contract RolesAuthority)
The contract used to source permissions for accounts targeting this contract.
Name | Type | Description |
---|---|---|
_0 | contract RolesAuthority | undefined |
function balance() external view returns (uint256)
The current balance for the entity, denominated in the base token's units.
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
function baseToken() external view returns (contract ERC20)
Name | Type | Description |
---|---|---|
_0 | contract ERC20 | undefined |
function callAsEntity(address _target, uint256 _value, bytes _data) external payable returns (bytes)
Permissioned method that allows Endaoment admin to make arbitrary calls acting as this Entity.
Name | Type | Description |
---|---|---|
_target | address | The address to which the call will be made. |
_value | uint256 | The ETH value that should be forwarded with the call. |
_data | bytes | The calldata that will be sent with the call. |
Name | Type | Description |
---|---|---|
_0 | bytes | _return The data returned by the call. |
function donate(uint256 _amount) external nonpayable
Receives a donated amount of base tokens to be added to the entity's balance. Transfers default fee to treasury.
Reverts if the donation fee percentage is larger than 100% (equal to 1e4 when represented as a zoc).Reverts if the token transfer fails.
Name | Type | Description |
---|---|---|
_amount | uint256 | Amount donated in base token. |
function donateWithOverrides(uint256 _amount) external nonpayable
Receives a donated amount of base tokens to be added to the entity's balance. Transfers default or overridden fee to treasury.
Reverts if the donation fee percentage is larger than 100% (equal to 1e4 when represented as a zoc).Reverts if the token transfer fails.
Name | Type | Description |
---|---|---|
_amount | uint256 | Amount donated in base token. |
function entityType() external pure returns (uint8)
Each entity will implement this function to allow a caller to interrogate what kind of entity it is.
Name | Type | Description |
---|---|---|
_0 | uint8 | undefined |
function initialize(contract Registry _registry, address _manager) external nonpayable
One time method to be called at deployment to configure the contract. Required so Entity contracts can be deployed as minimal proxies (clones).
Name | Type | Description |
---|---|---|
_registry | contract Registry | The registry to host the Entity. |
_manager | address | The address of the Entity's manager. |
function initialize(contract RolesAuthority _authority, bytes20 _specialTarget) external nonpayable
One time method to be called at deployment to configure the contract. Required so EndaomentAuth contracts can be deployed as minimal proxies (clones).
Name | Type | Description |
---|---|---|
_authority | contract RolesAuthority | Contract that will be used to source permissions for accounts targeting this contract. |
_specialTarget | bytes20 | The bytes that this contract will pass as the "target" when looking up permissions from the authority. If set to empty bytes, this contract will pass its own address instead. |
function initialize(contract Registry _registry, bytes32 _orgId) external nonpayable
One time method to be called at deployment to configure the contract. Required so Org contracts can be deployed as minimal proxies (clones).
The
manager
of the Org is initially set to the zero address and will be updated by role pending an off-chain claim.Name | Type | Description |
---|---|---|
_registry | contract Registry | The registry to host the Org Entity. |
_orgId | bytes32 | The Org's ID for tax purposes. |
function manager() external view returns (address)
The entity's manager.
Name | Type | Description |
---|---|---|
_0 | address | undefined |
function orgId() external view returns (bytes32)
Tax ID of org
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
function payout(address _to, uint256 _amount) external nonpayable
Pays out an amount of base tokens from the entity to an address. Transfers the fee calculated by the default fee multiplier to the treasury.
Reverts with
Unauthorized
if the msg.sender
is not a privileged role.Reverts if the fee percentage is larger than 100% (equal to 1e4 when represented as a zoc).Reverts if the token transfer fails.Name | Type | Description |
---|---|---|
_to | address | The address to receive the tokens. |
_amount | uint256 | Amount donated in base token. |
function payoutWithOverrides(address _to, uint256 _amount) external nonpayable
Pays out an amount of base tokens from the entity to an address. Transfers the fee calculated by the default fee multiplier to the treasury.
Reverts with
Unauthorized
if the msg.sender
is not a privileged role.Reverts if the fee percentage is larger than 100% (equal to 1e4 when represented as a zoc).Reverts if the token transfer fails.Name | Type | Description |
---|---|---|
_to | address | undefined |
_amount | uint256 | Amount donated in base token. |
function portfolioDeposit(contract Portfolio _portfolio, uint256 _amount, bytes _data) external nonpayable returns (uint256)
Deposits an amount of Entity's
baseToken
into an Endaoment-approved Portfolio.Name | Type | Description |
---|---|---|
_portfolio | contract Portfolio | An Endaoment-approved portfolio. |
_amount | uint256 | Amount of baseToken to deposit into the portfolio. |
_data | bytes | Data required by a portfolio to deposit. |
Name | Type | Description |
---|---|---|
_0 | uint256 | _shares Amount of portfolio share tokens Entity received as a result of this deposit. |
function portfolioRedeem(contract Portfolio _portfolio, uint256 _shares, bytes _data) external nonpayable returns (uint256)
Redeems an amount of Entity's portfolio shares for an amount of
baseToken
.Name | Type | Description |
---|---|---|
_portfolio | contract Portfolio | An Endaoment-approved portfolio. |
_shares | uint256 | Amount of share tokens to redeem. |
_data | bytes | Data required by a portfolio to redeem. |
Name | Type | Description |
---|---|---|
_0 | uint256 | _received Amount of baseToken Entity received as a result of this redemption. |
function receiveTransfer(uint256 _transferAmount) external nonpayable
Updates the receiving entity balance on a transfer, after verifying that the receiver's ERC20 balance has increased appropriately.
This function is public, but is restricted such that it can only be called by other entities.
Name | Type | Description |
---|---|---|
_transferAmount | uint256 | The amount being received on the transfer. |
function reconcileBalance() external nonpayable
This method should be called to reconcile the Entity's internal baseToken accounting with the baseToken contract's accounting. There are a 2 situations where calling this method is appropriate: 1. To process amounts of baseToken that arrived at this Entity through methods besides Entity:donate or Entity:transfer. For example, if this Entity receives a normal ERC20 transfer of baseToken, the amount received will be unavailable for Entity use until this method is called to adjust the balance and process fees. OrgFundFactory.sol:_donate makes use of this method to do this as well. 2. Unusually, the Entity's perspective of balance could be lower than
baseToken.balanceOf(this)
. This could happen if Entity:callAsEntity is used to transfer baseToken. In this case, this method provides a way of correcting the Entity's internal balance.function registry() external view returns (contract Registry)
The base registry to which the entity is connected.
Name | Type | Description |
---|---|---|
_0 | contract Registry | undefined |
function setManager(address _manager) external nonpayable
Set a new manager for this entity.
Callable by current manager or permissioned role.
Name | Type | Description |
---|---|---|
_manager | address | Address of new manager. |
function setOrgId(bytes32 _orgId) external nonpayable
Name | Type | Description |
---|---|---|
_orgId | bytes32 | undefined |
function specialTarget() external view returns (bytes20)
If set to a non-zero value, this contract will pass these byes as the target contract to the RolesAuthority's
canCall
method, rather than its own contract. This allows a single RolesAuthority permission to manage permissions simultaneously for a group of contracts that identify themselves as a certain type. For example: set a permission for all "entity" contracts.Name | Type | Description |
---|---|---|
_0 | bytes20 | undefined |
function swapAndDonate(contract ISwapWrapper _swapWrapper, address _tokenIn, uint256 _amountIn, bytes _data) external payable
Receive a donated amount of ETH or ERC20 tokens, swaps them to base tokens, and adds the output to the entity's balance. Fee calculated using default rate and sent to treasury.
Name | Type | Description |
---|---|---|
_swapWrapper | contract ISwapWrapper | The swap wrapper to use for the donation. Must be whitelisted on the Registry. |
_tokenIn | address | The address of the ERC20 token to swap and donate, or ETH_PLACEHOLDER if donating ETH. |
_amountIn | uint256 | The amount of tokens or ETH being swapped and donated. |
_data | bytes | Additional call data required by the ISwapWrapper being used. |
function swapAndDonateWithOverrides(contract ISwapWrapper _swapWrapper, address _tokenIn, uint256 _amountIn, bytes _data) external payable
Receive a donated amount of ETH or ERC20 tokens, swaps them to base tokens, and adds the output to the entity's balance. Fee calculated using override rate and sent to treasury.
Name | Type | Description |
---|---|---|
_swapWrapper | contract ISwapWrapper | The swap wrapper to use for the donation. Must be whitelisted on the Registry. |
_tokenIn | address | The address of the ERC20 token to swap and donate, or ETH_PLACEHOLDER if donating ETH. |
_amountIn | uint256 | The amount of tokens or ETH being swapped and donated. |
_data | bytes | Additional call data required by the ISwapWrapper being used. |
function swapAndReconcileBalance(contract ISwapWrapper _swapWrapper, address _tokenIn, uint256 _amountIn, bytes _data) external nonpayable
Takes stray tokens or ETH sent directly to this Entity, swaps them for base token, then adds them to the Entity's balance after paying the appropriate fee to the treasury.
Name | Type | Description |
---|---|---|
_swapWrapper | contract ISwapWrapper | The swap wrapper to use to convert the assets. Must be whitelisted on the Registry. |
_tokenIn | address | The address of the ERC20 token to swap, or ETH_PLACEHOLDER if ETH. |
_amountIn | uint256 | The amount of tokens or ETH being swapped and added to the balance. |
_data | bytes | Additional call data required by the ISwapWrapper being used. |
function transfer(contract Entity _to, uint256 _amount) external nonpayable
Transfers an amount of base tokens from one entity to another. Transfers default fee to treasury.
Reverts if the entity is inactive or if the token transfer fails.Reverts if the transfer fee percentage is larger than 100% (equal to 1e4 when represented as a zoc).Reverts with
Unauthorized
if the msg.sender
is not the entity manager or a privileged role.Name | Type | Description |
---|---|---|
_to | contract Entity | The entity to receive the tokens. |
_amount | uint256 | Contains the amount being donated (denominated in the base token's units). |
function transferWithOverrides(contract Entity _to, uint256 _amount) external nonpayable
Transfers an amount of base tokens from one entity to another. Transfers default or overridden fee to treasury.
Reverts if the entity is inactive or if the token transfer fails.Reverts if the transfer fee percentage is larger than 100% (equal to 1e4 when represented as a zoc).Reverts with
Unauthorized
if the msg.sender
is not the entity manager or a privileged role.Name | Type | Description |
---|---|---|
_to | contract Entity | The entity to receive the tokens. |
_amount | uint256 | Contains the amount being donated (denominated in the base token's units). |
event EntityBalanceCorrected(address indexed entity, uint256 newBalance)
Emitted when a base token balance is used to correct the internal contract balance.
Name | Type | Description |
---|---|---|
entity indexed | address | undefined |
newBalance | uint256 | undefined |
event EntityBalanceReconciled(address indexed entity, uint256 amountReceived, uint256 amountFee)
Emitted when a base token reconciliation completes
Name | Type | Description |
---|---|---|
entity indexed | address | undefined |
amountReceived | uint256 | undefined |
amountFee | uint256 | undefined |
event EntityDeposit(address indexed portfolio, uint256 baseTokenDeposited, uint256 sharesRecieved)
Emitted when a portfolio deposit is made.
Name | Type | Description |
---|---|---|
portfolio indexed | address | undefined |
baseTokenDeposited | uint256 | undefined |
sharesRecieved | uint256 | undefined |
event EntityDonationReceived(address indexed from, address indexed to, uint256 amountReceived, uint256 amountFee)
Emitted when a donation is made.
Name | Type | Description |
---|---|---|
from indexed | address | undefined |
to indexed | address | undefined |
amountReceived | uint256 | undefined |
amountFee | uint256 | undefined |
event EntityFundsPaidOut(address indexed from, address indexed to, uint256 amountSent, uint256 amountFee)
Emitted when a payout is made from an entity.
Name | Type | Description |
---|---|---|
from indexed | address | undefined |
to indexed | address | undefined |
amountSent | uint256 | undefined |
amountFee | uint256 | undefined |
event EntityFundsTransferred(address indexed from, address indexed to, uint256 amountReceived, uint256 amountFee)
Emitted when a transfer is made between entities.
Name | Type | Description |
---|---|---|
from indexed | address | undefined |
to indexed | address | undefined |
amountReceived | uint256 | undefined |
amountFee | uint256 | undefined |
event EntityManagerSet(address indexed oldManager, address indexed newManager)
Emitted when manager is set.
Name | Type | Description |
---|---|---|
oldManager indexed | address | undefined |
newManager indexed | address | undefined |
event EntityRedeem(address indexed portfolio, uint256 sharesRedeemed, uint256 baseTokenReceived)
Emitted when a portfolio share redemption is made.
Name | Type | Description |
---|---|---|
portfolio indexed | address | undefined |
sharesRedeemed | uint256 | undefined |
baseTokenReceived | uint256 | undefined |
error AlreadyInitialized()