From 135103654915840aa07ee882b829e5fefeb2202e Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Mon, 18 Nov 2024 15:15:26 -0500 Subject: [PATCH] Update AI assistant for stablecoin and real world asset (#408) --- packages/ui/api/ai.ts | 4 ++-- packages/ui/src/Wiz.svelte | 3 +++ packages/ui/src/wiz-functions.ts | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/ui/api/ai.ts b/packages/ui/api/ai.ts index 43606206..b203e420 100644 --- a/packages/ui/api/ai.ts +++ b/packages/ui/api/ai.ts @@ -1,6 +1,6 @@ import OpenAI from 'https://esm.sh/openai@4.11.0' import { OpenAIStream, StreamingTextResponse } from 'https://esm.sh/ai@2.2.16' -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/redis@1.25.1' export default async (req: Request) => { @@ -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 diff --git a/packages/ui/src/Wiz.svelte b/packages/ui/src/Wiz.svelte index 94cab59e..d9578013 100644 --- a/packages/ui/src/Wiz.svelte +++ b/packages/ui/src/Wiz.svelte @@ -38,6 +38,7 @@ erc721: 'ERC721', erc1155: 'ERC1155', stablecoin: 'Stablecoin', + realworldasset: 'RealWorldAsset', governor: 'Governor', custom: 'Custom', } @@ -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() } diff --git a/packages/ui/src/wiz-functions.ts b/packages/ui/src/wiz-functions.ts index 9c3cd4ea..2c8ee6d8 100644 --- a/packages/ui/src/wiz-functions.ts +++ b/packages/ui/src/wiz-functions.ts @@ -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',