Skip to main content

SanrSharesV1 contract

Subscriptions

You can use this contract to subscribe to Sanr signal providers. One purchased share gives access to all subject's signals on https://sanr.app

Mostly it is FriendtechSharesV1 with referral system

Methods​

balances​

function balances(address) external view returns (uint256)

Shows subject's or referrer's or protocol's balance of earned fees

mapping. user => balance. param user - The subject or referrer or protocol account

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0uint256Balance of earned fees

buyFirstShare​

function buyFirstShare(address referrer, uint256 amount) external payable

Purchase first share of self. Allowing other users to trade my shares. Set referrer

Parameters​

NameTypeDescription
referreraddressThe account that invited the subject to Sanr. By default it is protocolFeeDestination address
amountuint256The amount of shares to be purchased. Price is 0 for the first share

buyShares​

function buyShares(address sharesSubject, uint256 amount) external payable

Purchase share of subject

Parameters​

NameTypeDescription
sharesSubjectaddressThe Sanr signal provider account
amountuint256The amount of shares to be purchased

earnedByReferrerFees​

function earnedByReferrerFees(address) external view returns (uint256)

Shows amount of fees earned by the referrer over time

mapping. referrer => earned. used for external viewing only. param referrer - The account that invited a subjects to Sanr

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0uint256Amount of fees earned by the referrer

earnedBySubjectFees​

function earnedBySubjectFees(address) external view returns (uint256)

Shows amount of fees earned by the subject over time

mapping. subject => earned. used for external viewing only. param subject - The Sanr signal provider account

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0uint256Amount of fees earned by the subject

getBuyPrice​

function getBuyPrice(address sharesSubject, uint256 amount) external view returns (uint256)

Show buy price of that amount of subject's shares

Parameters​

NameTypeDescription
sharesSubjectaddressThe Sanr signal provider account
amountuint256The amount of shares whose price is calculated

Returns​

NameTypeDescription
_0uint256Buy price of that amount of subject's shares

getBuyPriceAfterFee​

function getBuyPriceAfterFee(address sharesSubject, uint256 amount) external view returns (uint256)

Show the amount of eth that trader will paid

Parameters​

NameTypeDescription
sharesSubjectaddressThe Sanr signal provider account
amountuint256The amount of shares whose price is calculated

Returns​

NameTypeDescription
_0uint256Amount of eth that trader will paid

getPrice​

function getPrice(uint256 supply, uint256 amount) external pure returns (uint256)

Show price of that amount of shares

for amount == 1 price is supply^2 * 1 ether / 16000. same as in friend tech contract

Parameters​

NameTypeDescription
supplyuint256The subject's supply of shares. For selling price it should be (supply - amount)
amountuint256The amount of shares whose price is calculated

Returns​

NameTypeDescription
_0uint256Price of that amount of shares

getReferrersFee​

function getReferrersFee(uint256 price) external view returns (uint256)

Show amount of fee that goes to the all subject's referrers

Parameters​

NameTypeDescription
priceuint256The shares price

Returns​

NameTypeDescription
_0uint256Amount of fee that goes to the all subject's referrers

getSellPrice​

function getSellPrice(address sharesSubject, uint256 amount) external view returns (uint256)

Show sell price of that amount of subject's shares

Parameters​

NameTypeDescription
sharesSubjectaddressThe Sanr signal provider account
amountuint256The amount of shares whose price is calculated

Returns​

NameTypeDescription
_0uint256Sell price of that amount of subject's shares

getSellPriceAfterFee​

function getSellPriceAfterFee(address sharesSubject, uint256 amount) external view returns (uint256)

Show the amount of eth that trader will get

Parameters​

NameTypeDescription
sharesSubjectaddressThe Sanr signal provider account
amountuint256The amount of shares whose price is calculated

Returns​

NameTypeDescription
_0uint256Amount of eth that trader will get

owner​

function owner() external view returns (address)

Returns the address of the current owner.

Returns​

NameTypeDescription
_0addressundefined

protocolFeeDestination​

function protocolFeeDestination() external view returns (address)

Shows the address where protocol fee are received

variable. changing in setFeeDestination()

Returns​

NameTypeDescription
_0addressAddress where protocol fee are received

protocolFeePercent​

function protocolFeePercent() external view returns (uint256)

Shows the percentage of the share price that goes to the protocol fee

variable. changing in setProtocolFeePercent()

Returns​

NameTypeDescription
_0uint256Percentage of the share price that goes to the protocolFeeDestination

referrerLevelsFeePercents​

function referrerLevelsFeePercents(uint256) external view returns (uint256)

Shows the percentage of the share price that goes to the referrer on specified referrer level

mapping. level => feePercent. param level - The referrer level

Parameters​

NameTypeDescription
_0uint256undefined

Returns​

NameTypeDescription
_0uint256Percent of the share price that goes to the referrer on specified referrer level

referrers​

function referrers(address) external view returns (address)

Shows the account that invited the subject to Sanr

mapping. sharesSubject => referrer. param sharesSubject - The Sanr signal provider account

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0addressAccount that invited the subject to Sanr

sellShares​

function sellShares(address sharesSubject, uint256 amount) external nonpayable

Sell share of subject

Parameters​

NameTypeDescription
sharesSubjectaddressThe Sanr signal provider account
amountuint256The amount of shares to be sold

setFeeDestination​

function setFeeDestination(address newFeeDestination) external nonpayable

Set the address where protocol fee are received

only for contract owner

Parameters​

NameTypeDescription
newFeeDestinationaddressThe new protocol fee destination address

setProtocolFeePercent​

function setProtocolFeePercent(uint256 newFeePercent) external nonpayable

Set the percentage of the share price that goes to the protocol fee

only for contract owner

Parameters​

NameTypeDescription
newFeePercentuint256The new protocol fee percent

setReferrerLevelFeePercent​

function setReferrerLevelFeePercent(uint256 newFeePercent, uint256 level) external nonpayable

Set the percentage of the share price that goes to the referrer on specified referrer level

only for contract owner

Parameters​

NameTypeDescription
newFeePercentuint256The new referrer fee percent on specified referrer level
leveluint256The referrer level

setSubjectFeePercent​

function setSubjectFeePercent(uint256 newFeePercent) external nonpayable

Set the address where subject fee are received

only for contract owner

Parameters​

NameTypeDescription
newFeePercentuint256The new subject fee percent

sharesBalance​

function sharesBalance(address, address) external view returns (uint256)

Shows the balance of the subject's shares in the trader's account

mapping. sharesSubject => (trader => balance). param sharesSubject - The Sanr signal provider account. param trader - The trader account

Parameters​

NameTypeDescription
_0addressundefined
_1addressundefined

Returns​

NameTypeDescription
_0uint256Balance of the subject's shares in the trader's account

sharesSupply​

function sharesSupply(address) external view returns (uint256)

Shows the supply of subject's shares

mapping. sharesSubject => supply. param sharesSubject - The Sanr signal provider account

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0uint256Supply of subject's shares

subjectFeePercent​

function subjectFeePercent() external view returns (uint256)

Shows the percentage of the share price that goes to the subject fee

variable. changing in setSubjectFeePercent()

Returns​

NameTypeDescription
_0uint256Percentage of the share price that goes to the sharesSubject

subjectsCount​

function subjectsCount() external view returns (uint256)

Shows the total number of subjects

variable. changing in buyFirstShare(). used for external viewing only

Returns​

NameTypeDescription
_0uint256Total number of subjects

transferOwnership​

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters​

NameTypeDescription
newOwneraddressundefined

withdrawAll​

function withdrawAll() external nonpayable

Withdraw all collected fees

Events​

FeeDestinationWasSet​

event FeeDestinationWasSet(address newFeeDestination)

This event is emitted when contract owner set the address where protocol fee are received

emitted in setFeeDestination() function

Parameters​

NameTypeDescription
newFeeDestinationaddressThe new protocol fee destination address

FirstTrade​

event FirstTrade(address subject, address indexed referrer)

This event is emitted when a subject purchased first share of its own, allowing other users to trade subject's shares

emitted in buyFirstShare() function

Parameters​

NameTypeDescription
subjectaddressThe Sanr signal provider account which also trader in that case
referrer indexedaddressThe account that invited the subject to Sanr. By default it is protocolFeeDestination address

OwnershipTransferred​

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters​

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

ProtocolFeePercentWasSet​

event ProtocolFeePercentWasSet(uint256 newFeePercent)

This event is emitted when contract owner set the percentage of the share price that goes to the protocol fee

emitted in setProtocolFeePercent() function

Parameters​

NameTypeDescription
newFeePercentuint256The new protocol fee percent

ReferrerLevelFeePercentWasSet​

event ReferrerLevelFeePercentWasSet(uint256 newFeePercent, uint256 level)

This event is emitted when contract owner set the percentage of the share price that goes to the referrer on specified referrer level

emitted in setReferrerLevelFeePercent() function

Parameters​

NameTypeDescription
newFeePercentuint256The new referrer fee percent on specified referrer level
leveluint256The referrer level

SubjectFeePercentWasSet​

event SubjectFeePercentWasSet(uint256 newFeePercent)

This event is emitted when contract owner set the percentage of the share price that goes to the subject fee

emitted in setSubjectFeePercent() function

Parameters​

NameTypeDescription
newFeePercentuint256The new subject fee percent

Trade​

event Trade(address indexed trader, address indexed subject, bool indexed isBuy, uint256 shareAmount, uint256 ethAmount, uint256 ethAmountAfterFee, uint256 supply)

This event is emitted when a trade occurs

emitted in _buyShares() and sellShares() functions

Parameters​

NameTypeDescription
trader indexedaddressThe trader account
subject indexedaddressThe Sanr signal provider account
isBuy indexedboolIf this is true, then the trader bought the shares through this transaction. If it's false, the trader sold them
shareAmountuint256The amount of shares was traded
ethAmountuint256The amount of eth was traded
ethAmountAfterFeeuint256The amount of eth that trader get or paid
supplyuint256The subject's supply of shares after this trade

Withdrawn​

event Withdrawn(address user, uint256 amount)

This event is emitted when a subject or referrer or protocol withdrawn all their collected fees.

emitted in withdrawAll() function

Parameters​

NameTypeDescription
useraddressThe subject or the referrer or the protocol account that decided to make withdraw
amountuint256The amount of collected eth