
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@redstone-finance/casper-connector
Advanced tools
[](https://discord.gg/2CT6hN6C) [](https://twitter.com/intent/follow?screen_name=redstone_defi
RedStone proposes a completely new modular design where data is first put into a data availability layer and then fetched on-chain. This allows us to broadcast a large number of assets at high frequency to a cheaper layer and put it on-chain only when required by the protocol.
The @redstone-finance/casper-connector
module implements an alternative design of providing oracle data to smart
contracts. Instead of constantly persisting data on the Casper network storage (by data providers), the information is
brought on-chain only when needed (by end users). Until that moment data remains in the decentralised cache layer, which
is powered by RedStone light cache gateways and streamr data broadcasting protocol. Data is transferred to the Casper
network by end users. The information integrity is verified on-chain through signature checking.
Here also you can find the description of the whole RedStone Oracle model.
1.68.2
.
First, you need to import the connector code to your project
// Typescript
import {
PriceAdapterCasperContractConnector,
makeCasperConnection,
} from "@redstone-finance/casper-connector";
// or: import { PriceRelayAdapterCasperContractConnector } from "@redstone-finance/casper-connector";
import { ContractParamsProvider, getSignersForDataServiceId } from "@redstone-finance/sdk";
// Javascript
const {
PriceAdapterCasperContractConnector,
makeCasperConnection,
// or: PriceRelayAdapterCasperContractConnector
} = require("@redstone-finance/casper-connector");
const { ContractParamsProvider, getSignersForDataServiceId } = require("@redstone-finance/sdk");
Then you can invoke the contract methods described above pointing to the selected RedStone data service and requested data feeds.
const prices = new PriceAdapterCasperContractConnector(
makeCasperConnection(yourConfig),
yourContractPackageHash
);
/* or const prices = new PriceRelayAdapterCasperContractConnector(
yourWalletOrProvider,
yourContractAddress
);
*/
const paramsProvider = new ContractParamsProvider({
dataServiceId: "redstone-main-demo",
uniqueSignersCount: 1,
dataPackagesIds: ["ETH", "BTC"],
authorizedSigners: getSignersForDataServiceId("redstone-main-demo"),
});
The yourConfig
param is required. The example value can be found in
the test/e2e/config.ts file.
Now you can access any of the contract's methods by invoking the code:
(await prices.getAdapter()).getPricesFromPayload(paramsProvider); // the method is available only for PriceRelayAdapterCasperContractConnector
(await prices.getAdapter()).writePricesFromPayloadToContract(paramsProvider);
(await prices.getAdapter()).readPricesFromContract(paramsProvider);
(await prices.getAdapter()).readTimestampFromContract();
yarn install
The Casper Accelerate Grant Program has been created to exclusively support projects and developers building on the Casper Public Mainnet to grow and secure the Casper Network. Read more here
RedStone Casper connector is an open-source and free software released under the BUSL-1.1 License.
FAQs
[](https://discord.gg/2CT6hN6C) [](https://twitter.com/intent/follow?screen_name=redstone_defi
We found that @redstone-finance/casper-connector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.