2.1.0 • Published 5 months ago

@patronumlabs/force-transfer v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@patronumlabs/force-transfer

License: MIT

This package provides a library contract that helps to force transfer native tokens to contracts that cannot receive value, that do not have the receive function. The package includes the constants related to the ForceTransfer Singleton.

Rationale

The Force transfer contract is a singleton that allows to force the transfer of a native token to addresses without relying on solidity's call feature and uses self-destruct to force send the value.

ForceTransferLib is a contract to be used by other developers in development to integrate the logic of force sending within their contracts and protocols.

Use at your own risk and please check SECURITY.md

Installation

npm install @patronumlabs/force-transfer

Usage

Here's an example of how to use the ForceTransferLib in your Solidity contract:

pragma solidity ^0.8.0;

import "@patronumlabs/force-transfer/contracts/ForceTransferLib.sol";

contract MyContract {
  function forceTransferToAddress(address payable recipient) external payable {
    ForceTransferLib.force(recipient, msg.value);
  }
}

Constants related to the ForceTransfer Singleton are exported as well.

import { FORCE_TRANSFER_SINGLETON_CONFIG } from "@patronumlabs/force-transfer/constants.js";

function checkRawTransactionAndDeployer() {
  console.log(FORCE_TRANSFER_SINGLETON_CONFIG.rawTx);
  console.log(FORCE_TRANSFER_SINGLETON_CONFIG.deployerAddress);
}

checkRawTransactionAndDeployer();

Deployment

For deployment of the ForceTransfer Singleton, the nick-method is used with a pre-signed rawTx generated by @patronumlabs/nick-method, for more information please check DEPLOYMENT.md

If you need help deploying on a specified network, feel free to submit an issue.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

2.1.0

5 months ago

2.0.0

5 months ago

1.0.0

5 months ago