New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@intercoin/income

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intercoin/income

Implements UBI and other types of income, used to claim currency in other external contracts

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
0
Created
Source

IncomeContract

Implements UBI and other types of income, used to claim currency in other external contracts

Deploy

when deploy it is need to pass parameters in to init method

Params:

nametypedescription
tokenaddresstoken's address. if token = address(0) then contract will trying to claim ETH

Overview

once installed will be use methods:

Methods

addRecipient

adding recipient to contract. Only for Owner
Params:

nametypedescription
recipientaddressrecipient's address

setLockup

lockups for recipient. Only for Owner
Params:

nametypedescription
recipientaddressrecipient's address
restrictionstuple[]array or RestrictParam tuples

RestrictParam tuple

nametypedescription
amountuint256amount
untilTimeuint256time in unixtimestamp
gradualboolgradual

addManager

adding manager to recipient. Only for Owner
Params:

nametypedescription
recipientaddressrecipient's address
manageraddressmanager's address

removeManager

removing manager from recipient. Only for Owner
Params:

nametypedescription
recipientaddressrecipient's address
manageraddressmanager's address

pay

setup allowed amount to recipient claim
Params:

nametypedescription
recipientaddressrecipient's address
amountuint256amount

claim

call by recipient to claim funds

viewLockup

Params:

nametypedescription
recipientaddressrecipient's address

Returned params:

nametypedescription
maximumuint256maximum funds that was setup by owner
payeduint256already paid funds. mean that recipient already claimed them
lockeduint256fudns that restricted by owner
allowedByManageruint256funds allowed by manager. recipient can claim them

Lifecycle of IncomeContract

Create IncomeContract with param 'token' = <0x0000000000000000000000000000000000000000>. That mean that contract will be work with ethers. And send some ethers to IncomeContract.

  • so owner want to pay some recipient 10eth per week for 2 months(8 weeks). Need to do several steps:

    • add recipient by invoking method addRecipient(<recipient address>)
    • add manager to recipient by invoking method addManager(<recipient address>,<manager address>)
    • setup restriction. invoke method setLockup(<recipient address>, <array or restriction's tuples>). one tuple is [amount,untilTime,gradual]. So it will be smth like this
    [
    [<10e18>,<time_now + 1week in seconds>, false],
    [<10e18>,<time_now + 2week in seconds>, false],
    [<10e18>,<time_now + 3week in seconds>, false],
    [<10e18>,<time_now + 4week in seconds>, false],
    [<10e18>,<time_now + 5week in seconds>, false],
    [<10e18>,<time_now + 6week in seconds>, false],
    [<10e18>,<time_now + 7week in seconds>, false],
    [<10e18>,<time_now + 8week in seconds>, false]
    ]
    
    • after this, every week will be available by 10 eth and manager can pay (setup allowed amount to claim) to recipient any funds of available.
    • after passing 2 weeks. available by owner 20eth. manager can pay not more that 20eth. for example he invoking method pay(<recipient address>,<12e18>). reciepient can claim only 12 eth

FAQs

Package last updated on 14 Jul 2024

Did you know?

Socket

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.

Install

Related posts