5.6 Exchanges

CREATE exchange UniDido.TopOffDining ( FromAccount Hash. ToAccount Hash ) AS FROM OurDido.StudentAccount TO OurDido.DinningHallAccount ( AccountsID : Hash; StudentId : SELECT genesis FROM OurDido.StudentAccount STUDENT_ACCT WHERE STUDENT_ACCT.AccountId = $FromAccount.; AccountId : SELECT genesis FROM OurDido.DinningHallAccount DINING_ACCT WHERE DINING_ACCT.AccountId = $ToAccount.; ) AS TRANSACTION ( TRANSFER FROM StudentId::CURRENT TO OurDido.DinningHallAccount AMOUNT $AmountToTransfer. TIMEOUT = 10*60000 --- 10 minutes WHEN Success THEN POST INFORMATION TO Log, Notify OBJECTS OurDido.StudentAccount, OurDido.DinningHallAccount TEXT The $AmountToTransfer. successful BETWEEN $FromDido. AND $toDido WHEN failure THEN POST WARNING TO log, Notify, Alert OBJECTS OurDido.StudentAccount, OurDido.DinningHallAccount, OurDido.Administrator );