Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@rari-capital/fuse-sdk
Advanced tools
JavaScript SDK for easy implementation of Fuse by Rari Capital.
Calling all DeFi developers: Rari Capital's SDK is now available for easy implementation of our smart contract APIs! Simply install the SDK and instantiate the Fuse
class. See here for the Fuse dApp or here for the Fuse contracts.
Install the SDK as a dependency of your project:
npm install --save @Rari-Capital/fuse-sdk
Import the fuse-sdk
package:
const Fuse = require("@Rari-Capital/fuse-sdk");
Include the prebuilt dist/fuse.window.js
in your HTML to expose the Fuse
class on the window
object:
<script src="dist/fuse.window.js">
The Fuse
class is instantiated with a Web3 provider as the sole constructor parameter.
var fuse = new Fuse("http://localhost:8545");
var fuse = new Fuse(window.ethereum || "http://localhost:8545");
Fuse
Class APIThe Fuse
class is not very useful unless instantiated, except for a couple objects:
Fuse.Web3
Access the underlying web3.js class used by the SDK.
Fuse.BN
Access the underlying BN
class used by the SDK. (Alias for Fuse.Web3.utils.BN
.)
Fuse
Instance APIThe following objects are available on instances of the Fuse
class:
Fuse.deployPool(poolName, isPrivate, closeFactor, maxAssets, liquidationIncentive, priceOracle, options)
Deploys a new Fuse pool and registers it in the FusePoolDirectory
.
Fuse.deployAsset(conf, collateralFactor, options)
Deploys a new asset to an existing Fuse pool.
Fuse.getCreate2Address(creatorAddress, salt, byteCode)
Returns the Unitroller
contract (the proxy for the Comptroller
implementation contract) address from the creatorAddress
(the FusePoolDirectory
contract address that deployed the pool), the salt
(the pool name), and the Unitroller
proxy contract bytecode.
Fuse.web3
Access the underlying web3.js instance used by the SDK.
// Set parameters
var poolName = "Compound Finance";
var isPrivate = false;
var closeFactor = Web3.utils.toBN(0.051e18);
var maxAssets = Web3.utils.toBN(10);
var liquidationIncentive = Web3.utils.toBN(1e18);
var priceOracle = "ChainlinkPriceOracle"; // Or set to an address to use an existing price oracle
// Deploy new Fuse pool
try {
var [poolAddress, receipt] = await fuse.deployPool(poolName, isPrivate, closeFactor, maxAssets, liquidationIncentive, priceOracle, { from: "0x0000000000000000000000000000000000000000" });
} catch (error) {
return console.error(error);
}
// Log deployed pool contract address and transaction receipt
console.log("Deployed Fuse pool contract address:", poolAddress);
console.log("Deployment transaction receipt:", receipt);
// Set parameters
var conf = {
underlying: "0x6b175474e89094c44da98b954eedeac495271d0f", // Leave blank for ETH
comptroller: "0x0000000000000000000000000000000000000000", // Fuse pool contract address
interestRateModel: "WhitePaperInterestRateModel", // Or set to an address to use an existing interest rate model
initialExchangeRateMantissa: Web3.utils.toBN(2e18),
name: "Compound DAI",
symbol: "cDAI",
decimals: 8,
admin: "0x0000000000000000000000000000000000000000"
};
var collateralFactor = Web3.utils.toBN(0.5e18);
// Deploy new Fuse pool
try {
var [poolAddress, receipt] = await App.fuse.deployAsset(conf, collateralFactor, { from: "0x0000000000000000000000000000000000000000" });
} catch (error) {
return console.error(error);
}
// Log deployed pool asset contract address and transaction receipt
console.log("Deployed Fuse pool asset contract address:", poolAddress);
console.log("Deployment transaction receipt:", receipt);
To build the production browser distribution bundle, run npm run build
. To build the development browser distribution bundle, run npm run dev
.
See LICENSE
.
Fuse's SDK is developed by David Lucid of Rari Capital. Find out more about Rari Capital at rari.capital.
FAQs
JavaScript SDK for easy implementation of Fuse by Rari Capital.
The npm package @rari-capital/fuse-sdk receives a total of 1 weekly downloads. As such, @rari-capital/fuse-sdk popularity was classified as not popular.
We found that @rari-capital/fuse-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.