diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 242e891..8fcbebd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,10 +30,8 @@ jobs: NEXT_PUBLIC_TEST_NET_URL: "http://localhost:3000" NEXT_PUBLIC_CRESCENDO_URL: "http://localhost:3000" NEXT_PUBLIC_TOKEN_AMOUNT_FLOW: "1000.0" - NEXT_PUBLIC_TOKEN_AMOUNT_FUSD: "10.0" NEXT_PUBLIC_CONTRACT_FUNGIBLE_TOKEN: "0xee82856bf20e2aa6" NEXT_PUBLIC_CONTRACT_FLOW_TOKEN: "0x0ae53cb6e3f42a79" - NEXT_PUBLIC_CONTRACT_FUSD: "0xf8d6e0586b0a20c7" NEXT_PUBLIC_NETWORK: "testnet" strategy: diff --git a/README.md b/README.md index ddc4ce8..7fcb1af 100644 --- a/README.md +++ b/README.md @@ -56,12 +56,6 @@ npm run db-seed npm run dev-deploy-contracts ``` -### Run initial transactions to initialize the FUSD minter - -```sh -npm run initial-transactions -``` - ### Run the Next.js app ```sh diff --git a/cadence/contracts/FUSD.cdc b/cadence/contracts/FUSD.cdc deleted file mode 100644 index ef45ba3..0000000 --- a/cadence/contracts/FUSD.cdc +++ /dev/null @@ -1,207 +0,0 @@ -import FungibleToken from "./FungibleToken.cdc" - -pub contract FUSD: FungibleToken { - - // Event that is emitted when the contract is created - pub event TokensInitialized(initialSupply: UFix64) - - // Event that is emitted when tokens are withdrawn from a Vault - pub event TokensWithdrawn(amount: UFix64, from: Address?) - - // Event that is emitted when tokens are deposited to a Vault - pub event TokensDeposited(amount: UFix64, to: Address?) - - // Event that is emitted when new tokens are minted - pub event TokensMinted(amount: UFix64) - - // The storage path for the admin resource - pub let AdminStoragePath: StoragePath - - // The storage Path for minters' MinterProxy - pub let MinterProxyStoragePath: StoragePath - - // The public path for minters' MinterProxy capability - pub let MinterProxyPublicPath: PublicPath - - // Event that is emitted when a new minter resource is created - pub event MinterCreated() - - // Total supply of fusd in existence - pub var totalSupply: UFix64 - - // Vault - // - // Each user stores an instance of only the Vault in their storage - // The functions in the Vault are governed by the pre and post conditions - // in FungibleToken when they are called. - // The checks happen at runtime whenever a function is called. - // - // Resources can only be created in the context of the contract that they - // are defined in, so there is no way for a malicious user to create Vaults - // out of thin air. A special Minter resource needs to be defined to mint - // new tokens. - // - pub resource Vault: FungibleToken.Provider, FungibleToken.Receiver, FungibleToken.Balance { - - // holds the balance of a users tokens - pub var balance: UFix64 - - // initialize the balance at resource creation time - init(balance: UFix64) { - self.balance = balance - } - - // withdraw - // - // Function that takes an integer amount as an argument - // and withdraws that amount from the Vault. - // It creates a new temporary Vault that is used to hold - // the money that is being transferred. It returns the newly - // created Vault to the context that called so it can be deposited - // elsewhere. - // - pub fun withdraw(amount: UFix64): @FungibleToken.Vault { - self.balance = self.balance - amount - emit TokensWithdrawn(amount: amount, from: self.owner?.address) - return <-create Vault(balance: amount) - } - - // deposit - // - // Function that takes a Vault object as an argument and adds - // its balance to the balance of the owners Vault. - // It is allowed to destroy the sent Vault because the Vault - // was a temporary holder of the tokens. The Vault's balance has - // been consumed and therefore can be destroyed. - pub fun deposit(from: @FungibleToken.Vault) { - let vault <- from as! @FUSD.Vault - self.balance = self.balance + vault.balance - emit TokensDeposited(amount: vault.balance, to: self.owner?.address) - vault.balance = 0.0 - destroy vault - } - - destroy() { - FUSD.totalSupply = FUSD.totalSupply - self.balance - } - } - - // createEmptyVault - // - // Function that creates a new Vault with a balance of zero - // and returns it to the calling context. A user must call this function - // and store the returned Vault in their storage in order to allow their - // account to be able to receive deposits of this token type. - // - pub fun createEmptyVault(): @FUSD.Vault { - return <-create Vault(balance: 0.0) - } - - // Minter - // - // Resource object that can mint new tokens. - // The admin stores this and passes it to the minter account as a capability wrapper resource. - // - pub resource Minter { - - // mintTokens - // - // Function that mints new tokens, adds them to the total supply, - // and returns them to the calling context. - // - pub fun mintTokens(amount: UFix64): @FUSD.Vault { - pre { - amount > 0.0: "Amount minted must be greater than zero" - } - FUSD.totalSupply = FUSD.totalSupply + amount - emit TokensMinted(amount: amount) - return <-create Vault(balance: amount) - } - - } - - pub resource interface MinterProxyPublic { - pub fun setMinterCapability(cap: Capability<&Minter>) - } - - // MinterProxy - // - // Resource object holding a capability that can be used to mint new tokens. - // The resource that this capability represents can be deleted by the admin - // in order to unilaterally revoke minting capability if needed. - - pub resource MinterProxy: MinterProxyPublic { - - // access(self) so nobody else can copy the capability and use it. - access(self) var minterCapability: Capability<&Minter>? - - // Anyone can call this, but only the admin can create Minter capabilities, - // so the type system constrains this to being called by the admin. - pub fun setMinterCapability(cap: Capability<&Minter>) { - self.minterCapability = cap - } - - pub fun mintTokens(amount: UFix64): @FUSD.Vault { - return <- self.minterCapability! - .borrow()! - .mintTokens(amount:amount) - } - - init() { - self.minterCapability = nil - } - - } - - // createMinterProxy - // - // Function that creates a MinterProxy. - // Anyone can call this, but the MinterProxy cannot mint without a Minter capability, - // and only the admin can provide that. - // - pub fun createMinterProxy(): @MinterProxy { - return <- create MinterProxy() - } - - // Administrator - // - // A resource that allows new minters to be created - // - // We will only want one minter for now, but might need to add or replace them in future. - // The Minter/Minter Proxy structure enables this. - // Ideally we would create this structure in a single function, generate the paths from the address - // and cache all of this information to enable easy revocation but String/Path comversion isn't yet supported. - // - pub resource Administrator { - - // createNewMinter - // - // Function that creates a Minter resource. - // This should be stored at a unique path in storage then a capability to it wrapped - // in a MinterProxy to be stored in a minter account's storage. - // This is done by the minter account running: - // transactions/fusd/minter/setup_fusd_minter.cdc - // then the admin account running: - // transactions/fusd/admin/deposit_fusd_minter.cdc - // - pub fun createNewMinter(): @Minter { - emit MinterCreated() - return <- create Minter() - } - - } - - init() { - self.AdminStoragePath = /storage/fusdAdmin - self.MinterProxyPublicPath = /public/fusdMinterProxy - self.MinterProxyStoragePath = /storage/fusdMinterProxy - - self.totalSupply = 0.0 - - let admin <- create Administrator() - self.account.save(<-admin, to: self.AdminStoragePath) - - // Emit an event that shows that the contract was initialized - emit TokensInitialized(initialSupply: 0.0) - } -} \ No newline at end of file diff --git a/cadence/transactions/deposit_fusd_minter.cdc b/cadence/transactions/deposit_fusd_minter.cdc deleted file mode 100644 index 43f9b44..0000000 --- a/cadence/transactions/deposit_fusd_minter.cdc +++ /dev/null @@ -1,54 +0,0 @@ -// This transaction creates a new FUSD minter and deposits -// it into an existing minter proxy resource on the specified account. -// -// Parameters: -// - minterAddress: The minter account address. -// -// This transaction will fail if the authorizer does not have the FUSD.Administrator -// resource. -// -// This transaction will fail if the minter account does not have -// an FUSD.MinterProxy resource. Use the setup_fusd_minter.cdc transaction to -// create a minter proxy in the minter account. - -import FUSD from 0xFUSDADDRESS - -transaction(minterAddress: Address) { - - let resourceStoragePath: StoragePath - let capabilityPrivatePath: CapabilityPath - let minterCapability: Capability<&FUSD.Minter> - - prepare(adminAccount: AuthAccount) { - - // These paths must be unique within the FUSD contract account's storage - self.resourceStoragePath = /storage/fusdAdminMinter - self.capabilityPrivatePath = /private/fusdAdminMinter - - // Create a reference to the admin resource in storage. - let tokenAdmin = adminAccount.borrow<&FUSD.Administrator>(from: FUSD.AdminStoragePath) - ?? panic("Could not borrow a reference to the admin resource") - - // Create a new minter resource and a private link to a capability for it in the admin's storage. - let minter <- tokenAdmin.createNewMinter() - adminAccount.save(<- minter, to: self.resourceStoragePath) - self.minterCapability = adminAccount.link<&FUSD.Minter>( - self.capabilityPrivatePath, - target: self.resourceStoragePath - ) ?? panic("Could not link minter") - - } - - execute { - // This is the account that the capability will be given to - let minterAccount = getAccount(minterAddress) - - let capabilityReceiver = minterAccount.getCapability - <&FUSD.MinterProxy{FUSD.MinterProxyPublic}> - (FUSD.MinterProxyPublicPath)! - .borrow() ?? panic("Could not borrow capability receiver reference") - - capabilityReceiver.setMinterCapability(cap: self.minterCapability) - } - -} \ No newline at end of file diff --git a/cadence/transactions/setup_fusd_minter.cdc b/cadence/transactions/setup_fusd_minter.cdc deleted file mode 100644 index 8a01a65..0000000 --- a/cadence/transactions/setup_fusd_minter.cdc +++ /dev/null @@ -1,25 +0,0 @@ -// This transaction creates a new minter proxy resource and -// stores it in the signer's account. -// -// After running this transaction, the FUSD administrator -// must run deposit_fusd_minter.cdc to deposit a minter resource -// inside the minter proxy. - -import FUSD from 0xFUSDADDRESS - -transaction { - prepare(minter: AuthAccount) { - - let minterProxy <- FUSD.createMinterProxy() - - minter.save( - <- minterProxy, - to: FUSD.MinterProxyStoragePath, - ) - - minter.link<&FUSD.MinterProxy{FUSD.MinterProxyPublic}>( - FUSD.MinterProxyPublicPath, - target: FUSD.MinterProxyStoragePath - ) - } -} \ No newline at end of file diff --git a/components/FundAccountFields.tsx b/components/FundAccountFields.tsx index 2b9233e..9d86b0b 100644 --- a/components/FundAccountFields.tsx +++ b/components/FundAccountFields.tsx @@ -3,24 +3,13 @@ import Button from "components/Button" import Captcha from "components/Captcha" import FormErrors from "components/FormErrors" import {Field, useFormikContext} from "formik" -import { - FLOW_TYPE, - FUSD_TYPE, - MISSING_FUSD_VAULT_ERROR, - paths, -} from "lib/constants" +import {FLOW_TYPE, paths} from "lib/constants" import {NETWORK_DISPLAY_NAME} from "lib/network" import {Box, Link, Themed} from "theme-ui" import {CustomInputComponent, CustomSelectComponent} from "./inputs" -const FUSD_VAULT_DOCS_LINK = { - url: "https://docs.onflow.org/fusd/#how-do-i-get-an-fusd-enabled-wallet", - name: "How do I get an FUSD-enabled wallet?", -} - export const TOKEN_OPTIONS = [ {value: FLOW_TYPE, label: `${NETWORK_DISPLAY_NAME} FLOW`}, - {value: FUSD_TYPE, label: `${NETWORK_DISPLAY_NAME} FUSD`}, ] export default function FundAccountFields({ @@ -77,16 +66,7 @@ export default function FundAccountFields({ > Fund Your Account - {errors.length > 0 && ( - e === MISSING_FUSD_VAULT_ERROR) - ? FUSD_VAULT_DOCS_LINK - : undefined - } - /> - )} + {errors.length > 0 && } diff --git a/env.example b/env.example index 886cba7..e127cae 100644 --- a/env.example +++ b/env.example @@ -3,14 +3,12 @@ NEXT_PUBLIC_TEST_NET_URL=http://localhost:3000 NEXT_PUBLIC_CRESCENDO_URL=http://localhost:3000 NEXT_PUBLIC_MIXPANEL_TOKEN="dev" NEXT_PUBLIC_TOKEN_AMOUNT_FLOW=1000.0 -NEXT_PUBLIC_TOKEN_AMOUNT_FUSD=10.0 NEXT_PUBLIC_SIGNER_ADDRESS=0xf8d6e0586b0a20c7 NEXT_PUBLIC_ACCESS_API_HOST=http://localhost:8888 NEXT_PUBLIC_HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 NEXT_PUBLIC_IS_LOCAL=true NEXT_PUBLIC_CONTRACT_FUNGIBLE_TOKEN=0xee82856bf20e2aa6 NEXT_PUBLIC_CONTRACT_FLOW_TOKEN=0x0ae53cb6e3f42a79 -NEXT_PUBLIC_CONTRACT_FUSD=0xf8d6e0586b0a20c7 NEXT_PUBLIC_GA_MEASUREMENT_ID= SIGNER_HASH_ALGO=SHA2_256 diff --git a/flow.json b/flow.json index e6fba10..f13d045 100644 --- a/flow.json +++ b/flow.json @@ -6,12 +6,6 @@ } }, "contracts": { - "FUSD": { - "source": "./cadence/contracts/FUSD.cdc", - "aliases": { - "testnet": "0xe223d8a629e49c68" - } - }, "FungibleToken": { "source": "./cadence/contracts/FungibleToken.cdc", "aliases": { @@ -41,7 +35,7 @@ }, "deployments": { "emulator": { - "emulator-account": ["FUSD"] + "emulator-account": [] } } } diff --git a/lib/constants.ts b/lib/constants.ts index 5d2022f..b706823 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -1,10 +1,9 @@ export type Networks = "testnet" | "crescendo" -export type TokenTypes = typeof FLOW_TYPE | typeof FUSD_TYPE +export type TokenTypes = typeof FLOW_TYPE export const TEST_NET = "testnet" export const CRESCENDO_NET = "crescendo" export const FLOW_TYPE = "FLOW" -export const FUSD_TYPE = "FUSD" export const NETWORK_STATUS_URL = "https://status.onflow.org/" export const GENERATE_KEYS_DOCS_URL = "https://developers.flow.com/tooling/flow-cli/generate-keys" @@ -23,8 +22,6 @@ export const ADDRESS_FORMAT_ERROR = export const ADDRESS_MISSING_ERROR = "Address is required." export const CREATE_ACCOUNT_ERROR = "Account creation has failed" export const FUND_ACCOUNT_ERROR = "Account funding has failed" -export const MISSING_FUSD_VAULT_ERROR = - "This account does not have an FUSD vault" export const INVALID_NETWORK_ADDRESS_ERROR = (network: Networks) => `This address is invalid for ${network}, please verify that it is correct` diff --git a/lib/fclConfig.ts b/lib/fclConfig.ts index b938d96..24475ac 100644 --- a/lib/fclConfig.ts +++ b/lib/fclConfig.ts @@ -10,4 +10,3 @@ config() // .put("challenge.handshake", publicConfig.walletDiscovery) .put("0xFUNGIBLETOKENADDRESS", publicConfig.contractFungibleToken) .put("0xFLOWTOKENADDRESS", publicConfig.contractFlowToken) - .put("0xFUSDADDRESS", publicConfig.contractFUSD) diff --git a/lib/flow/fund.ts b/lib/flow/fund.ts index 78b59a8..1d4f3e3 100644 --- a/lib/flow/fund.ts +++ b/lib/flow/fund.ts @@ -1,6 +1,6 @@ import * as fcl from "@onflow/fcl" import * as t from "@onflow/types" -import {FLOW_TYPE, FUSD_TYPE} from "../constants" +import {FLOW_TYPE} from "../constants" import publicConfig, {TOKEN_FUNDING_AMOUNTS} from "../publicConfig" import {sendTransaction} from "./send" @@ -34,33 +34,7 @@ transaction(address: Address, amount: UFix64) { } ` -const txFundAccountFUSD = ` -import FUSD from ${publicConfig.contractFUSD} -import FungibleToken from ${publicConfig.contractFungibleToken} - -transaction(address: Address, amount: UFix64) { - let tokenMinter: &FUSD.MinterProxy - let tokenReceiver: &{FungibleToken.Receiver} - - prepare(minterAccount: AuthAccount) { - self.tokenMinter = minterAccount - .borrow<&FUSD.MinterProxy>(from: FUSD.MinterProxyStoragePath) - ?? panic("No minter available") - - self.tokenReceiver = getAccount(address) - .getCapability(/public/fusdReceiver)! - .borrow<&{FungibleToken.Receiver}>() - ?? panic("Unable to borrow receiver reference") - } - - execute { - let mintedVault <- self.tokenMinter.mintTokens(amount: amount) - self.tokenReceiver.deposit(from: <-mintedVault) - } -} -` - -type TokenType = "FLOW" | "FUSD" +type TokenType = "FLOW" type Token = { tx: string amount: string @@ -69,7 +43,6 @@ type Tokens = Record export const tokens: Tokens = { FLOW: {tx: txFundAccountFLOW, amount: TOKEN_FUNDING_AMOUNTS[FLOW_TYPE]}, - FUSD: {tx: txFundAccountFUSD, amount: TOKEN_FUNDING_AMOUNTS[FUSD_TYPE]}, } export async function fundAccount( diff --git a/lib/initialTransactions.ts b/lib/initialTransactions.ts deleted file mode 100644 index 79271ca..0000000 --- a/lib/initialTransactions.ts +++ /dev/null @@ -1,60 +0,0 @@ -import fcl from "@onflow/fcl" -import dotenv from "dotenv" -dotenv.config() -import fs from "fs" -import path from "path" -import {getAuthorization} from "./flow/index" -import {getSignerKeyIndex} from "./keys" - -const txDepositFUSDMinter = fs.readFileSync( - path.resolve(__dirname, "../cadence/transactions/deposit_fusd_minter.cdc"), - "utf8" -) -const txSetupFUSDMinter = fs.readFileSync( - path.resolve(__dirname, "../cadence/transactions/setup_fusd_minter.cdc"), - "utf8" -) - -const signerAddress = process.env.NEXT_PUBLIC_SIGNER_ADDRESS -if (!signerAddress) throw "Missing NEXT_PUBLIC_SIGNER_ADDRESS" - -fcl.config().put("0xFUSDADDRESS", signerAddress) - -const runTransactions = async () => { - const keyIndex = await getSignerKeyIndex() - const authz = getAuthorization(keyIndex) - try { - await fcl.mutate({ - cadence: txSetupFUSDMinter, - limit: 50, - proposer: authz, - payer: authz, - authorizations: [authz], - }) - } catch (e: unknown) { - // eslint-disable-next-line no-console - console.log("txSetupFUSDMinter error") - // eslint-disable-next-line no-console - console.log(e) - } - - try { - await fcl.mutate({ - cadence: txDepositFUSDMinter, - limit: 50, - proposer: authz, - payer: authz, - authorizations: [authz], - args: (arg, t) => [arg(signerAddress, t.Address)], - }) - } catch (e: unknown) { - // eslint-disable-next-line no-console - console.log("txDepositFUSDMinter error") - // eslint-disable-next-line no-console - console.log(e) - } - - process.exit() -} - -runTransactions() diff --git a/lib/publicConfig.ts b/lib/publicConfig.ts index 3ddc612..f215300 100644 --- a/lib/publicConfig.ts +++ b/lib/publicConfig.ts @@ -12,9 +12,6 @@ if (!crescendoNetUrl) throw "Missing NEXT_PUBLIC_CRESCENDO_URL" const tokenAmountFlow = process.env.NEXT_PUBLIC_TOKEN_AMOUNT_FLOW if (!tokenAmountFlow) throw "Missing NEXT_PUBLIC_TOKEN_AMOUNT_FLOW" -const tokenAmountFusd = process.env.NEXT_PUBLIC_TOKEN_AMOUNT_FUSD -if (!tokenAmountFusd) throw "Missing NEXT_PUBLIC_TOKEN_AMOUNT_FUSD" - const signerAddress = process.env.NEXT_PUBLIC_SIGNER_ADDRESS if (!signerAddress) throw "Missing NEXT_PUBLIC_SIGNER_ADDRESS" @@ -24,9 +21,6 @@ if (!contractFungibleToken) throw "Missing NEXT_PUBLIC_CONTRACT_FUNGIBLE_TOKEN" const contractFlowToken = process.env.NEXT_PUBLIC_CONTRACT_FLOW_TOKEN if (!contractFlowToken) throw "Missing NEXT_PUBLIC_CONTRACT_FLOW_TOKEN" -const contractFUSD = process.env.NEXT_PUBLIC_CONTRACT_FUSD -if (!contractFUSD) throw "Missing NEXT_PUBLIC_CONTRACT_FUSD" - const walletDiscovery = process.env.NEXT_PUBLIC_WALLET_DISCOVERY // TODO: Integrate FCL wallets // if (!walletDiscovery) throw "Missing NEXT_PUBLIC_WALLET_DISCOVERY" @@ -36,12 +30,10 @@ export type PublicConfig = { testNetUrl: string crescendoNetUrl: string tokenAmountFlow: string - tokenAmountFusd: string hcaptchaSiteKey: string signerAddress: string contractFungibleToken: string contractFlowToken: string - contractFUSD: string accessAPIHost: string isLocal: boolean walletDiscovery?: string @@ -52,14 +44,12 @@ const publicConfig: PublicConfig = { testNetUrl, crescendoNetUrl, tokenAmountFlow, - tokenAmountFusd, hcaptchaSiteKey: process.env.NEXT_PUBLIC_HCAPTCHA_SITE_KEY || "10000000-ffff-ffff-ffff-000000000001", signerAddress, contractFungibleToken, contractFlowToken, - contractFUSD, accessAPIHost: process.env.NEXT_PUBLIC_ACCESS_API_HOST || "http://localhost:8888", isLocal: process.env.NEXT_PUBLIC_IS_LOCAL === "true" || false, @@ -68,7 +58,6 @@ const publicConfig: PublicConfig = { export const TOKEN_FUNDING_AMOUNTS: Record = { FLOW: publicConfig.tokenAmountFlow, - FUSD: publicConfig.tokenAmountFusd, } export default publicConfig diff --git a/package.json b/package.json index 1b677ab..88f9df9 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "db-seed": "node prisma/seed.mjs", "deploy": "npm run build && npm run db-migrate-deploy && npm run db-seed", "dev-deploy-contracts": "flow project deploy --network=emulator --update", - "initial-transactions": "ts-node lib/initialTransactions.ts --loader ts-node/esm", "lint": "eslint .", "lint-fix": "eslint . --fix", "tsc": "./node_modules/typescript/bin/tsc", diff --git a/pages/api/fund.ts b/pages/api/fund.ts index 8e3492f..6306884 100644 --- a/pages/api/fund.ts +++ b/pages/api/fund.ts @@ -1,11 +1,6 @@ import * as fcl from "@onflow/fcl" -import * as t from "@onflow/types" import {verify} from "hcaptcha" -import { - FUSD_TYPE, - INVALID_NETWORK_ADDRESS_ERROR, - MISSING_FUSD_VAULT_ERROR, -} from "lib/constants" +import {INVALID_NETWORK_ADDRESS_ERROR} from "lib/constants" import publicConfig from "lib/publicConfig" import {NextApiRequest, NextApiResponse} from "next" import config from "../../lib/config" @@ -16,21 +11,6 @@ import {verifyAPIKey} from "../../lib/common" import {ValidationError} from "yup" import {isValidNetworkAddress} from "lib/network" -const scriptCheckFUSDVault = ` - import FUSD from ${publicConfig.contractFUSD} - import FungibleToken from ${publicConfig.contractFungibleToken} - - pub fun main(address: Address): Bool { - let receiver = getAccount(address) - .getCapability<&FUSD.Vault{FungibleToken.Receiver}>(/public/fusdReceiver) - .check() - let balance = getAccount(address) - .getCapability<&FUSD.Vault{FungibleToken.Balance}>(/public/fusdBalance) - .check() - return receiver && balance - } -` - export default async function fund(req: NextApiRequest, res: NextApiResponse) { if (req.method === "POST") { const apiKey = req.headers["authorization"] @@ -56,26 +36,6 @@ export default async function fund(req: NextApiRequest, res: NextApiResponse) { .json({errors: [INVALID_NETWORK_ADDRESS_ERROR(publicConfig.network)]}) return } - - if (token === FUSD_TYPE) { - try { - const hasFUSDVault = await fcl - .send([ - fcl.script(scriptCheckFUSDVault), - fcl.args([fcl.arg(address, t.Address)]), - ]) - .then(fcl.decode) - - if (hasFUSDVault === false) { - res.status(400).json({errors: [MISSING_FUSD_VAULT_ERROR]}) - return - } - } catch { - res.status(400).json({errors: ["FUSD vault check failed"]}) - return - } - } - if (apiKey) { if (!verifyAPIKey(apiKey, config.apiKeys)) { res.status(401).json({errors: ["Invalid API key"]}) diff --git a/tsconfig.json b/tsconfig.json index 2a90beb..a9ae168 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,9 +33,6 @@ "node_modules" ], "ts-node": { - "include": [ - "lib/initialTransactions.ts" - ], "transpileOnly": true, "compilerOptions": { "module": "commonjs",