Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTimepunk committed Jun 10, 2024
2 parents 67740e1 + f4a0ad3 commit 9553e2b
Show file tree
Hide file tree
Showing 29 changed files with 570 additions and 145 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ TENDERLY_PROJECT_SLUG=v1
TENDERLY_ACCOUNT_ID=superform
WALLET_TYPE=keystore // can be ledger
MNEMONIC_INDEX= // number you see in rabby -1
DEBUG_MODE=false
25 changes: 9 additions & 16 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ on:
branches: [main, develop]

env:
BSC_RPC_URL: ${{ secrets.BSC_RPC_URL }}
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL }}
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }}
ETHEREUM_RPC_URL: ${{ secrets.ETHEREUM_RPC_URL }}
POLYGON_RPC_URL: ${{ secrets.POLYGON_RPC_URL }}
AVALANCHE_RPC_URL: ${{ secrets.AVALANCHE_RPC_URL }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
FANTOM_RPC_URL: ${{ secrets.FANTOM_RPC_URL }}
BSC_RPC_URL: ${{ secrets.BSC_RPC_URL_VNET }}
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL_VNET }}
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL_VNET }}
ETHEREUM_RPC_URL: ${{ secrets.ETHEREUM_RPC_URL_VNET }}
POLYGON_RPC_URL: ${{ secrets.POLYGON_RPC_URL_VNET }}
AVALANCHE_RPC_URL: ${{ secrets.AVALANCHE_RPC_URL_VNET }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL_VNET }}
FANTOM_RPC_URL: ${{ secrets.FANTOM_RPC_URL_VNET }}
BSC_RPC_URL_QN: ${{ secrets.BSC_RPC_URL }}
ARBITRUM_RPC_URL_QN: ${{ secrets.ARBITRUM_RPC_URL }}
OPTIMISM_RPC_URL_QN: ${{ secrets.OPTIMISM_RPC_URL }}
Expand All @@ -32,6 +32,7 @@ env:
TENDERLY_ACCOUNT_ID: "superform" # your username or organization name
FOUNDRY_EXPORTS_OVERWRITE_LATEST: "true"
OWNER_ADDRESS: ${{ secrets.OWNER_ADDRESS }}
DEBUG_MODE: "false"

jobs:
build:
Expand All @@ -44,8 +45,6 @@ jobs:

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
with:
version: "nightly-fbad377ab26a432e48444cf324feee1195a30960"

- name: "Show the Foundry config"
run: "forge config"
Expand Down Expand Up @@ -81,8 +80,6 @@ jobs:

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
with:
version: "nightly-fbad377ab26a432e48444cf324feee1195a30960"

- name: "Restore the cached build"
uses: "actions/cache/restore@v4"
Expand Down Expand Up @@ -122,8 +119,6 @@ jobs:
submodules: "recursive"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
with:
version: "nightly-fbad377ab26a432e48444cf324feee1195a30960"

- name: "Restore the cached build"
uses: "actions/cache/restore@v4"
Expand Down Expand Up @@ -158,8 +153,6 @@ jobs:

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
with:
version: "nightly-fbad377ab26a432e48444cf324feee1195a30960"

- name: "Install Tenderly CLI"
run: curl https://raw.githubusercontent.com/Tenderly/tenderly-cli/master/scripts/install-linux.sh | sudo sh
Expand Down
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

