Events

Events are a special recording mechanism used to broadcast specific events or messages during the execution of smart contracts.

In this section, we will introduce all Events related to Dyson Finance, which allows smart contracts to interact with external applications, such as decentralized applications (dApps)

Pair Factory

PairCreated Event

This event will be emitted after the Factory creates a Pair for dual investment and DEX.

event PairCreated(address indexed token0, address indexed token1, uint id, address pair);
Arguments
Type
Description

token0

address indexed

Sorted tokens index 0*

token1

address indexed

Sorted tokens index 1*

id

uint

The index for Pairs with the same token0-token1 pair

pair

address

The address of created Pair

[token0, token1]*: token0 and token1 are terms used to represent the two tokens in a trading pair. These tokens are sorted according to their addresses to ensure consistency and avoid ambiguity.

Pairs

Swap Event

The Pair represents a DEX trading pair. This event will be emitted when a user attempts to swap tokens within the trading pair.

event Swap(address indexed sender, bool indexed isSwap0, uint amountIn, uint amountOut, address indexed to);
Arguments
Type
Description

sender

address indexed

msg.sender who trigger the fuctioin. ex: Router

isSwap0

bool indexed

Indicate the swap input token type. iftoken0, isSwap0 will be true

amountIn

uint

Swap input amount of input type. Including decimals*

amountOut

uint

The result after the swap is processed. Including decimals*

to

address indexed

The address that receives the swap result

including decimals*: ex: 1000000 amount in USDC represents 1 USDC

Deposit Event

The Pair represents a Dual Investment pair. This event will be emitted when a user attempts to deposit tokens to the pair.

event Deposit(address indexed user, bool indexed isToken0, uint index, uint amountIn, uint token0Amt, uint token1Amt, uint due);
Arguments
Type
Description

user

address indexed

user who could claim this position

isToken0

bool indexed

Indicate the deposit input token type. iftoken0, isToken0 will be true

index

uint

The Note index of this deposit action.

amountIn

uint

Deposit input amount of input type. Including decimals*

token0Amt

uint

The potential position ampount in token0 that the user may receive upon expiration. Including decimals*

token1Amt

uint

The potential position amount in token1 that the user may receive upon expiration. Including decimals*

due

uint

The Unix timestamp represents the time when the user can claim the position.

including decimals*: ex: 1000000 amount in USDC represents 1 USDC

Withdraw Event

This event will be emitted when a user attempts to withdraw a note of a pair.

event Withdraw(address indexed user, bool indexed isToken0, uint index, uint amountOut);
Arguments
Type
Description

user

address indexed

user who own the claimed position

isToken0

bool indexed

The claimed token type for withdrawal. If the output token is of type token0, then isToken0 will be set to true.

index

uint

The Note index of this withdraw action.

amountOut

uint

The position claimed amount. Including decimals*

including decimals*: ex: 1000000 amount in USDC represents 1 USDC

ApprovalForAll Event

This event will be emitted after a user sets operatorApprovals permission.

event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
Arguments
Type
Description

owner

address indexed

Target user address who delegate control of their Note to the operator.

operator

bool indexed

Address that delegates authority to control the owner's Note.

approved

bool

The permissin is set approved (true) or not.

Agency

Register Event

When new users want to create a new membership, this event will be emitted.

event Register(uint indexed referrer, uint referee);
Arguments
Type
Description

referrer

uint indexed

Referrer id in map agents, could use to retrieve referrer's Agent

referee

uint

The new user id in map agents, could use to retrieve new user's Agent

Membership(AgentNFT) is transferable through Agency transfer or AgenctNFT transfer. Do not rely solely on Register events to construct the membership tree.

Farm

There are two types of pools to help Farm generate Points for users, please review our other document to understand how to grant Points.

Rate Updated Event

When an action affects two types of "Points" pools on Farm this event will be emitted.

event RateUpdated(address indexed poolId, uint rewardRate, uint weight);
Arguments
Type
Description

poolId

address indexed

The Pair Address or Farm Address. Which can be used to retrieve the Pool structure from the pools map. If the address is associated with a Farm, it indicates that the global pool is being updated. If the address is associated with a Pair, it indicates that the local pool is being updated.

rewardRate

uint

Updated RewardRate Decimals: 18

weight

uint

Updated Weight Decimals: 18

Grant Points Event

When the user deposits on Dual Investment Pair and triggers Farm to grant sp this event will be emitted.

event GrantSP(address indexed user, address indexed poolId, uint amountIn, uint amountOut);
Arguments
Type
Description

user

address indexed

Address which will receive the Points

poolId

address indexed

The dual investment pair address

amountIn

uint

Amount of a internal used parameters "localSP" Decimals: 18

amountOut

uint

Amount of Points with 18 decimals

Swap Points to $DYSN Event

When the user swaps anyone's Points to DYSN this event will be emitted.

event Swap(address indexed user, address indexed parent, uint amountIn, uint amountOut);
Arguments
Type
Description

user

address indexed

The address that spends its own Points to exchange for DYSN.

