Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ This repository contains the smart contracts source code and markets configurati

ELYFI is adding real estate to the DEFI concept. This is the expansion of the current crypto-to-crypto applications as ELYFI will introduce traditional assets to the open financial market.

To implment the project, We use same DEFI concepts like Index Model, Kinked Rates Model and Tokenization of Aave protocol
- [The Elyfi documents](https://elyfi-docs.elysia.land/v/eng/), describing what is elyfi and how it works
- For using the elyfi, [The Elyfi dapp](https://elyfi.elysia.land/)

## Setup
## Community

- Create an file named .env and fill the next enviroment variables
You can join at the [telegram](https://t.me/elysia_official) or [kakaotalk](https://open.kakao.com/o/gUpSOwkb) for asking questions about protocol.

The forum for the elyfi will be completed soon. You can join and participate fully in the running of the elyfi protocol with the governance.

## Installation

- Set up .env file in the project directory and add the following environment variables:

```
# Secret key for deploying contracts
Expand All @@ -24,9 +31,23 @@ ETHERSCAN_API_KEY=

- Install dependencies with `yarn`

## Deploy

```
## Deploy local network
yarn deploy:local

## Deploy test network
yarn deploy:testnet

## Deploy main network
yarn deploy:mainnet
```

## Test

For convenience, we assume that waffle's wallets are mapped in order of [deployer, account1, account2, account3 ...]
You can run test with below scripts

```
# Run specific test code
Expand All @@ -46,16 +67,3 @@ yarn task createWithdraw --network ganache --asset ASSET_ADDRESS --pool POOL_ADD
yarn coverage
open ./coverage/index.html
```

## Deploy

```
## Deploy local network
yarn deploy:local

## Deploy test network
yarn deploy:testnet

## Deploy main network
yarn deploy:mainnet
```
35 changes: 35 additions & 0 deletions data/assetBond/mainnet/prugio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { BigNumber, ethers } from 'ethers';
import { tokenIdGenerator } from '../../../misc/assetBond/generator';
import AssetBondSettleData from '../../../test/types/AssetBondSettleData';
import { toRate } from '../../../test/utils/wadRayMath';
import { AssetBondIdData } from '../../../misc/assetBond/types';

// prugio
const id: AssetBondIdData = {
nonce: 1,
countryCode: 82,
collateralServiceProviderIdentificationNumber: 2201110189192,
collateralLatitude: 3750088,
collateralLatitudeSign: 1,
collateralLongitude: 12704064,
collateralLongitudeSign: 1,
collateralDetail: 2210,
collateralCategory: 2,
productNumber: 4,
};

export const data: AssetBondSettleData = {
...(<AssetBondSettleData>{}),
borrower: '0x1BcF42B1c9C1B9C1B0f0Aa071C4CF02b7C9b3598',
signer: '0x53c14659BF777b2D7e0A7fBa4d5DfF87D594495c',
tokenId: BigNumber.from(tokenIdGenerator(id)),
principal: ethers.utils.parseEther('262927'),
debtCeiling: ethers.utils.parseEther('338556'),
couponRate: toRate(0.1),
delinquencyRate: toRate(0.03),
loanDuration: BigNumber.from(87),
loanStartTimeYear: BigNumber.from(2021),
loanStartTimeMonth: BigNumber.from(7),
loanStartTimeDay: BigNumber.from(22),
ipfsHash: 'test',
};
12 changes: 3 additions & 9 deletions hardhat.config.tasks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dotenv/config';
import 'hardhat-typechain';
import '@typechain/hardhat';
import 'hardhat-deploy-ethers';
import 'hardhat-deploy';

Expand All @@ -9,6 +9,8 @@ import './tasks/local/underlyingAsset';
import './tasks/testnet/moneyPool';
import './tasks/testnet/underlyingAsset';
import './tasks/testnet/tokenizer';
import './tasks/mainnet/connector';
import './tasks/mainnet/tokenizer';

const testMnemonic = 'suggest mirror pulp horn goat wagon body long fortune dirt glass awesome';

Expand Down Expand Up @@ -43,14 +45,6 @@ const config: HardhatUserConfig = {
},
chainId: 42,
},
binanceTestnet: {
url: 'https://data-seed-prebsc-1-s1.binance.org:8545',
chainId: 97,
gasPrice: 20000000000,
accounts: {
mnemonic: process.env.TEST_MNEMONIC || testMnemonic,
},
},
ganache: {
url: 'http://0.0.0.0:8545',
},
Expand Down
22 changes: 1 addition & 21 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-solhint';
import '@nomiclabs/hardhat-etherscan';
import '@openzeppelin/hardhat-upgrades';
import 'hardhat-typechain';
import '@typechain/hardhat';
import 'hardhat-deploy-ethers';
import 'hardhat-deploy';
import 'hardhat-abi-exporter';
Expand Down Expand Up @@ -55,20 +55,6 @@ const config: HardhatUserConfig = {
},
chainId: 42,
},
binanceTestnet: {
url: 'https://data-seed-prebsc-1-s1.binance.org:8545',
chainId: 97,
gasPrice: 20000000000,
accounts: {
mnemonic: process.env.TEST_MNEMONIC || testMnemonic,
},
},
binanceMainnet: {
url: 'https://bsc-dataseed.binance.org/',
chainId: 56,
gasPrice: 20000000000,
accounts: [process.env.ADMIN || ''],
},
ganache: {
url: 'http://0.0.0.0:8545',
},
Expand All @@ -88,12 +74,6 @@ const config: HardhatUserConfig = {
showTimeSpent: true,
},
},
abiExporter: {
path: './data/abi',
clear: true,
flat: true,
spacing: 2,
},
};

export default config;
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@
},
"dependencies": {
"@typechain/ethers-v5": "^6.0.5",
"hardhat-typechain": "^0.3.5",
"ts-generator": "^0.1.1",
"typechain": "^4.0.3"
},
"devDependencies": {
"@cucumber/cucumber": "^7.1.0",
"@eth-optimism/smock": "^1.1.0",
"@eth-optimism/smock": "^1.1.9",
"@nomiclabs/ethereumjs-vm": "^4.2.2",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-etherscan": "^2.1.1",
"@nomiclabs/hardhat-solhint": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/contracts": "^4.0.0",
"@openzeppelin/contracts-upgradeable": "^4.0.0",
"@openzeppelin/hardhat-upgrades": "^1.6.0",
"@types/chai": "^4.2.17",
"@types/mocha": "^8.2.2",
"@types/node": "^15.0.1",
Expand Down
48 changes: 47 additions & 1 deletion tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,53 @@
**All tasks requires network name**

```
yarn task network:action --networkname --args
yarn task network:action --networkname network --argsname args
```

## Mainnet

#### Connector

```
mainnet:addCSP
# required
--address
(The address to add a role)

```

```
mainnet:addCouncil
# required
--address
(The address to add a role)

```

#### Tokenizer

```
mainnet:mintAssetBond
# required
--data
(AssetBond Data in data)

```

```
mainnet:settleAssetBond
# required
--data
(AssetBond Data in data)

```

```
mainnet:signAssetBond
# required
--data
(AssetBond Data in data)

```

## Testnet
Expand Down
2 changes: 1 addition & 1 deletion tasks/local/moneyPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { testAssetBond } from '../../test/utils/testData';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import assetBondIdData from '../../misc/assetBond/assetBondIdDataExample.json';
import { tokenIdGenerator } from '../../misc/assetBond/generator';
import { getDai, getElyfi, getElysia } from '../../utils/getDependencies';
import { getDai } from '../../utils/getDependencies';
import { Connector, ERC20Test, LToken, MoneyPool, Tokenizer } from '../../typechain';

interface Args {
Expand Down
54 changes: 54 additions & 0 deletions tasks/mainnet/connector.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { task } from 'hardhat/config';
import { getConnector } from '../../utils/getDeployedContracts';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { Connector } from '../../typechain';
import { getPoolAdmin } from '../../utils/getWallets';

interface Args {
address: string;
}

task('mainnet:addCSP', 'Add collateral service provider')
.addParam('address', 'The address for the role')
.setAction(async (args: Args, hre: HardhatRuntimeEnvironment) => {
const connector = (await getConnector(hre)) as Connector;
const poolAdmin = await getPoolAdmin(hre);

const isMoneyPoolAdmin = await connector.isMoneyPoolAdmin(poolAdmin.address);
if (!isMoneyPoolAdmin) {
console.log(`The caller is not the poolAdmin`);
return;
}

const isCollateralServiceProvider = await connector.isCollateralServiceProvider(args.address);
if (!isCollateralServiceProvider) {
const addCollateralServiceProviderTx = await connector
.connect(poolAdmin)
.addCollateralServiceProvider(args.address);
await addCollateralServiceProviderTx.wait();
console.log(`The pool admin add a collateral service provider role to ${args.address}`);
return;
}
console.log(`${args.address} has already collateral service provider role`);
});

task('mainnet:addCouncil', 'Add Council')
.addParam('address', 'The address for the role')
.setAction(async (args: Args, hre: HardhatRuntimeEnvironment) => {
const connector = (await getConnector(hre)) as Connector;
const poolAdmin = await getPoolAdmin(hre);

const isMoneyPoolAdmin = await connector.isMoneyPoolAdmin(poolAdmin.address);
if (!isMoneyPoolAdmin) {
console.log(`The caller is not the poolAdmin`);
return;
}

const isCouncil = await connector.isCouncil(args.address);
if (!isCouncil) {
const addCouncilTx = await connector.connect(poolAdmin).addCouncil(args.address);
await addCouncilTx.wait();
console.log(`The pool admin add a council role to ${args.address}`);
}
console.log(`${args.address} has already council role`);
});
Loading