Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
[submodule "lib/FlowALP"]
path = lib/FlowALP
url = git@github.com:onflow/FlowALP.git
[submodule "solidity/lib/v2-core"]
path = solidity/lib/v2-core
url = https://github.com/uniswap/v2-core
[submodule "solidity/lib/v2-periphery"]
path = solidity/lib/v2-periphery
url = https://github.com/uniswap/v2-periphery
215 changes: 199 additions & 16 deletions cadence/tests/test_helpers.cdc

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions cadence/tests/transactions/evm_run_raw.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import "EVM"

/// Runs a raw, signed EVM transaction (RLP bytes) inside Flow EVM.
transaction(rawHex: String, coinbaseHex: String) {
prepare(_: auth(BorrowValue) &Account) {
// 1) Decode raw tx
let rawTx: [UInt8] = rawHex.decodeHex()

// 2) Parse coinbase (fee receiver) as EVM address
// Use the EVM address of a CadenceOwnedAccount you control,
// or "000...0000" to send fees to the zero address (not recommended).
let coinbase: EVM.EVMAddress = EVM.addressFromString(coinbaseHex)

// 3) Execute (fails early if status is unknown/invalid)
let res: EVM.Result = EVM.mustRun(tx: rawTx, coinbase: coinbase)

log("⛽ gasUsed: ".concat(res.gasUsed.toString()))
log("📦 status: ".concat(res.status.rawValue.toString())) // 0=unknown,1=invalid,2=failed,3=successful
log("❗ errorCode: ".concat(res.errorCode.toString()))
if res.errorMessage.length > 0 {
log("📝 errorMessage: ".concat(res.errorMessage))
}

// Returned data (e.g. contract code on deploy, or revert data)
if res.data.length > 0 {
log("🔙 returnedData (hex): ".concat(String.encodeHex(res.data)))
}

// If this tx deployed a contract, show its address
if let deployed = res.deployedContract {
log("🏠 deployed at: ".concat(deployed.toString()))
}
}
}
68 changes: 67 additions & 1 deletion flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,30 @@
"resourceID": "projects/dl-flow-devex-staging/locations/us-central1/keyRings/tidal-keyring/cryptoKeys/tidal_admin_pk/cryptoKeyVersions/1"
}
},
"mainnet-admin": {
"address": "b1d63873c3cc9f79",
"key": {
"type": "google-kms",
"hashAlgorithm": "SHA2_256",
"resourceID": "projects/dl-flow-devex-production/locations/us-central1/keyRings/tidal-keyring/cryptoKeys/tidal_admin_pk/cryptoKeyVersions/1"
}
},
"mainnet-flow-alp-deployer": {
"address": "6b00ff876c299c61",
"key": {
"type": "google-kms",
"hashAlgorithm": "SHA2_256",
"resourceID": "projects/dl-flow-devex-production/locations/us-central1/keyRings/tidal-keyring/cryptoKeys/tidal_admin_pk/cryptoKeyVersions/1"
}
},
"mainnet-uniswapV3-connectors-deployer": {
"address": "a7825d405ac89518",
"key": {
"type": "google-kms",
"hashAlgorithm": "SHA2_256",
"resourceID": "projects/dl-flow-devex-production/locations/us-central1/keyRings/tidal-keyring/cryptoKeys/tidal_admin_pk/cryptoKeyVersions/1"
}
},
"tidal": {
"address": "045a1763c93006ca",
"key": {
Expand Down Expand Up @@ -1009,6 +1033,48 @@
"EVMAbiHelpers",
"UniswapV3SwapConnectors"
]
}
},
"mainnet": {
"mainnet-admin": [
{
"name": "MockOracle",
"args": [
{
"value": "A.6b00ff876c299c61.MOET.Vault",
"type": "String"
}
]
},
"MockSwapper",
"FlowVaultsAutoBalancers",
"FlowVaultsClosedBeta",
"FlowVaults",
{
"name": "FlowVaultsStrategies",
"args": [
{
"value": "0xca6d7Bb03334bBf135902e1d919a5feccb461632",
"type": "String"
},
{
"value": "0xeEDC6Ff75e1b10B903D9013c358e446a73d35341",
"type": "String"
},
{
"value": "0x370A8DF17742867a44e56223EC20D82092242C85",
"type": "String"
},
{
"value": "0xYIELDTOKEN_ERC4626",
"type": "String"
}
]
}
],
"mainnet-uniswapV3-connectors-deployer": [
"EVMAbiHelpers",
"UniswapV3SwapConnectors"
]
}
}
}
4 changes: 2 additions & 2 deletions local/punchswap/punchswap.env
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ TOKENS_OWNER=0xC31A5268a1d311d992D637E8cE925bfdcCEB4310
USDC_MINT=2000000000000
WBTC_MINT=100000000000000

