Skip to content

Commit

Permalink
Squashed
Browse files Browse the repository at this point in the history
  • Loading branch information
aleem-ahmed committed Jul 15, 2024
1 parent 366b4df commit 9bebd34
Show file tree
Hide file tree
Showing 87 changed files with 9,516 additions and 17,188 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ build/Release
# Dependency directories
node_modules/
jspm_packages/
package-lock.json

# TypeScript v1 declaration files
typings/
Expand Down Expand Up @@ -126,4 +127,4 @@ typechain-types
cache
artifacts

example-arguments.ts
example-arguments.ts
1 change: 1 addition & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"rules": {
"avoid-low-level-calls": "off",
"compiler-version": ["error", "^0.8.18"],
"custom-errors": "off",
"func-name-mixedcase": "off",
"func-order": "off",
"indent": ["error", 4],
Expand Down
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# YieldSync V1 Vaults
# Yield Sync V1 EMP

EMP (Asset Management Protocol) is a protocol that allows automated allocations for managing assets. Whether it be for yield optimization or public goods funding, this protocol allows developers to create the tool they need to direct funds accordingly.

## Note

This protocol complies to the [yield-sync/specifications](https://github.com/yield-sync/specifications/tree/master/v1-amp)

## Get Started

Expand Down Expand Up @@ -54,25 +60,14 @@ YIELD_SYNC_V1_B_TRANSFER_REQUEST_PROTOCOL_OP_GOERLI=
YIELD_SYNC_V1_B_TRANSFER_REQUEST_PROTOCOL_SEPOLIA=
```

## Smart Contract Layout & Ordering

### Variables

1. Type (`address`, `bytes`, etc.)
2. Visibility (`public` | `private` | `internal` | `external`)
3. Array
## Note

### Mapping
Strategies must be very simple. They should be able to be changed. Tokens utilized must be immutable.

1. Visibility (`public` | `private` | `internal` | `external`)
2. Type (`address`, `bytes`, etc.)
3. Struct
The ETH value should handle the decimal of the erc 20

### Function
### How to check contract size

1. Interface Implementation
2. Visibility (`public` | `private` | `internal` | `external`)
3. State Interaction (`pure` | `view`)
4. Restriction (`Access Control` etc. DEFAULT_ADMIN_ROLE first)
5. Complexity (Calls to inherited functions, external functions, change state)
6. Alphabetical
```sol
npx hardhat size-contracts
```
47 changes: 47 additions & 0 deletions const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const { ethers } = require("hardhat");


export const D_18 = ethers.utils.parseUnits('1', 18);

export const ERROR = {
REGISTRY: {
ARRAY_UTILITY_NOT_SET: "!(yieldSyncV1EMPArrayUtility != address(0))",
EMP_UTILITY_NOT_SET: "!(yieldSyncV1EMPUtility != address(0))",
EMP_STRATEGY_UTILITY_NOT_SET: "!(yieldSyncV1EMPStrategyUtility != address(0))",
NOT_EMP_DEPLOYER: "!(yieldSyncV1EMPDeployer == msg.sender)",
NOT_STRATEGY_DEPLOYER: "!(yieldSyncV1EMPStrategyDeployer == msg.sender)",
ERC20_ADDRESS_ZERO: "!(_eRC20 != address(0))",
ETH_VALUE_FEED_ADDRESS_ZERO: "!(_yieldSyncV1EMPERC20ETHValueFeed != address(0))",
},
EMP: {
DEPOSIT_NOT_OPEN: "!utilizedERC20DepositOpen",
INVALID_ALLOCATION: "!(utilizedYieldSyncV1EMPStrategyAllocationTotal == ONE_HUNDRED_PERCENT)",
INVALID_BALANCE: "!(balanceOf(msg.sender) >= _eRC20Amount)",
INVALID_UTILIZED_ERC20_AMOUNT_LENGTH: "!(utilizedYieldSyncV1EMPStrategy.length == _yieldSyncV1EMPStrategyUtilizedERC20Amount.length)",
INVALID_STRATEGY_ERC20_AMOUNTS_LENGTH: "!(_yieldSyncV1EMPStrategyERC20Amount.length == _utilizedYieldSyncV1EMPStrategy.length)",
INVALID_UTILIZED_ERC20_LENGTH: "!(_utilizedERC20Amount.length == utilizedERC20.length)",
WITHDRAW_NOT_OPEN: "!utilizedERC20WithdrawOpen",
},
STRATEGY: {
DEPOSIT_NOT_OPEN: "!utilizedERC20DepositOpen",
INTERACTOR_NOT_SET: "!(address(iYieldSyncV1EMPStrategyInteractor) != address(0))",
INVALID_ALLOCATION: "!(utilizedERC20AllocationTotal == ONE_HUNDRED_PERCENT)",
INVALID_AMOUNT_LENGTH: "!(_utilizedERC20.length == _utilizedERC20Amount.length)",
INVALID_BALANCE: "!(balanceOf(msg.sender) >= _eRC20Amount)",
INVALID_UTILIZED_ERC20_AMOUNT: "!(_utilizedERC20_utilizationERC20[_utilizedERC20[i]].allocation == utilizedERC20AmountAllocationActual)",
UTILIZED_ERC20_AMOUNT_NOT_ZERO: "!(_utilizedERC20Amount[i] == 0)",
UTILIZED_ERC20_TRANSFERS_OPEN: "!(!utilizedERC20DepositOpen && !utilizedERC20WithdrawOpen)",
WITHDRAW_NOT_OPEN: "!utilizedERC20WithdrawOpen",
ERC20_NO_ETH_VALUE_FEED_AVAILABLE: "!(I_YIELD_SYNC_V1_EMP_REGISTRY.eRC20_yieldSyncV1EMPERC20ETHValueFeed(__utilizedERC20[i]) != address(0))",
},
NOT_COMPUTED: "!computed",
NOT_AUTHORIZED: "!authorized",
}

export const PERCENT = {
HUNDRED: ethers.utils.parseUnits('1', 18),
FIFTY: ethers.utils.parseUnits('.5', 18),
TWENTY_FIVE: ethers.utils.parseUnits('.25', 18),
SEVENTY_FIVE: ethers.utils.parseUnits('.75', 18),
ZERO: ethers.utils.parseUnits('0', 18),
}
223 changes: 0 additions & 223 deletions contracts/YieldSyncV1ASignatureProtocol.sol

This file was deleted.

Loading

0 comments on commit 9bebd34

Please sign in to comment.