Update 007_eMoney_integration.md
This commit is contained in:
parent
8fd364bc52
commit
a5c24d8f6d
@ -1,75 +1,53 @@
|
||||
## Incoming Sarafu ##
|
||||
When users exchange CIC <> National Currency we have to manually send them Mpesa or CIC.
|
||||
We would like to automate this.
|
||||
## Notes ##
|
||||
Users have no way to automate the excahnge of CIC <> National Currency. Can people be encouraged to be liquidity providers and develop pools containing CIC and National Currency or other token? Creating a on-chain liquidity pool still requires on and off-boarding crypto to fiat.
|
||||
|
||||
|
||||
## Solution ##
|
||||
Configure - using our own system AfricasTalking API to automatically send CIC / Mpesa based on rules:
|
||||
Using AfricasTalking API to automatically send Mpesa from a business account when CIC is received (Blockchain account triggered):
|
||||
Using RPC endpoints and contract calls to automatically send CIC when KSH is received (MPesa call back triggered)
|
||||
|
||||
A liquidity pool can be created off-chain where a liquidity provider simply monitors two (float) accounts one of CIC and another of Mpesa.
|
||||
|
||||
- CIC - > Mpesa
|
||||
- CICs are converted to reserve on-chain and the xDAI is held in a GE account (xDAI Float)
|
||||
- We send back an equivalent amount of Mpesa to the user from out MPESA float account
|
||||
- CICs are added to the float account account triggering Mpesa to be released from the mpesa (float)
|
||||
- We send back an amount of Mpesa to the user from out MPESA float account (this amount can be based on a bonding curve)
|
||||
- Mpesa -> CIC
|
||||
- Mpesa are added to our float Mpesa account.
|
||||
- xDAI from our xDAI float account is added to the reserve of the CIC (Home CIC of the user) and new CICs are minted and sent to the user
|
||||
- CIC from our Sarafu float account is sent to the user (this amount can be based on a bonding curve)
|
||||
|
||||
|
||||
### Variables ###
|
||||
- blockchain_CIC_Supply = the total supply of the CIC on the blockchain
|
||||
- blockchain_CIC_reserve = the total reserve (xDAI) of the CIC on the blockchain
|
||||
- trr = the connector weight on blockchain converter between supply and reserve
|
||||
- FLoat xDAI: THe amount of xDAI we have in our master wallet
|
||||
- FLoat Mpesa: THe amount of Mpesa supply we have in our PayBill account
|
||||
- CIC_excahnge_amount = the amount of CIC they user has sent to exhange
|
||||
- Mpesa_excahnge_amount = the amount of MPesa the user has sent to exhange
|
||||
- Rate: USD -> KSH
|
||||
- Rate: KSH -> USD
|
||||
### Variables for excahnge rates ###
|
||||
- float_CIC_Supply = the total supply of the CIC on the float account
|
||||
- float_CIC_reserve = the total supply of Mpesa in the float account
|
||||
- trr = the connector weight on blockchain converter between supply and reserve (assuming 50%)
|
||||
- CIC_excahnge_amount = the amount of CIC the user has sent to exhange for Mpesa
|
||||
- Mpesa_excahnge_amount = the amount of MPesa the user has sent to exhange for CIC
|
||||
- Rate: CIC -> KSH
|
||||
- Rate: KSH -> CIC
|
||||
- Fees: Sarafu to Mpesa FeeCC2M = 2%
|
||||
- Fees: Sarafu to Mpesa FeeM2CC = 2%
|
||||
- The account to which CIC are sent should be a Agent account
|
||||
- The cash-out rules for a chama (minimum and time limit)
|
||||
- Alert balance levels
|
||||
- Alert on float balance and excahnge rate levels
|
||||
|
||||
### Incoming CIC Rules - MPESA out ###
|
||||
- *white list* The chama (group accounts only but eventually anyone) can cash out - note the chama limits
|
||||
- *amount* See KYC_limit max, supply_max
|
||||
- *mpesa given* The amount of Mpesa given should be calculated as follows:
|
||||
The amount of Mpesa given should be calculated as follows:
|
||||
- CIC_excahnge_amount = the amount of CIC the user wants to excahnge
|
||||
|
||||
The Reserve (xDAI) to be pulled out (reported):
|
||||
Quotation: The Reserve (Mpesa) to be pulled out (reported):
|
||||
|
||||
- reserveOut_xDAI_reported = the amount of xDAI that would be pulled from the reserve on-chain (by getting a quote on-chain)
|
||||
- reserveOut_Mpesa = reserveOut_xDAI_reported **USD => KSH** rate
|
||||
- reserveOut_Mpesa_reported = reserveOut_xDAI_reported **USD => KSH** rate
|
||||
Assuming a (trr=50%) connector weight: return (float_CIC_reserve x CIC_exchange_amount ) / (float_CIC_reserve + CIC_excahnge_amount)
|
||||
- reserveOut_Mpesa_reported = the the above amount of Mpesa that would be pulled from the Mpesa float account minus any fees (FeeM2CC)
|
||||
|
||||
After the user confirms:
|
||||
|
||||
The Reserve (xDAI) actually pulled out
|
||||
- reserveOut_xDAI = the amount of xDAI actually pulled from the reserve on-chain
|
||||
- **Mpesa_out** = reserveOut_Mpesa_reported (this is actually given to the user) - **and GE takes on the Mpesa risk**
|
||||
- reserveOut_Mpesa = reserveOut_xDAI **USD => KSH** rate (this is from our MPESA float account)
|
||||
- Mpesa_risk = Mpesa_out - reserveOut_Mpesa - this should me monitored and recorded for each transactions
|
||||
Note that this should be the minimum amount the user will get - if they confirm (not the max)
|
||||
|
||||
After the user confirms the quotation - and executes the conversion: they should get out a minimum of reserveOut_Mpesa_reported
|
||||
|
||||
### Outgoing Sarafu Rules - MPESA In ###
|
||||
- *white list* Only users sending via paybill receive Sarafu. Non users receive a invitation to join Sarafu sms (alert to admins there was a donation).
|
||||
- *amount* The max sarafu out is 20,000 Sarafu per user, KYC_limit max, supply_max
|
||||
- *time* No limit
|
||||
- *Mpesa_excahnge_amount* The amount of CIC given should be calculated as follows:
|
||||
- reserveIn_xDAI = (Mpesa_excahnge_amount - Mpesa_excahnge_amount* fee) **KSH => USD** rate (this will come out of the xDAI float account)
|
||||
|
||||
The CIC to be created (reported for quote):
|
||||
|
||||
- CIC_Created_reported = the amount of CIC to be created on chain by adding the reserveIn_xDAI (quote from blockchain)
|
||||
|
||||
After the user confirms:
|
||||
|
||||
- CIC_Created = the actualy amount of CIC created on chain by adding the reserveIn_xDAI
|
||||
- **CIC_given** = CIC_Created_reported
|
||||
- CIC_risk = CIC_given - CIC_Created - this should be monitored and recorded for each transaction
|
||||
inverse of the above
|
||||
|
||||
### Exchange Rate ###
|
||||
|
||||
When dislaying the SPOT price or excahnge rate to a user we should use the following formula:
|
||||
> Exchange Price = CIC_reserve / (CIC_supply * trr) -> this is pulled from blockchain and should be sent back as a SMS
|
||||
> Exchange Price = float_CIC_reserve / (float_CIC_supply * trr) -> this is pulled from blockchain and should be sent back as a SMS
|
||||
|
||||
|
||||
### USSD Interface ###
|
||||
|
Loading…
Reference in New Issue
Block a user