USDC_ADDR=0xaCCF0c4EeD4438Ad31Cd340548f4211a465B6528
WBTC_ADDR=0x374BF2423c6b67694c068C3519b3eD14d3B0C5d1
USDC_ADDR=0x102A7ed67858cF757CBBeA3390eaB72fcc60237E
WBTC_ADDR=0x6Ce75363856e46B42bf0c933E01A4Eec17eE963B

# how much to fund the helper (base units)
# USDC_FUND=600000000 # 600k * 1e6
Expand Down
4 changes: 2 additions & 2 deletions local/setup_bridged_tokens.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
source ./local/punchswap/punchswap.env

echo "bridge USDC to Cadence"
flow transactions send ./lib/flow-evm-bridge/cadence/transactions/bridge/onboarding/onboard_by_evm_address.cdc 0xaCCF0c4EeD4438Ad31Cd340548f4211a465B6528 --gas-limit 9999 --signer tidal
flow transactions send ./lib/flow-evm-bridge/cadence/transactions/bridge/onboarding/onboard_by_evm_address.cdc $USDC_ADDR --gas-limit 9999 --signer tidal

echo "set USDC token price"
flow transactions send ./cadence/transactions/mocks/oracle/set_price.cdc 'A.f8d6e0586b0a20c7.EVMVMBridgedToken_accf0c4eed4438ad31cd340548f4211a465b6528.Vault' 1.0 --signer tidal

echo "bridge WBTC to Cadence"
flow transactions send ./lib/flow-evm-bridge/cadence/transactions/bridge/onboarding/onboard_by_evm_address.cdc 0x374BF2423c6b67694c068C3519b3eD14d3B0C5d1 --gas-limit 9999 --signer tidal
flow transactions send ./lib/flow-evm-bridge/cadence/transactions/bridge/onboarding/onboard_by_evm_address.cdc $WBTC_ADDR --gas-limit 9999 --signer tidal

# this step is done earlier
# echo "bridge MOET to EVM"
Expand Down
26 changes: 26 additions & 0 deletions solidity/lib/EmulatorNonfungibleTokenPositionDescriptor.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// copy to ./punch-swap-v3-contracts/src/periphery/

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma abicoder v2;

import '../core/interfaces/IPunchSwapV3Pool.sol';
import '@uniswap/lib/contracts/libraries/SafeERC20Namer.sol';

import './libraries/ChainId.sol';
import './interfaces/INonfungiblePositionManager.sol';
import './interfaces/INonfungibleTokenPositionDescriptor.sol';
import './interfaces/IERC20Metadata.sol';
import './libraries/PoolAddress.sol';
import './libraries/NFTDescriptor.sol';
import './libraries/TokenRatioSortOrder.sol';
import './NonfungibleTokenPositionDescriptorBase.sol';

/// @title Describes NFT token positions
/// @notice Produces a string containing the data URI for a JSON metadata string
contract EmulatorNonfungibleTokenPositionDescriptor is NonfungibleTokenPositionDescriptorBase {
constructor(address WFLOW_ADDRESS, bytes32 _nativeCurrencyLabelBytes) NonfungibleTokenPositionDescriptorBase(WFLOW_ADDRESS, _nativeCurrencyLabelBytes) {}

function _initializePriorities() override internal {
}
}
1 change: 1 addition & 0 deletions solidity/lib/v2-core
Submodule v2-core added at ee547b
1 change: 1 addition & 0 deletions solidity/lib/v2-periphery
Submodule v2-periphery added at 0335e8