Skip to content

Commit

Permalink
Update AI assistant for stablecoin and real world asset (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau authored Nov 18, 2024
1 parent c0c172c commit 1351036
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/ui/api/ai.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import OpenAI from 'https://esm.sh/[email protected]'
import { OpenAIStream, StreamingTextResponse } from 'https://esm.sh/[email protected]'
import { erc20Function, erc721Function, erc1155Function, governorFunction, customFunction } from '../src/wiz-functions.ts'
import { erc20Function, erc721Function, erc1155Function, stablecoinFunction, realWorldAssetFunction, governorFunction, customFunction } from '../src/wiz-functions.ts'
import { Redis } from 'https://esm.sh/@upstash/[email protected]'

export default async (req: Request) => {
Expand Down Expand Up @@ -39,7 +39,7 @@ export default async (req: Request) => {
model: 'gpt-4-1106-preview',
messages,
functions: [
erc20Function, erc721Function, erc1155Function, governorFunction, customFunction
erc20Function, erc721Function, erc1155Function, stablecoinFunction, realWorldAssetFunction, governorFunction, customFunction
],
temperature: 0.7,
stream: true
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/Wiz.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
erc721: 'ERC721',
erc1155: 'ERC1155',
stablecoin: 'Stablecoin',
realworldasset: 'RealWorldAsset',
governor: 'Governor',
custom: 'Custom',
}
Expand Down Expand Up @@ -109,6 +110,8 @@
if (opts.access === 'false') { opts.access = false }
if (opts.upgradeable === 'false') { opts.upgradeable = false }
if (opts.timelock === 'false') { opts.timelock = false }
if (opts.votes === 'false') { opts.votes = false }
if (opts.limitations === 'false') { opts.limitations = false }
if (opts.proposalThreshold) { opts.proposalThreshold = opts.proposalThreshold.toString() }
if (opts.quorumAbsolute) { opts.quorumAbsolute = opts.quorumAbsolute.toString() }
if (opts.premint) { opts.premint = opts.premint.toString() }
Expand Down
22 changes: 22 additions & 0 deletions packages/ui/src/wiz-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,28 @@ export const erc1155Function = {
}
}

export const stablecoinFunction = {
name: 'stablecoin',
description: 'Make a stablecoin token that uses the ERC-20 standard. Emphasize that this is experimental, and some features are not audited and subject to change.',
parameters: {
type: 'object',
properties: {
...erc20Function.parameters.properties,
custodian: { type: 'boolean', description: 'Whether authorized accounts can freeze and unfreeze accounts for regulatory or security purposes. This feature is experimental, not audited and is subject to change.' },
// 'false' gets converted to false
limitations: { type: 'string', enum: ['false', 'allowlist', 'blocklist'], description: 'Whether to restrict certain users from transferring tokens, either via allowing or blocking them. This feature is experimental, not audited and is subject to change.' },
upgradeable: { type: 'string', enum: ['false'], description: 'Upgradeability is not yet available for features that use @openzeppelin/community-contracts' },
},
required: ['name', 'symbol'],
}
}

export const realWorldAssetFunction = {
name: 'realworldasset',
description: 'Make a real-world asset token that uses the ERC-20 standard. Emphasize that this is experimental, and some features are not audited and subject to change.',
parameters: stablecoinFunction.parameters,
}

export const governorFunction = {
name: 'governor',
description: 'Make a contract to implement governance, such as for a DAO',
Expand Down

0 comments on commit 1351036

Please sign in to comment.