# only export these env vars if ENVIRONMENT = local
ifeq ($(ENVIRONMENT), local)
export TENDERLY_ACCESS_KEY := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/TENDERLY_ACCESS_KEY/credential)
export ETHEREUM_RPC_URL = $(shell tenderly devnet spawn-rpc --project ${TENDERLY_PROJECT_SLUG} --template ethereum-devnet --account ${TENDERLY_ACCOUNT_ID} --access_key ${TENDERLY_ACCESS_KEY} --return-url)
export BSC_RPC_URL := $(shell tenderly devnet spawn-rpc --project ${TENDERLY_PROJECT_SLUG} --template bnb-devnet --account ${TENDERLY_ACCOUNT_ID} --access_key ${TENDERLY_ACCESS_KEY} --return-url)
export AVALANCHE_RPC_URL := $(shell tenderly devnet spawn-rpc --project ${TENDERLY_PROJECT_SLUG} --template avalanche-devnet --account ${TENDERLY_ACCOUNT_ID} --access_key ${TENDERLY_ACCESS_KEY} --return-url)
export POLYGON_RPC_URL := $(shell tenderly devnet spawn-rpc --project ${TENDERLY_PROJECT_SLUG} --template polygon-devnet --account ${TENDERLY_ACCOUNT_ID} --access_key ${TENDERLY_ACCESS_KEY} --return-url)
export ARBITRUM_RPC_URL := $(shell tenderly devnet spawn-rpc --project ${TENDERLY_PROJECT_SLUG} --template arbitrum-devnet --account ${TENDERLY_ACCOUNT_ID} --access_key ${TENDERLY_ACCESS_KEY} --return-url)
export OPTIMISM_RPC_URL := $(shell tenderly devnet spawn-rpc --project ${TENDERLY_PROJECT_SLUG} --template optimism-devnet --account ${TENDERLY_ACCOUNT_ID} --access_key ${TENDERLY_ACCESS_KEY} --return-url)
export BASE_RPC_URL := $(shell tenderly devnet spawn-rpc --project ${TENDERLY_PROJECT_SLUG} --template base-devnet --account ${TENDERLY_ACCOUNT_ID} --access_key ${TENDERLY_ACCESS_KEY} --return-url)
export FANTOM_RPC_URL := $(shell tenderly devnet spawn-rpc --project ${TENDERLY_PROJECT_SLUG} --template fantom-devnet --account ${TENDERLY_ACCOUNT_ID} --access_key ${TENDERLY_ACCESS_KEY} --return-url)
export ETHEREUM_RPC_URL = $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/ETHEREUM_RPC_URL_VNET/credential)
export BSC_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BSC_RPC_URL_VNET/credential)
export AVALANCHE_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/AVALANCHE_RPC_URL_VNET/credential)
export POLYGON_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/POLYGON_RPC_URL_VNET/credential)
export ARBITRUM_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/ARBITRUM_RPC_URL_VNET/credential)
export OPTIMISM_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/OPTIMISM_RPC_URL_VNET/credential)
export BASE_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BASE_RPC_URL_VNET/credential)
export FANTOM_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/FANTOM_RPC_URL_VNET/credential)
export ETHEREUM_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/ETHEREUM_RPC_URL/credential)
export BSC_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BSC_RPC_URL/credential)
export AVALANCHE_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/AVALANCHE_RPC_URL/credential)
Expand Down
2 changes: 1 addition & 1 deletion lib/forge-std
2 changes: 1 addition & 1 deletion lib/pigeon
2 changes: 0 additions & 2 deletions script/output/1/Ethereum-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
Expand All @@ -24,5 +23,4 @@
"WormholeARImplementation": "0x0000000000000000000000000000000000000000",
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0xce23bD7205bF2B543F6B4eeC00Add0C111FEFc3B"

}
4 changes: 2 additions & 2 deletions script/output/10/Optimism-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
Expand All @@ -23,5 +22,6 @@
"SuperformRouter": "0x0000000000000000000000000000000000000000",
"VaultClaimer": "0x0000000000000000000000000000000000000000",
"WormholeARImplementation": "0x0000000000000000000000000000000000000000",
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000"
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0xce23bD7205bF2B543F6B4eeC00Add0C111FEFc3B"
}
1 change: 0 additions & 1 deletion script/output/137/Polygon-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
Expand Down
4 changes: 2 additions & 2 deletions script/output/250/Fantom-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
Expand All @@ -23,5 +22,6 @@
"SuperformRouter": "0x0000000000000000000000000000000000000000",
"VaultClaimer": "0x0000000000000000000000000000000000000000",
"WormholeARImplementation": "0x0000000000000000000000000000000000000000",
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000"
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0xd6cea5c8853c3fb4bbd77ef5e924c4e647c03a94"
}
4 changes: 2 additions & 2 deletions script/output/42161/Arbitrum-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
Expand All @@ -23,5 +22,6 @@
"SuperformRouter": "0x0000000000000000000000000000000000000000",
"VaultClaimer": "0x0000000000000000000000000000000000000000",
"WormholeARImplementation": "0x0000000000000000000000000000000000000000",
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000"
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0xce23bD7205bF2B543F6B4eeC00Add0C111FEFc3B"
}
1 change: 0 additions & 1 deletion script/output/43114/Avalanche-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
Expand Down
4 changes: 2 additions & 2 deletions script/output/56/Binance-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
Expand All @@ -23,5 +22,6 @@
"SuperformRouter": "0x0000000000000000000000000000000000000000",
"VaultClaimer": "0x0000000000000000000000000000000000000000",
"WormholeARImplementation": "0x0000000000000000000000000000000000000000",
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000"
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0xce23bD7205bF2B543F6B4eeC00Add0C111FEFc3B"
}
4 changes: 2 additions & 2 deletions script/output/8453/Base-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0x0000000000000000000000000000000000000000",
"SocketOneInchValidator": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
Expand All @@ -23,5 +22,6 @@
"SuperformRouter": "0x0000000000000000000000000000000000000000",
"VaultClaimer": "0x0000000000000000000000000000000000000000",
"WormholeARImplementation": "0x0000000000000000000000000000000000000000",
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000"
"WormholeSRImplementation": "0x0000000000000000000000000000000000000000",
"RewardsDistributor": "0xce23bD7205bF2B543F6B4eeC00Add0C111FEFc3B"
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ contract RewardsDistributorHandler is StdInvariant, MerkleReader {
}
testUsers = testUsersMem;