parent

address indexed

The parent who could get 1/3 Points commission.

amountIn

uint

Spent Points amounts for DYSN Decimals: 18

amountOut

uint

The DYSN amounts user received Decimals: 18

Staking (sDYSN)

Stake Event

When the user stakes $DYSN to get $sDYSN this event will be emitted.

event Stake(address indexed vaultOwner, address indexed depositor, uint amount, uint sDysonAmount, uint time);
Arguments
Type
Description

vaultOwner

address indexed

The address that received $sDYSN and voting power, and owns the position.

depositor

address indexed

The address which deposit $DYSN (msg.sender)

amount

uint

The amount of $DYSN staked this time. Decimals: 18

sDysonAmount

uint

The amount of $sDYSN minted this time. Which is equal to the additional voting power the vault owner gets. Decimals: 18

time

uint

The lock duration from now for this $DYSN position. unit: secounds

Restake Event

When the user restake $DYSN to get $sDYSN this event will be emitted.

event Restake(address indexed vaultOwner, uint index, uint dysonAmountAdded, uint sDysonAmountAdded, uint time);
Arguments
Type
Description

vaultOwner

address indexed

The address that received $sDYSN and voting power, and owns the position.

index

uint

The vaults index to indicate which position was updated vaults[vaultOwner][indx]

dysonAmountAdded

uint

The amount of $DYSN staked this time. Decimals: 18

sDysonAmountAdded

uint

The amount of $sDYSN minted this time. Which is equal to the additional voting power the vault owner gets. Decimals: 18

time

uint

The lock duration from now for this $DYSN position. unit: secounds

Unstake Position Event

When the user redeems $DYSN from staking vaults this event will be emitted.

event Unstake(address indexed vaultOwner, address indexed receiver, uint amount, uint sDysonAmount);
Arguments
Type
Description

vaultOwner

address indexed

The address that owns the position.

receiver

address indexed

Address that will receive $DYSN

amount

uint

The amount of $DYSN unstaked this time. Decimals: 18

sDysonAmount

uint

The amount of $sDYSN burned this time. Which is equal to the reduction in the voting power of the vault owner. Decimals: 18

Gauge Factory

Gauge Created Event

This event is emitted when a new Gauge is created, indicating the link from the new Gauge to the existing Pair.

event GaugeCreated(address indexed poolId, address gauge);
Arguments
Type
Description

poolId

address indexed

Pair contract address link to new deployed Gauge contract.

gauge

address

New deployed Gauge contract address

Gauge

$sDYSN Deposit Event

This event is emitted when an address deposits $sDYSN to a Gauge

event Deposit(address indexed user, address depositor, uint indexed week, uint amount);
Arguments
Type
Description

user

address indexed

Owner of this deposit position

depositor

address

Address that deposit $sDYSN (msg.sender)

week

uint indexed

The week* in which this deposit position was added

amount

uint

Added $sDYSN Amount Decimals: 18

week*: It's the i-th week since 1970/01/01

$sDYSN Apply Withdrawal Event

This event is emitted when an address applies to withdraw $sDYSN from a Gauge.

event ApplyWithdrawal(address indexed user, uint indexed week, uint amount);
Arguments
Type
Description

user

address indexed

Owner of this deposit position (msg.sender)

week

uint indexed

The week* in which this position amount was removed

amount

uint

This applies to withdrawing the $sDYSN amount Decimals: 18

week*: It's the i-th week since 1970/01/01

$sDYSN Withdraw Event

This event is emitted when an address withdraws its pending $sDYSN from a Gauge.

event Withdraw(address indexed user, uint amount);
Arguments
Type
Description

user

address indexed

Owner of this pending withdrawal position (msg.sender)

amount

uint

The amount of $sDYSN received by the user

Decimals: 18

Bribe Factory

Bribe Created Event

This event is emitted when a new Bribe is created and indicates the link to the gauge.

event BribeCreated(address indexed gauge, address bribe);
Arguments
Type
Description

gauge

address indexed

Gauge contract address link to new deployed Bribe contract.

bribe

address

New deployed Bribe contract address

Bribe

Add Rewards Event

When someone adds rewards to Bribe for users who deposit in Gauge this event will be emitted.

event AddReward(address indexed from, address indexed token, uint indexed week, uint amount);
Arguments
Type
Description

from

address indexed

The address that deposit token rewards (msg.sender)

token

address indexed

The added reward token address

week

uint indexed

The week* to add the reward to.

amount

uint

The amount of added reward tokens. Decimals: by token

week*: It's the i-th week since 1970/01/01

Claim Rewards Event

When users claim rewards from Bribe this event will be emitted.

event ClaimReward(address indexed user, address indexed token, uint indexed week, uint amount);
Arguments
Type
Description

user

address indexed

The address that claimed and received the token rewards (msg.sender).

token

address indexed

The claimed reward token address

week

uint indexed

The week* to claim the reward from.

amount

uint

The amount of claimed reward tokens. Decimals: by token

week*: It's the i-th week since 1970/01/01

Last updated