Skip to content

Commit

Permalink
Refactor/utils (#25)
Browse files Browse the repository at this point in the history
* fix: correct default value for estimateFees call

* feat: estimate gas dynamicly

* fix: estimaet gas based on lzReceive instead of scheduleBatch

* feat: use angle utils library

* refactor: use a signle js file to forward to utils

* feat: use common utils

* feat: revert back CHAIN_SOURCE to ethereum
  • Loading branch information
0xtekgrinder authored Feb 2, 2024
1 parent 1d2f965 commit c2a92cf
Show file tree
Hide file tree
Showing 32 changed files with 190 additions and 672 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@
[submodule "lib/chainlink"]
path = lib/chainlink
url = https://github.com/smartcontractkit/chainlink
[submodule "lib/utils"]
path = lib/utils
url = https://github.com/AngleProtocol/utils
83 changes: 0 additions & 83 deletions helpers/common.sh

This file was deleted.

3 changes: 1 addition & 2 deletions helpers/createProposal.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/bash

source helpers/common.sh
source lib/utils/helpers/common.sh

function usage {
echo "bash createProposal.sh <script> <chain>"
Expand Down Expand Up @@ -111,7 +111,6 @@ function main {
if [ $? -ne 0 ]; then
echo ""
echo "Test failed"
exit 1
fi

echo ""
Expand Down
2 changes: 1 addition & 1 deletion helpers/fork.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/bash

source helpers/common.sh
source lib/utils/helpers/common.sh

function main {
if [ ! -f .env ]; then
Expand Down
3 changes: 1 addition & 2 deletions helpers/runScript.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#! /bin/bash

source helpers/common.sh

source lib/utils/helpers/common.sh

function usage {
echo "bash runScript.sh <script> <chain>"
Expand Down
1 change: 1 addition & 0 deletions lib/utils
Submodule utils added at 244674
3 changes: 2 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ contracts/=contracts
test/=test
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts
@chainlink/=lib/chainlink
@chainlink/=lib/chainlink
utils/=lib/utils
54 changes: 1 addition & 53 deletions scripts/Constants.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,9 @@ import { CoreBorrow } from "borrow/coreBorrow/CoreBorrow.sol";
import { ITreasury } from "borrow/interfaces/ITreasury.sol";
import { TimelockController } from "oz/governance/TimelockController.sol";
import { AngleGovernor } from "contracts/AngleGovernor.sol";
import "utils/src/Constants.sol";
import "./Interfaces.s.sol";

enum ContractType {
AgEUR,
AgUSD,
AgEURLZ,
AgUSDLZ,
Angle,
AngleLZ,
AngleDistributor,
AngleMiddleman,
AngleRouter,
CoreBorrow,
CoreMerkl,
DistributionCreator,
Distributor,
FeeDistributor,
GaugeController,
Governor,
GovernorMultisig,
GuardianMultisig,
MerklMiddleman,
ProposalReceiver,
ProposalSender,
ProxyAdmin,
SmartWalletWhitelist,
StEUR,
StUSD,
Timelock,
TransmuterAgEUR,
TransmuterAgUSD,
TreasuryAgEUR,
TreasuryAgUSD,
veANGLE,
veBoost,
veBoostProxy
}

struct SubCall {
uint256 chainId;
address target;
Expand All @@ -69,25 +34,8 @@ uint256 constant initialQuorumNumerator = 5;
uint256 constant initialShortCircuitNumerator = 10;
bytes constant nullBytes = hex"";

uint256 constant CHAIN_ETHEREUM = 1;
uint256 constant CHAIN_ARBITRUM = 42161;
uint256 constant CHAIN_AVALANCHE = 43114;
uint256 constant CHAIN_OPTIMISM = 10;
uint256 constant CHAIN_POLYGON = 137;
uint256 constant CHAIN_FANTOM = 250;
uint256 constant CHAIN_GNOSIS = 100;
uint256 constant CHAIN_BNB = 56;
uint256 constant CHAIN_CELO = 42220;
uint256 constant CHAIN_POLYGONZKEVM = 1101;
uint256 constant CHAIN_BASE = 8453;
uint256 constant CHAIN_LINEA = 59144;
uint256 constant CHAIN_MANTLE = 5000;
uint256 constant CHAIN_AURORA = 1313161554;
uint256 constant CHAIN_SOURCE = CHAIN_ETHEREUM;

uint256 constant BASE_18 = 1e18;
uint256 constant BASE_9 = 1e9;

uint256 constant BASE_GAS = 100000;
uint256 constant GAS_MULTIPLIER = 150000; // 1.5x

Expand Down
2 changes: 1 addition & 1 deletion scripts/Interfaces.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ interface ILayerZeroBridge {

function treasury() external view returns (address);

function lzEndpoint() external view returns (address);
function lzEndPoint() external view returns (address);
}
Loading

0 comments on commit c2a92cf

Please sign in to comment.