npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vidy-dev/ethereum-api-deposit

v1.0.1

Published

Contracts for funding the API backend with VidyCoins and/or ether

Downloads

27

Readme

ethereum-api-deposit

Contracts for funding the API backend with VidyCoins and/or ether

Install

$ yarn add @vidy-dev/ethereum-api-deposit

or

$ npm install @vidy-dev/ethereum-api-deposit

Deposit Accounts

Deposit accounts are single-signature wallets which hold ether or ERC20 tokens on behalf of the backend API, and keep a record of each outgoing transfer (both in Solidity event logs, and in internal transfer lists).

Each outgoing transfer is associated with a unique nonce (uint256), set by the wallet owner. The nonce appears in both record formats for easier queries.

Public Interface

Events

event Transferred(address indexed token, address indexed to, uint256 amount, uint256 indexed nonce): Emitted when ether or ERC20 tokens are transferred from the deposit account. token indicates the address of the ERC20 contract, 0x0 if ether was transferred.

event TransferredEther(address indexed to, uint256 amount, uint256 indexed nonce): Emitted when ether is transferred from the deposit account. A Transferred event will also be emitted.

event TransferredTokens(address indexed token, address indexed to, uint256 amount, uint256 indexed nonce): Emitted when ERC20 tokens are transferred from the deposit account. token indicates the address of the ERC20 contract. A Transferred event will also be emitted.

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner): Emitted when the deposit account (and any ether / ERC20 tokens it contains) is transferred to a new owner.

Fields and Constant Functions

mapping(uint256 => bool) public nonceUsed: Whether a particular nonce value has already been used to represent a transfer. Nonces cannot be repeated.

mapping(uint256 => Transfer) public transfers: The Transfer struct associated with a particular nonce.

uint256 public transferCount: The number of transfers that have been performed so far.

mapping(address => uint256) public totalTransferred: For each token address (0x0 for ether), the total amount that has been transferred out of the account.

tokenBalance(function tokenBalance(address _token) public view returns (uint256): An alias for balanceOf() called on the token contract -- returns the amount of tokens owned by the deposit account.

Non-constant Functions

function transferEtherToOwner(uint256 _value, uint256 _nonce) public onlyOwner returns (bool): Transfers the indicated amount of ether (measured in wei) to the current contract owner, returning success. Only the contract owner can perform this operation.

function transferEther(address _to, uint256 _value, uint256 _nonce) public onlyOwner returns (bool): Transfers the indicated amount of ether (measured in wei) to the indicated address, returning success. Only the contract owner can perform this operation.

function transferTokensToOwner(address _token, uint256 _value, uint256 _nonce) public onlyOwner returns (bool): Transfers the indicated amount of the ERC20 token at the specified address to the current contract owner, returning success. Only the contract owner can perform this operation.

function transferTokens(address _token, address _to, uint256 _value, uint256 _nonce) public onlyOwner returns (bool): Transfers the indicated amount of the ERC20 token at the specified address to the indicated recipient, returning success. Only the contract owner can perform this operation.