Smartlink addresses one of the biggest challenges in the global marketplace: ‘Need to Trust,’ by introducing decentralized escrow services and payments processing based on Tezos' institutional-grade smart contracts that suppress the need for buyers and sellers to trust each other.
Smartlink aims to provide a user-centered escrow solution to secure online and face-to-face transactions while broadening payments acceptance options through integrated wrapped currencies.
Smartlink proposes a new method to initiate commercial transactions by offering Trust-As-A-Service to incentivize commitment and eliminate the trust deficit in the global marketplace.
Name | Type | Description |
---|---|---|
admin | TAddress | Address of the admin |
reserve | TAddress | Address of the token reserve to pay the stakings |
userStakeLockPack | UserStakeLockPack | See the schema below |
StakeLock | TRecord | Structure of a locked staking |
StakeLock.timestamp | TTimestamp | Timestamp of the begining of the staking |
StakeLock.rate | TNat | Rate of the staking |
StakeLock.value | TNat | Amount of tokens staked |
userStakeFlexPack | TBig_map(TAddress, StakeFlex) | Storage of all the flex stakings |
StakeFlex | TRecord | Structure of a flex staking |
StakeFlex.timestamp | TTimestamp | Timestamp of the begining of the staking |
StakeLock.reward | TNat | Rewards for the past period of the staking |
StakeLock.value | TNat | Amount of tokens staked |
stakingOptions | TMap(TNat, stakingOption) | Storage of all the staking packs |
stakingOption | TRecord | Structure of a staking option |
stakingOption.minStake | TNat | Minimum amount of tokens that can be sent in one transaction |
stakingOption.maxStake | TNat | Maximum amount of tokens that can be sent in one transaction |
stakingOption.stakingPeriod | TInt | Duration of a staking |
stakingOption.stakingPercentage | TNat | Rate of the staking |
votingContract | TAddress | Address of the voting contract that will be implemented in the future |
stakingHistory | TMap(TTimestamp, TInt) | Mapping of the number of SMAK staked at a timestamp |
This is the structure of the nested maps userStakeLockPack
@sp.utils.view(sp.TMap(sp.TNat, sp.TRecord(minStake=sp.TNat, maxStake=sp.TNat, stakingPeriod=sp.TInt, stakingPercentage=sp.TNat)))
def getStakingOptions(self, params):
sp.set_type(params, sp.TUnit)
Returns the whole map of staking options.
@sp.utils.view(sp.TRecord(minStake=sp.TNat, maxStake=sp.TNat, stakingPeriod=sp.TInt, stakingPercentage=sp.TNat))
def getStakingOptionById(self, params):
sp.set_type(params, sp.TNat)
Returns the specified staking option.
@sp.utils.view(sp.TAddress)
def getAdmin(self, params):
sp.set_type(params, sp.TUnit)
Returns the address of the admin.
@sp.utils.view(sp.TAddress)
def getReserve(self, params):
sp.set_type(params, sp.TUnit)
Returns the address of the reserve which will pay the staking rewards.
@sp.utils.view(sp.TAddress)
def getTokenContractAddress(self, params):
sp.set_type(params, sp.TUnit)
Returns the address of the token contract.
@sp.utils.view(sp.TAddress)
def getVotingContract(self, params):
sp.set_type(params, sp.TUnit)
Returns the address of the voting contract.
@sp.utils.view(sp.TBigMap(sp.TAddress, StakeFlex))
def getAllStakeFlex(self, params):
sp.set_type(params, sp.TUnit)
Returns the whole map of the flex stakings.
@sp.utils.view(sp.TBigMap(sp.TAddress, sp.TMap(sp.TNat, sp.TMap(sp.TNat, StakeLock))))
def getAllStakeLock(self, params):
sp.set_type(params, sp.TUnit)
Returns the whole map of locked stakings.
@sp.utils.view(sp.TMap(sp.TNat, StakeLock))
def getLockStakeByPack(self, params):
sp.set_type(params, sp.TRecord(pack = sp.TNat, address = sp.TAddress))
Returns all the stakings of a specified user for a specified pack.
@sp.utils.view(sp.TMap(sp.TNat, sp.TMap(sp.TNat, StakeLock)))
def getLockStakeInformation(self, params):
sp.set_type(params, sp.TAddress)
Returns all the locked stakings for a specified user.
@sp.utils.view(StakeLock)
def getLockStakeByPackAndId(self, params):
sp.set_type(params, sp.TRecord(pack = sp.TNat, address = sp.TAddress, id_ = sp.TNat).layout(("id_ as id", ("pack", "address"))))
Returns a specified staking of a specified pack of a specified user.
@sp.utils.view(StakeFlex)
def getFlexStakeInformation(self, params):
sp.set_type(params, sp.TAddress)
Returns the flex staking of the specified user.
@sp.utils.view(sp.TNat)
def getCurrentPendingRewards(self, params):
sp.set_type(params, sp.TAddress)
Returns the pending rewards for a user.
@sp.entry_point
def updateReserve(self, params):
sp.set_type(params, sp.TRecord(reserve=sp.TAddress))
Sets the reserve address.
@sp.entry_point
def updateAdmin(self, params):
sp.set_type(params, sp.TRecord(admin=sp.TAddress))
Sets the admin address of the contract.
@sp.entry_point
def updateContract(self, params):
sp.set_type(params, sp.TRecord(contract = sp.TAddress))
Sets the address of the token contract.
@sp.entry_point
def updateVotingContract(self, params):
sp.set_type(params, sp.TRecord(contract = sp.TAddress))
Sets the adress of the voting contract.
@sp.sub_entry_point
def is_voting_contract(self, contract):
Verifies if the address in param is the voting contract address.
@sp.entry_point
def createStakingOption(self, params):
sp.set_type(params, sp.TRecord(_id = sp.TNat, rate = sp.TNat, _max = sp.TNat, _min = sp.TNat, duration = sp.TInt).layout(("_id as id", ("rate", ("_max as max", ("_min as min", "duration"))))))
Function used to create a stacking pack (Period / APY). Only Admin
- the id of the staking parameters
- the staking rate
- the maximum staking amount per transaction
- the minimum staking amount per transaction
- the staking period
@sp.entry_point
def updateStakingOptionRate(self, params):
sp.set_type(params, sp.TRecord(_id = sp.TNat, rate = sp.TNat).layout(("_id as id", "rate")))
Sets the new duration of the staking pack.
@sp.entry_point
def updateStakingOptionMax(self, params):
sp.set_type(params, sp.TRecord(_id = sp.TNat, _max = sp.TNat).layout(("_id as id", "_max as max")))
Sets the new max amount per transaction.
@sp.entry_point
def updateStakingOptionMin(self, params):
sp.set_type(params, sp.TRecord(_id = sp.TNat, _min = sp.TNat).layout(("_id as id", "_min as min")))
Sets the new min per transaction
@sp.entry_point
def stakeLock(self, params):
sp.set_type(params, sp.TRecord(pack = sp.TNat, amount = sp.TNat))
Stakes the amount of tokens using the parameters of the pack specified. Will initialize the map for the user if it's his first staking.
@sp.entry_point
def stakeFlex(self, params):
sp.set_type(params, sp.TRecord(amount = sp.TNat))
Stakes the amount of tokens using the flex pack parameters. Will initialize the staking for the user if it's his first staking. Else it will only update the staking.
@sp.entry_point
def unstakeLock(self, params):
sp.set_type(params, sp.TRecord(pack=sp.TNat, index=sp.TNat))
Unstakes the specified stake. If the stake period isn't finished the user won't receive his rewards.
@sp.sub_entry_point
def unlockWithReward(self, params):
sp.set_type(params, sp.TRecord(pack = sp.TNat, index = sp.TNat))
Function called by unstakeLock
if the staking period has finished. Will send the user his tokens back + the rewards.
@sp.sub_entry_point
def unlockWithoutReward(self, params):
sp.set_type(params, sp.TRecord(index = sp.TNat, pack = sp.TNat))
Function called by unstakeLock
if the staking period has not finished. Will only send the user his tokens back.
@sp.entry_point
def unstakeFlex(self, params):
sp.set_type(params, sp.TRecord(amount = sp.TNat))
Computes the reward for the last staking period, sets the timestamp to the actual timestamp, updates the value of the stake and sends the user his tokens back.
@sp.entry_point
def claimRewardFlex(self):
Sends the rewards available to the user.
def getReward(self, params):
sp.set_type(params, sp.TRecord(start=sp.TTimestamp, end = sp.TTimestamp, value= sp.TNat, rate=sp.TNat))
Internal function that will compute the rewards for a period.