Skip to content
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

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

rabi-siddique
Copy link
Contributor

No description provided.

@rabi-siddique rabi-siddique force-pushed the subscription-service-contract branch 2 times, most recently from e35ab95 to a2170f7 Compare September 5, 2024 08:23
@rabi-siddique rabi-siddique force-pushed the subscription-service-contract branch 3 times, most recently from 3166cfc to f4c8025 Compare September 5, 2024 08:48
@rabi-siddique rabi-siddique force-pushed the subscription-service-contract branch from f4c8025 to 7d0049e Compare September 5, 2024 08:49
@Muneeb147 Muneeb147 marked this pull request as draft September 5, 2024 11:23
@rabi-siddique rabi-siddique force-pushed the subscription-service-contract branch from 6a6b2cc to e89f98d Compare September 5, 2024 13:42
@Muneeb147 Muneeb147 changed the title Subscription service contract [Hackathon] Subscription service contract Sep 5, 2024
@@ -66,8 +69,12 @@ export const startOfferUpContract = async permittedPowers => {

const istIssuer = await istIssuerP;
const istBrand = await istBrandP;
const timerService = await await chainTimerServiceP;

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.

const { want } = buyerSeat.getProposal();
const tradeHandler = async (buyerSeat, offerArgs) => {
// @ts-ignore
const userAddress = offerArgs.userAddress;
Copy link
Member

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?

Copy link
Member

@dckc dckc Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*/
export const start = async zcf => {
const { tradePrice, maxItems = 3n } = zcf.getTerms();
const {
timerService,
Copy link
Member

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:

Comment on lines +7 to +10
import netflixLogo from '../assets/netflix.svg';
import disneyLogo from '../assets/disney.svg';
import hboLogo from '../assets/hbomax.svg';
import primeLogo from '../assets/amazon.svg';
Copy link
Member

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.

@@ -47,6 +47,7 @@
},
"dependencies": {
"@agoric/ertp": "^0.16.3-u12.0",
"@agoric/time": "^0.3.3-u16.0",
Copy link
Member

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...

Copy link
Member

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() } },
Copy link
Member

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.';
Copy link
Member

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

Copy link
Member

@dckc dckc left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants