Registry

Binance Smart Chain Mainnet

Contract Name
Contract Address V2 (Recommended)
Contract Addresses V1
Some Functions Used

xvUSDT

deposit,

withdraw,

totalAssets (TVL)

pricePerShare

xvUSDC

deposit,

withdraw,

totalAssets (TVL)

pricePerShare

xvBUSD

deposit,

withdraw,

totalAssets (TVL)

pricePerShare

StrategyUgoHawkVenusUSDTFarm

StrategyUgoHawkVenusUSDCFarm

StrategyUgoHawkVenusBUSDFarm

Polygon Mainnet

Contract Name
Contract Address V2 (Recommended)
Contract Addresses V1
Some Functions Used

xUSDT

deposit

withdraw

balance

getPricePerFullShare

xUSDC

deposit

withdraw

balance

getPricePerFullShare

xAAVE

deposit

withdraw

balance

getPricePerFullShare

xWBTC

deposit

withdraw

balance

getPricePerFullShare

EarnAPRWithPool

APRWithPoolOracle

Ethereum Mainnet

yearn.finance

Contract Name

Address

Protocol Adapter

0x083313c94D2ff5756E7c49E8516d813E19bB04B0

Protocol Service

Groups

0x90d26bf93607666ff2beb99556dbf6a379ced9bf

Cycles

0x755322b498d9A007055587760BE2cC8465A3BC2A

Esusu Service

0xc0163F657b48Cd5058b256334c002e4D02Fdc3C4

Esusu Storage

0xD08eA81B20252228329D5EC8Ca1393c86894442c

Esusu Adapter

0x671D3B4cC56C29E3409736a913ba96B4473F15c5

Client Record

0x1c1f9af4d32562c3666930d3988c75ba6a4f9645

Individual (Personal Savings)

0x552260A8F6686430632a5BA6FeAcd066E34b33A2

Cooperative Savings

0xE519545539E35f2704D571a476464d037Bcd32cc

DAI Token

0x6b175474e89094c44da98b954eedeac495271d0f

Function Description

Deposit in xAuto or xVault

To deposit in the xAuto or xVault Protocol, Call the deposit function from the Xend Finance xAuto or xVault Protocols(Layer 2 Aggregator ) contracts.

Parameters
Description

Token Ticker

"BUSD","USDT","USDC"

Amount

Amount to Deposit

const { Personal, xAuto, xVault } = await setupSdk(privateKey, chainId, protocolName);

	if (protocolName === 'xAuto') {

			const receipt = await xAuto.deposit("BUSD", String(amount))
			if (receipt.status) {
				return {
					block: receipt.blockNumber,
					gasUsed: receipt.gasUsed,
					tnxHash: receipt.transactionHash
				}
			}
			throw 'failed'
		}
		else if (protocolName === 'xVault') {
			const receipt = await xVault.deposit("BUSD", String(amount))
			if (receipt.status) {
				return {
					block: receipt.blockNumber,
					gasUsed: receipt.gasUsed,
					tnxHash: receipt.transactionHash
				}
			}
			throw 'failed'
		}

Withdraw in xAuto or xVault

To withdraw in the xAuto or xVault Protocol, Call the withdraw function from the Xend Finance xAuto or xVault Protocols(Layer 2 Aggregator ) contracts.

Parameters
Description

Token Ticker

"BUSD","USDT","USDC"

Amount

Amount to Withdraw

const { Personal, xAuto, xVault } = await setupSdk(privateKey, chainId, protocolName);

		if (protocolName === 'xAuto') {

			const receipt = await xAuto.withdraw("BUSD", totalBUSDAdmount)
			if (receipt.status) {
				return {
					block: receipt.blockNumber,
					gasUsed: receipt.gasUsed,
					tnxHash: receipt.transactionHash
				}
			}

		}

		if (protocolName === 'xVault') {
			const receipt = await xVault.withdraw("BUSD", totalBUSDAdmount)
			if (receipt.status) {
				return {
					block: receipt.blockNumber,
					gasUsed: receipt.gasUsed,
					tnxHash: receipt.transactionHash
				}
			}
		}

Deposit in Flexible Personal Savings

To deposit in the flexible savings, we'll first call the approve function to allow the Xend Finance contract to take the approved amount. Call the approve function from the BUSD Token contract, and the deposit function from the Xend Finance Individual (Personal Savings) contract.

Parameters

Description

amount

//1. first approve contract to spend amount
await contract.methods.approve(conractAddress, amount).send({from: clientAddress})

//2. call deposit
await contract.methods.deposit().send({from: clientAddress})

Withdraw from Flexible Personal Savings

Call withdraw function from Xend Finance Individual (Personal Savings) contract

Parameters

Description

amount

await contract.methods.withdraw(amount).send({from: clientAddress})

Deposit in Fixed Personal Savings

To deposit in the flexible savings, we'll first call the approve function to allow the Xend Finance contract to take the approved amount. Call the approve function from the BUSD Token contract, and the FixedDeposit function from the Xend Finance Individual (Personal Savings) contract.

Parameters

Description

amount

lockPeriod

//1. first approve contract to spend amount
await contract.methods.approve(conractAddress, amount).send({from: clientAddress})

// 2. call FixedDeposit with lock period
await contract.methods.FixedDeposit(lockPeriod).send({from: clientAddress})

Withdraw from Fixed Personal Savings

Call the WithdrawFromFixedDeposit function from Xend Finance Individual (Personal Savings) contract

Parameters

Description

recordId

await contract.methods.WithdrawFromFixedDeposit(recordId).send({from: clientAddress})

Create a Group

A group needs to be created to be able to create an Esusu or Cooperative cycle.

Contract: Group

Parameters

Type

Description

name

string

every group has a unique name

symbol

string

await contract.methods.createGroup(name, symbol).send({from:clientAddress})

Get Group using ID

Retrieves the details of a group using its id.

Contract: Group

await contract.methods.getGroupById(groupId).call()

Create Esusu Cycle

Create an Esusu cycle to enable potential members to join and start saving.

Contract: Esusu Service

Parameters

Type

Description

groupId

depositAmount

the deposit amount should be a big number

payoutIntervalInSeconds

startTimeInSeconds

maxMembers

maximum number of addresses that would be able to join this cycle

await contract.methods.CreateEsusu(groupId, depositAmount, payoutIntervalInSeconds, startTimeInSeconds, maxMembers).send({from:clientAddress})

Join Esusu Cycle

Adds an address as a member of an Esusu cycle if the address has sufficient balance.

Contract: Esusu Service

Parameter

Type

Description

cycleId

await contract.methods.JoinEsusu(cycleId).send({from:clientAddress})

Start Esusu

Contract: Esusu Service

Parameters

Description

cycleId

await contract.methods.StartEsusuCycle(cycleId).send({from: clientAddress})

Withdraw Esusu ROI

Call this function to withdraw gained ROI from being part of an Esusu cycle.

Contract: Esusu Service

Parameters

Description

cycleId

await contract.methods.WithdrawROIFromEsusuCycle(cycleId).send({from: clientAddress})

Withdraw Esusu Capital

Withdraw the deposit amount used to join the cycle.

Contract: Esusu Service

Parameters

Description

cycleId

await contract.methods.WithdrawROIFromEsusuCycle(cycleId).send({from: clientAddress})

Create Cooperative Cycle

Contract: Xend Finance Group (Cooperative Savings)

Parameters

Description

groupId

startTimeInSeconds

payoutIntervalInSeconds

maxMembers

hasMaximumSlots

boolean

stakeAmount

await contract.methods.createCycle(groupId, startTimeInSeconds, payoutIntervalInSeconds, maxMembers, hasMaximumSlots, stakeAmount).send({from: clientAddress})

Join Cooperative Cycle

Contract: Xend Finance Group (Cooperative Savings)

Parameters

Description

cycleId

numberOfStake

members can have one or more stakes in a cooperative cycle

await contract.methods.joinCycle(cycleId, numberOfStake).send({from: clientAddress})

Start Cycles

Contract: Xend Finance Group (Cooperative Savings)

Parameters

Description

cycleId

await contract.methods.activateCycle(cycleId).send({from: clientAddress})

Withdraw From Cooperative Cycle

In the cooperative cycles, there's a provision to withdraw from the cycle before the end date and time and also to withdraw when the cycle duration ends. Withdrawing while the cycle is ongoing incurs a severance fee on the member that withdraws.

Contract: Xend Finance Group (Cooperative Savings)

Parameters

Description

cycleId

// withdrawing while cycle is ongoing
await contracts.methods.withdrawFromCycleWhileItIsOngoing(cycleId).send({from: clientAddress})

// withdrawing after cycle is completed
await contracts.methods.withdrawFromCycle(cycleId).send({from: clientAddress})

Last updated