EAC transfers to and from Exchange
EAC transfers are the only part of the exchange module that directly interacts with the Energy Web Chain. EACs are deposited from the personal blockchain account of the organization or user to the exchange. The exchange application creates blockchain accounts for its users and has itself a wallet account, where all EACs are stored that are currently traded on the exchange. After trading the EACs, users can withdraw them from the exchange. This means there are exactly two transactions on the blockchain: Users depositing EACs to the exchange and users withdrawing EACs from the exchange. The business logic of the exchange dictates who has the permission to withdraw which EACs.
The process is as follows: Once an EAC has been issued (see https://energyweb.atlassian.net/wiki/spaces/OD/pages/1138786351), the EAC owner can choose to trade it on the Origin Exchange. In order to publish the EACs for sale in the form of an ask, the user has to deposit the EACs to the Exchange. This locks the EACs and ensures that the user can only offer EACs for sale that have not been transferred to another user or are already claimed.
As EACs are represented as blockchain tokens (see https://energyweb.atlassian.net/wiki/spaces/OD/pages/883916918 ), they have to be transferred on-chain in order to be deposited to the Exchange. The Origin Exchange creates a unique smart contract wallet for each user that wants to trade on the exchange. This wallet acts as a deposit account on the exchange. As common practice for blockchain exchanges, this deposit account is tied to the user but owned by the Exchange operator on-chain. By depositing EACs to the Exchange, users put them in the custody of this operator. All operations that users can usually do with the on-chain EACs, like transferring and claiming them independently of a single application, are restricted this way. This ensures that all operations that are performed on the Origin Exchange are valid.
EACs that are deposited to the Exchange are stored in the Exchange user account. The user can choose to withdraw EACs from the Exchange user account if they are not currently being actively traded on the Exchange. Deposits and withdrawals are the only on-chain events that happen when using the Exchange.