console.log("Handler setup done!");
}

function randomUserIndex(uint256 seed, uint256 index, uint256 periodId) internal view returns (uint256) {
Expand Down
22 changes: 11 additions & 11 deletions test/invariant/vault-shares/handlers/VaultSharesHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ contract VaultSharesHandler is InvariantProtocolActions {
)
);

console.log("Handler setup done!");
if (DEBUG_MODE) console.log("Handler setup done!");
}

/*///////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -93,7 +93,7 @@ contract VaultSharesHandler is InvariantProtocolActions {
public
adjustTimestamp(timeJumpSeed)
{
console.log("## Handler call direct ##");
if (DEBUG_MODE) console.log("## Handler call direct ##");
HandlerLocalVars memory v;
v.AMBs = new uint8[](2);
v.AMBs[0] = 1;
Expand Down Expand Up @@ -123,18 +123,18 @@ contract VaultSharesHandler is InvariantProtocolActions {

vm.selectFork(FORKS[v.CHAIN_0]);
address input = getContract(v.CHAIN_0, UNDERLYING_TOKENS[inputToken]);
console.log("inputToken", input);
if (DEBUG_MODE) console.log("inputToken", input);
uint256 inputDecimals = MockERC20(input).decimals();
console.log("A");
if (DEBUG_MODE) console.log("A");
if (inputToken == 0) {
amount1 = bound(amount1, 1 * 10 ** inputDecimals, 1 * 10 ** (inputDecimals + 2));
console.log("amount1 dai", amount1);
if (DEBUG_MODE) console.log("amount1 dai", amount1);
} else if (inputToken == 1) {
amount1 = bound(amount1, 12 * 10 ** inputDecimals, 12 * 10 ** (inputDecimals + 2));
console.log("amount1 usdc", amount1);
if (DEBUG_MODE) console.log("amount1 usdc", amount1);
} else if (inputToken == 2) {
amount1 = bound(amount1, 11 * 10 ** inputDecimals, 11 * 10 ** (inputDecimals + 2));
console.log("amount1 weth", amount1);
if (DEBUG_MODE) console.log("amount1 weth", amount1);
}

v.amountsPerDst[0] = amount1;
Expand Down Expand Up @@ -204,7 +204,7 @@ contract VaultSharesHandler is InvariantProtocolActions {
public
adjustTimestamp(timeJumpSeed)
{
console.log("## Handler call xChain ##");
if (DEBUG_MODE) console.log("## Handler call xChain ##");

HandlerLocalVars memory v;
v.AMBs = new uint8[](2);
Expand Down Expand Up @@ -241,13 +241,13 @@ contract VaultSharesHandler is InvariantProtocolActions {
uint256 inputDecimals = MockERC20(getContract(v.CHAIN_0, UNDERLYING_TOKENS[inputToken])).decimals();
if (inputToken == 0) {
amount1 = bound(amount1, 1 * 10 ** inputDecimals, 1 * 10 ** (inputDecimals + 2));
console.log("amount1 dai", amount1);
if (DEBUG_MODE) console.log("amount1 dai", amount1);
} else if (inputToken == 1) {
amount1 = bound(amount1, 12 * 10 ** inputDecimals, 12 * 10 ** (inputDecimals + 2));
console.log("amount1 usdc", amount1);
if (DEBUG_MODE) console.log("amount1 usdc", amount1);
} else if (inputToken == 2) {
amount1 = bound(amount1, 11 * 10 ** inputDecimals, 11 * 10 ** (inputDecimals + 2));
console.log("amount1 weth", amount1);
if (DEBUG_MODE) console.log("amount1 weth", amount1);
}

v.amountsPerDst[0] = amount1;
Expand Down
1 change: 0 additions & 1 deletion test/mainnet/SmokeTest.Staging.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ contract SmokeTestStaging is MainnetBaseSetup {
uint64 chainId = TARGET_DEPLOYMENT_CHAINS[i];
vm.selectFork(FORKS[chainId]);
paymentHelper = PaymentHelper(getContract(chainId, "PaymentHelper"));
console.log("--Checking chain id ", chainId);

for (uint256 j; j < TARGET_DEPLOYMENT_CHAINS.length; ++j) {
assertEq(
Expand Down
1 change: 0 additions & 1 deletion test/mainnet/SmokeTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ contract SmokeTest is MainnetBaseSetup {
uint64 chainId = TARGET_DEPLOYMENT_CHAINS[i];
vm.selectFork(FORKS[chainId]);
paymentHelper = PaymentHelper(getContract(chainId, "PaymentHelper"));
console.log("--Checking chain id ", chainId);

for (uint256 j; j < TARGET_DEPLOYMENT_CHAINS.length; ++j) {
assertEq(
Expand Down
12 changes: 0 additions & 12 deletions test/mocks/LiFiMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ contract LiFiMock is Test {

v.amountOut = (amount_ * uint256(10_000 - v.slippage)) / 10_000;

console.log("amount pre-bridge", v.amountOut);

_sendOutputTokenToReceiver(data_, inputToken_, receiver_, v.amountOut, v.prevForkId, v.toForkId);

vm.selectFork(v.prevForkId);
Expand Down Expand Up @@ -138,8 +136,6 @@ contract LiFiMock is Test {
((amountOut_ * USDPerUnderlyingToken) * 10 ** (decimal2 - decimal1)) / USDPerUnderlyingTokenDst;
}

console.log("amount post-bridge", finalAmount);

if (outputToken != NATIVE) {
deal(outputToken, receiver_, MockERC20(outputToken).balanceOf(receiver_) + finalAmount);
} else {
Expand Down Expand Up @@ -177,20 +173,12 @@ contract LiFiMock is Test {
uint256 decimal1 = inputToken_ == NATIVE ? 18 : MockERC20(inputToken_).decimals();
uint256 decimal2 = outputToken_ == NATIVE ? 18 : MockERC20(outputToken_).decimals();

console.log("inputToken", inputToken_);
console.log("outputToken", outputToken_);
console.log("decimal1", decimal1);
console.log("decimal2", decimal2);
console.log("USDPerExternalToken", USDPerExternalToken);
console.log("USDPerUnderlyingToken", USDPerUnderlyingToken);
console.log("amount pre-swap", amount_);
/// @dev the results of this amount if there is a bridge are effectively ignored
if (decimal1 > decimal2) {
amount_ = (amount_ * USDPerExternalToken) / (USDPerUnderlyingToken * 10 ** (decimal1 - decimal2));
} else {
amount_ = (amount_ * USDPerExternalToken) * 10 ** (decimal2 - decimal1) / USDPerUnderlyingToken;
}
console.log("amount post-swap", amount_);
/// @dev swap slippage if any, is applied in ProtocolActions._stage1_buildReqData() for direct
/// actions and in ProtocolActions._buildLiqBridgeTxDataDstSwap() for dstSwaps.
/// @dev Could allocate swap slippage share separately like for ProtocolActions.MULTI_TX_SLIPPAGE_SHARE
Expand Down
Loading

0 comments on commit 9553e2b

Please sign in to comment.