-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Hackathon] Subscription service contract #98
base: main
Are you sure you want to change the base?
Conversation
e35ab95
to
a2170f7
Compare
3166cfc
to
f4c8025
Compare
f4c8025
to
7d0049e
Compare
…oric/dapp-offer-up into subscription-service-contract
6a6b2cc
to
e89f98d
Compare
contract/src/offer-up-proposal.js
Outdated
@@ -66,8 +69,12 @@ export const startOfferUpContract = async permittedPowers => { | |||
|
|||
const istIssuer = await istIssuerP; | |||
const istBrand = await istBrandP; | |||
const timerService = await await chainTimerServiceP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know whether await await
breaks anything, but it's at best unnecessary.
contract/src/offer-up.contract.js
Outdated
const { want } = buyerSeat.getProposal(); | ||
const tradeHandler = async (buyerSeat, offerArgs) => { | ||
// @ts-ignore | ||
const userAddress = offerArgs.userAddress; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the goal here?
This address is forgeable.
Can you key the map on seats instead of addresses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see suggested alternative below
contract/src/offer-up.contract.js
Outdated
*/ | ||
export const start = async zcf => { | ||
const { tradePrice, maxItems = 3n } = zcf.getTerms(); | ||
const { | ||
timerService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timer service is sufficiently powerful that it should be closely held; i.e. passed in privateArgs rather than terms.
The main power that's risky is the power to schedule wake-ups. You don't seem to be using that here. Perhaps use getClock before starting the contract and pass in the resulting Clock in terms.
See also:
import netflixLogo from '../assets/netflix.svg'; | ||
import disneyLogo from '../assets/disney.svg'; | ||
import hboLogo from '../assets/hbomax.svg'; | ||
import primeLogo from '../assets/amazon.svg'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure these are registered trademarks, not to be used without permission. OK for a hackathon, but we can't keep the code around long.
contract/package.json
Outdated
@@ -47,6 +47,7 @@ | |||
}, | |||
"dependencies": { | |||
"@agoric/ertp": "^0.16.3-u12.0", | |||
"@agoric/time": "^0.3.3-u16.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dapp dependencies are, unfortunately, tremendously fragile. Mixing u12 and u16 is asking for trouble, IME.
We should probably have a better scoped issue, but the tale of woe is in...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried rolling back to the u12 version of @agoric/time
(60e2308) but the symptoms remain.
give: { Price: M.gte(tradePrice) }, | ||
want: { Items: { brand: itemBrand, value: M.bag() } }, | ||
give: { Price: M.eq(subscriptionPrice) }, | ||
want: { Items: { brand: M.any(), value: M.bag() } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not itemBrand?
return subscriptionResources[serviceType]; | ||
} else { | ||
// User doesn't have a valid subscription | ||
return 'Access denied: You do not have a valid subscription.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samsiegart what was the hackathon project you worked on where services would look for NFTs in wallets (using vstorage queries) to gate access?
Ah... right... https://github.com/agoric-labs/agoric-passport-express
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nifty stuff. Please consider putting it in a fork in https://github.com/agoric-labs .
My "request changes" is to block accidentally landing it here.
No description provided.