Skip to content

feature: Reimplement lib transfers and an helper to unwrap token #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
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
62 changes: 0 additions & 62 deletions .github/workflows/create-PR-deploy-to-release.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/create-PR-implement-to-feature.yml

This file was deleted.

84 changes: 0 additions & 84 deletions .github/workflows/create-PR-release-to-feature.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/create-PR-release-to-network.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: stable

- name: Update package
run: forge soldeer update
Expand Down
6 changes: 4 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ ffi = true

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

solc = '0.8.23'
evm_version = 'istanbul'
solc = '0.8.27'
evm_version = 'cancun'
use_literal_content = true
extra_output = ["devdoc", "userdoc", "storagelayout"]
fs_permissions = [{ access = "read-write", path = "./" }]
allow_internal_expect_revert = true
optimize = true
optimizer_runs = 200

[fmt]
tab_width = 2
Expand Down
13 changes: 13 additions & 0 deletions src/transfers/LibNativeTransfer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,21 @@ import { LibErrorHandler } from "../LibErrorHandler.sol";
* @title NativeTransferHelper
*/
library LibNativeTransfer {
/*
* @dev Used in `safeTransfer` to send native token only. It is enough for performing storage reads and writes.
* See https://github.com/Vectorized/solady/blob/main/src/utils/SafeTransferLib.sol
*/
uint256 internal constant DEFAULT_GAS_AMOUNT = 10_000;

using LibErrorHandler for bool;

/**
* @dev Transfers Native Coin with fixed gas amount (for almost use cases).
*/
function safeTransfer(address to, uint256 value) internal {
transfer(to, value, DEFAULT_GAS_AMOUNT);
}

/**
* @dev Transfers Native Coin and wraps result for the method caller to a recipient.
*/
Expand Down
Loading