forked from Agoric/agoric-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Agoric#11 from Agoric/gallery-demo
Gallery demo
- Loading branch information
Showing
24 changed files
with
1,604 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { makePrivateName } from '../util/PrivateName'; | ||
|
||
export function makeBasicMintController() { | ||
// Map from purse or payment to the rights it currently | ||
// holds. Rights can move via payments | ||
|
||
// purse/payment to amount | ||
let rights = makePrivateName(); | ||
|
||
function recordPayment(src, payment, amount, srcNewRightsAmount) { | ||
rights.set(src, srcNewRightsAmount); | ||
rights.init(payment, amount); | ||
} | ||
|
||
function destroy(_amount) { | ||
throw new Error('destroy is not implemented'); | ||
} | ||
|
||
function destroyAll() { | ||
rights = makePrivateName(); // reset rights | ||
} | ||
|
||
function recordDeposit( | ||
srcPayment, | ||
srcNewRightsAmount, | ||
purse, | ||
purseNewRightsAmount, | ||
) { | ||
rights.set(srcPayment, srcNewRightsAmount); | ||
rights.set(purse, purseNewRightsAmount); | ||
} | ||
|
||
function recordMint(purse, initialAmount) { | ||
rights.init(purse, initialAmount); | ||
} | ||
|
||
function getAmount(pursePayment) { | ||
return rights.get(pursePayment); | ||
} | ||
|
||
const mintController = { | ||
destroy, | ||
destroyAll, | ||
recordPayment, | ||
recordDeposit, | ||
recordMint, | ||
getAmount, | ||
}; | ||
return mintController; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.