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

Remove unused code and clear TODOs #115

Merged
merged 11 commits into from
Feb 15, 2024
103 changes: 27 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,41 @@
# Kread

TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
KREAd is a decentralized application deployed on Agoric, an open-source development company launching an interoperable Proof-of-Stake chain and economy. The dApp is imagined, built, and designed by Kryha. The SAGES art and comic is created by Enmanuel Heredia.

## Getting Started

TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
The KREAd application consists of a set of smart contracts deployed on Agoric and a frontend application to interact with them. The frontend can be accessed at [kread.app](http://kread.app/) and includes a network selector on the bottom left of the landing page to connect to different networks:

1. Installation process
2. Software dependencies
3. Latest releases
4. API references
1. Mainnet: hosts the official KREAd application, you can use it to mint, customize, and view your character as well as sell and buy using the KREAd marketplace. IST is used for payments and transaction fees can be paid in BLD or IST.
2. Emerynet: this network is meant for testing purposes and can be used to try out the application without spending real funds. The functionality is identical to Mainnet although the content may vary. You can use the [emerynet faucet](https://emerynet.faucet.agoric.net/) to get fake IST which can be used to interact with the KREAd contract.
3. Local: the KREAd frontend can also be connected to an Agoric chain running locally, this gives you full control by allowing changes to KREAd's source code. You can find instructions on how run KREAd locally [here](./agoric/README.md)

## Build and Test
## Build and Test Locally

TODO: Describe and show how to build your code and run the tests.
Ensure you are in the agoric folder (`KREAd/agoric/`) otherwise `cd agoric`

## Contribute

TODO: Explain how other users and developers can contribute to make your code better.

If you want to learn more about creating good readme files then refer the following [guidelines](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files:

- [ASP.NET Core](https://github.com/aspnet/Home)
- [Visual Studio Code](https://github.com/Microsoft/vscode)
- [Chakra Core](https://github.com/Microsoft/ChakraCore)

## To Run a local AG-Solo + Wallet + frontend

### Terminal 1 - agoric
1. Start the chain
1. `make local-testnet`
2. make the committee
1. `make kread-committee`
3. provision the fee collector wallet
1. `make provision-fee-collector`
4. start the KREAd contract
1. `make clean start-kread`
5. start frontend locally
1. `cd ../frontend`
2. `yarn & yarn dev`
3. open http://localhost:5173/

To confirm the contract was deployed successfully:

1. `agoric start -v --reset`
- in chain log you should see "CONTRACT INIT SUCCESS"
- after that `agd query vstorage children published` should include "kread"

### Terminal 2 - agoric
If you encounter `Request would exceed mint limit` try `make fund-account`
If you are running a local testnet make sure you select "Local" on the frontend's network selector (shown on the bottom right of the landing & connect-wallet pages)

1. `agoric deploy contract/kread-deploy-contract.js api/kread-deploy-api.js`
2. `agoric open --repl`

### Terminal 3 - frontend

1. Remove `type: module` from `package.json`
2. yarn start
3. Remember to put back the `type: module` before commiting your changes

## Run multiuser

To run the application for more than one user follow these steps:
## Contribute

0. Install GO!
1. `brew install go`
1. Run Make in your local agoric-sdk directory
1. `cd <local-sdk-path>/packages/cosmic-swingset`
2. `make`
2. Run the chain:
1. Open a new terminal window
2. `cd agoric/`
3. `make chain-reset` and wait until it starts validating blocks
3. Run ag-solo for the first user:
1. Open a new terminal window
2. `cd agoric/`
3. `make solo0-reset` and wait until it prints "Deployed wallet!"
4. Run ag-solo for the second user:
1. Open a new terminal window
2. `cd agoric/`
3. `make solo1-reset` and wait until it prints "Deployed wallet!"
5. Configure wallet and localStorage for the first user:
1. Open a new terminal window
2. `cd agoric/`
3. `make wallet0` and open the url in a new browser tab
6. Configure wallet and localStorage for the second user:
1. Open a new browser or a new session
2. `make wallet1` and open the url in the new session or browser
7. Deploy contract and api:
1. Open `frontend/package.json` and add `"type": "module"` to the configuration
2. From `agoric/` directory run `make deploy`
3. After everything is deployed, remove the line you added to `frontend/package.json`
8. On the session with the wallet listening to port 8001:
1. Navigate to `local.agoric.com`
2. In the text field type `https://localhost:8001/#accessToken=<access_token_value>` where `access_token_value` is the value you get when executing `make wallet1`
3. Click `save`, then click `open`
4. Navigate to `local.agoric.com`
5. In the text field type `https://localhost:8001/`
6. Click `save`, then click `open`
9. Run frontend:
1. Open a new terminal window
2. `cd frontend/`
3. `yarn start`
4. Navigate to `localhost:3000` on each session and approve the app in both wallets
10. Enjoy!
Refer to [Contributing](./CONTRIBUTING.md) for guidelines

1 change: 0 additions & 1 deletion agoric/contract/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ harden(meta);
export const prepare = async (zcf, privateArgs, baggage) => {
const terms = zcf.getTerms();

// TODO: move to proposal
const assetNames = terms.assetNames;

// Setting up the mint capabilities here in the prepare function, as discussed with Turadg
Expand Down
1 change: 0 additions & 1 deletion agoric/contract/src/kreadKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ export const prepareKreadKit = (
(({ seat: _omitSeat, ...char }) => char)(character),
);

// TODO: consider refactoring what we put in the inventory node
inventoryKit.recorder.write(
inventorySeat.getAmountAllocated('Item').value.payload,
);
Expand Down
8 changes: 3 additions & 5 deletions agoric/contract/src/type-guards.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,14 @@ export const MarketRecorderGuard = M.or(
}),
asset: M.or(CharacterGuard, ItemGuard),
isFirstSale: M.boolean(),
// history: M.arrayOf(HistoryGuard),
}),
M.string(''),
);

export const MarketEntryGuard = M.splitRecord({
id: M.or(M.gte(0), M.string()),
seat: M.eref(M.remotable('Seat')),
recorderKit: M.record(), // TODO: figure out how to type recorderkits
recorderKit: M.record(),
askingPrice: M.splitRecord({
brand: BrandShape,
value: M.nat(),
Expand All @@ -199,7 +198,6 @@ export const MarketEntryGuard = M.splitRecord({
}),
asset: M.or(CharacterGuard, ItemGuard),
isFirstSale: M.boolean(),
// history: M.arrayOf(HistoryGuard),
});

export const MarketI = M.interface('market', {
Expand Down Expand Up @@ -230,14 +228,14 @@ export const CharacterEntryGuard = M.splitRecord({
name: M.string(),
character: CharacterGuard,
inventory: M.eref(M.remotable('Seat')),
inventoryKit: M.record(), // TODO: figure out how to type recorderkits
inventoryKit: M.record(),
history: M.arrayOf(HistoryGuard),
});

export const CharacterRecorderGuard = M.splitRecord({
name: M.string(),
character: CharacterGuard,
inventoryKit: M.record(), // TODO: figure out how to type recorderkits
inventoryKit: M.record(),
history: M.arrayOf(HistoryGuard),
});

Expand Down
49 changes: 24 additions & 25 deletions docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ Behaves like a non-fungible token, meaning it's a digital asset that can hold ar

See the table and example below for more information about the properties that make up KREAd Character SFTs:

| Character | Description | Type | Example |
|-----------------|---------------------------------------|----------------------------|---------------------------------------------------------------------------------------------------------------------|
| title | TBD | string | 'Bounty Hunter' |
| origin | TBD | string | 'Arma' |
| description | TBD | string | 'A Bounty Hunter from Wildlands.' |
| level | TBD | number | 51 |
| artistMetadata | Link to the artists Instagram account | string (link to IG page) | 'https://www.instagram.com/enmanueljrperez/' |
| image | Link to the character image | string (link to webp file) | 'https://pink-defensive-jay-557.mypinata.cloud/ipfs/Qmc55m7RrzZtB25mM9B2c9BdtXcLDbhSrErWMAa7azCet6/Citizen/images/001.webp' |
| characterTraits | Link to the character traits | string (link to json file) | 'https://pink-defensive-jay-557.mypinata.cloud/ipfs/Qmc55m7RrzZtB25mM9B2c9BdtXcLDbhSrErWMAa7azCet6/Citizen/metadata.json' |

| Character | Type | Example |
|----------------- |---------------------------- |----------------------------------------------------------------------------------------------------------------------------- |
| title | string | 'Bounty Hunter' |
| origin | string | 'Arma' |
| description | string | 'A Bounty Hunter from Wildlands.' |
| level | number | 51 |
| artistMetadata | string (link to IG page) | 'https://www.instagram.com/enmanueljrperez/' |
| image | string (link to webp file) | 'https://pink-defensive-jay-557.mypinata.cloud/ipfs/Qmc55m7RrzZtB25mM9B2c9BdtXcLDbhSrErWMAa7azCet6/Citizen/images/001.webp' |
| characterTraits | string (link to json file) | 'https://pink-defensive-jay-557.mypinata.cloud/ipfs/Qmc55m7RrzZtB25mM9B2c9BdtXcLDbhSrErWMAa7azCet6/Citizen/metadata.json' |
```js
CharacterSFT = {
"artistMetadata": "https://instagram.com/enmanueljrperez?igshid=MzRlODBiNWFlZA==",
Expand All @@ -43,21 +42,21 @@ Semi-fungible token representing items that can be equipped to and from a Charac

See the table and example below for more information about the properties that make up KREAd Item SFTs:

| Item | description | type | example |
|----------------|-----------------------------------------------------------------------------------------------------------------------|----------------------------|---------------------------------------------------------------------------------------------------------------------|
| name | TODO | string | 'Bounty Hunter' |
| origin | TODO | string | 'Arma' |
| description | TODO | string | 'A Bounty Hunter from Wildlands.' |
| level | TODO | number | 51 |
| rarity | number value indicating item rarity (higher is more rare) | number (TODO: range) | 18 |
| category | determines which inventory slot and the item can be equipped to, inventories can only hold 1 item of a given category | string | 'background' |
| sense | TODO | number | 0 |
| weight | TODO | number | 0 |
| colors | List of colors present in the item, used for filters | string [] | [] |
| reserves | TODO | number | 0 |
| functional | TODO | boolean | false |
| artistMetadata | Link to the artists Instagram account | string (link to IG page) | 'https://www.instagram.com/enmanueljrperez/' |
| image | Link to the character image | string (link to webp file) | 'pink-defensive-jay-557.mypinata.cloud/ipfs/Qmc55m7RrzZtB25mM9B2c9BdtXcLDbhSrErWMAa7azCet6/Citizen/images/001.webp' |
| Item | type | example |
|---------------- |---------------------------- |--------------------------------------------------------------------------------------------------------------------- |
| name | string | 'Bounty Hunter' |
| origin | string | 'Arma' |
| description | string | 'A Bounty Hunter from Wildlands.' |
| level | number | 51 |
| rarity | number | 18 |
| category | string | 'background' |
| sense | number | 0 |
| weight | number | 0 |
| colors | string [] | [] |
| reserves | number | 0 |
| functional | boolean | false |
| artistMetadata | string (link to IG page) | 'https://www.instagram.com/enmanueljrperez/' |
| image | string (link to webp file) | 'pink-defensive-jay-557.mypinata.cloud/ipfs/Qmc55m7RrzZtB25mM9B2c9BdtXcLDbhSrErWMAa7azCet6/Citizen/images/001.webp' |


```js
Expand Down
7 changes: 1 addition & 6 deletions frontend/.yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ nmHoistingLimits: workspaces

nodeLinker: node-modules

# TODO: remove azure dependency
npmScopes:
kryha:
npmRegistryServer: "https://pkgs.dev.azure.com/Kryha-io/_packaging/Kryha-io/npm/registry"

# using package.json's packageManager instead of yarnPath
# commented in favor of package.json's packageManager property
# yarnPath: .yarn/releases/yarn-4.0.0.cjs
5 changes: 0 additions & 5 deletions frontend/src/components/activity-table/activity-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ interface RowProps {
event: ActivityEvent;
}

// TODO: implement to and from if/when possible
const Header: FC = () => {
return (
<>
<Cell>{text.item.event}</Cell>
<Cell>{text.item.price}</Cell>
{/* <Cell>{text.item.from}</Cell>
<Cell>{text.item.to}</Cell> */}
<Cell>{text.item.date}</Cell>
</>
);
Expand All @@ -38,8 +35,6 @@ const Row: FC<RowProps> = ({ event }) => {
<Cell>
<BoldLabel customColor={color.black}>{!!event.price && text.param.istPrice && event.price}</BoldLabel>
</Cell>
{/* <Cell>{event.from}</Cell>
<Cell>{event.to}</Cell> */}
<Cell>{getDatefromEpoch(Number(event.date))}</Cell>
</>
);
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/asset-card/character-card-market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ export const CharacterCardMarket: FC<Props> = ({ characterInMarket, onClick }) =
</AssetFooter>
</AssetInfoContainer>
</AssetContent>
{/* TODO: figure out if we want to use this label for something */}
{/*extendedCharacter. && <BoldLabel customColor={color.black}>{text.general.forSale}</BoldLabel>*/}
</AssetWrapper>
);
};
Loading
Loading