Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
implemented enzyme finance vaults on ethereum (#141)
Browse files Browse the repository at this point in the history
* implemented enzyme finance vaults on ethereum

* updated vault prices calculation prioritizing on chain data over data coming from the Graph

* added description and fixed name of Enzyme Finance. Updated app name casing in the create-app command

Co-authored-by: William Poulin <[email protected]>
  • Loading branch information
wpoulin and William Poulin authored Apr 14, 2022
1 parent c697960 commit 761408b
Show file tree
Hide file tree
Showing 14 changed files with 2,158 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cli/commands/create-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class CreateApp extends Command {
],
},
]);

const supportedNetworksRaw: string[] = response.network;
createFolder(`./src/apps/${appName}`);
createFolder(`./src/apps/${appName}/assets`);
Expand Down Expand Up @@ -89,7 +90,7 @@ function formatNetworks(userInputNetworks: string[]): string[] {
}

function generateDefinitionFile(appName: string, supportedNetworks: string) {
const appId = strings.kebabCase(appName);
const appId = strings.titleCase(appName, true);
const appDefinitionName = `${strings.upperCase(appName)}_DEFINITION`;
const appClassName = strings.titleCase(appName);

Expand All @@ -102,6 +103,7 @@ function generateDefinitionFile(appName: string, supportedNetworks: string) {
export const ${appDefinitionName} = {
id: '${appName}',
name: '${appId}',
// Don't forget to add a description for the app
description: '',
groups: {
camelCase: { id: 'kebab-case', type: GroupType.TOKEN },
Expand Down
1 change: 1 addition & 0 deletions cli/imports/apps-definition-registry.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable unused-imports/no-unused-imports-ts */
export { default as UNAGII_DEFINITION } from '../../src/apps/unagii/unagii.definition';
export { default as ENZYME_FINANCE_DEFINITION } from '../../src/apps/enzyme-finance/enzyme-finance.definition';
5 changes: 3 additions & 2 deletions cli/strings/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import _ from 'lodash';
* @param s given string
* @returns TitleCased string
*/
const titleCase = (s: string) => {
return _.startCase(s).replace(/\s/g, '');
const titleCase = (s: string, spaceSeparator = false) => {
const separator = spaceSeparator === true ? ' ' : '';
return _.startCase(s).replace(/\s/g, separator);
};

/**
Expand Down
328 changes: 328 additions & 0 deletions src/apps/enzyme-finance/contracts/abis/enzyme-finance-vault.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
[
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "address", "name": "prevAccessor", "type": "address" },
{ "indexed": false, "internalType": "address", "name": "nextAccessor", "type": "address" }
],
"name": "AccessorSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "spender", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "asset", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "target", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "AssetWithdrawn",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "address", "name": "prevMigrator", "type": "address" },
{ "indexed": false, "internalType": "address", "name": "nextMigrator", "type": "address" }
],
"name": "MigratorSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "address", "name": "prevOwner", "type": "address" },
{ "indexed": false, "internalType": "address", "name": "nextOwner", "type": "address" }
],
"name": "OwnerSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "address", "name": "asset", "type": "address" }],
"name": "TrackedAssetAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "address", "name": "asset", "type": "address" }],
"name": "TrackedAssetRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "from", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "address", "name": "prevVaultLib", "type": "address" },
{ "indexed": false, "internalType": "address", "name": "nextVaultLib", "type": "address" }
],
"name": "VaultLibSet",
"type": "event"
},
{
"inputs": [{ "internalType": "address", "name": "_asset", "type": "address" }],
"name": "addTrackedAsset",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_owner", "type": "address" },
{ "internalType": "address", "name": "_spender", "type": "address" }
],
"name": "allowance",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "uint256", "name": "", "type": "uint256" }
],
"name": "approve",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_asset", "type": "address" },
{ "internalType": "address", "name": "_target", "type": "address" },
{ "internalType": "uint256", "name": "_amount", "type": "uint256" }
],
"name": "approveAssetSpender",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_account", "type": "address" }],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_target", "type": "address" },
{ "internalType": "uint256", "name": "_amount", "type": "uint256" }
],
"name": "burnShares",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_contract", "type": "address" },
{ "internalType": "bytes", "name": "_callData", "type": "bytes" }
],
"name": "callOnContract",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_who", "type": "address" }],
"name": "canMigrate",
"outputs": [{ "internalType": "bool", "name": "canMigrate_", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "getAccessor",
"outputs": [{ "internalType": "address", "name": "accessor_", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCreator",
"outputs": [{ "internalType": "address", "name": "creator_", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getMigrator",
"outputs": [{ "internalType": "address", "name": "migrator_", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getOwner",
"outputs": [{ "internalType": "address", "name": "owner_", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getTrackedAssets",
"outputs": [{ "internalType": "address[]", "name": "trackedAssets_", "type": "address[]" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getVaultLib",
"outputs": [{ "internalType": "address", "name": "vaultLib_", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_owner", "type": "address" },
{ "internalType": "address", "name": "_accessor", "type": "address" },
{ "internalType": "string", "name": "_fundName", "type": "string" }
],
"name": "init",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_asset", "type": "address" }],
"name": "isTrackedAsset",
"outputs": [{ "internalType": "bool", "name": "isTrackedAsset_", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_target", "type": "address" },
{ "internalType": "uint256", "name": "_amount", "type": "uint256" }
],
"name": "mintShares",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "proxiableUUID",
"outputs": [{ "internalType": "bytes32", "name": "uuid_", "type": "bytes32" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_asset", "type": "address" }],
"name": "removeTrackedAsset",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_nextAccessor", "type": "address" }],
"name": "setAccessor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_nextMigrator", "type": "address" }],
"name": "setMigrator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_nextVaultLib", "type": "address" }],
"name": "setVaultLib",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [{ "internalType": "string", "name": "symbol_", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "uint256", "name": "", "type": "uint256" }
],
"name": "transfer",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "uint256", "name": "", "type": "uint256" }
],
"name": "transferFrom",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_from", "type": "address" },
{ "internalType": "address", "name": "_to", "type": "address" },
{ "internalType": "uint256", "name": "_amount", "type": "uint256" }
],
"name": "transferShares",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_asset", "type": "address" },
{ "internalType": "address", "name": "_target", "type": "address" },
{ "internalType": "uint256", "name": "_amount", "type": "uint256" }
],
"name": "withdrawAssetTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
Loading

0 comments on commit 761408b

Please sign in to comment.