Skip to content

Smart Contracts API

viac92 edited this page Feb 14, 2022 · 3 revisions

DataGen.sol

Description:

DataGen utility erc-20 token(#DG) the utility token for the Datagen infrastructure.

totalSupply 30000000
decimal 18
name DataGen
symbol #DG

VCPrivateSale.sol

Description:

This smart contract is used for private sale for VCs. They can buy #DG tokens with invest() functions. #DG tokenPrice: 0.7; 0.9; 1.1 USDC (it depends when they bought). Before lockTime the token owner sends 1/10 VCs #DG token to VCs wallets. After lockTime the token owner sends 1/10 of the remaining #DG (the total #DG amount sub the 10%) amount per 30 days. The USDC can be claimed by the token owner during the sale.

Functions:

constructor:

Function constructor (
  IERC20 _token,
  uint256 _startTime,
  uint256 _endTime,
  uint256 _lockTime,
  address _USDC_ADDRESS )
Description Constructor of VCPrivateSale smart contract.
Parameter IERC20 _token: DataGen Token Address.

Uint256 _startTime: startTime for VCPrivateSale.

Uint256 _endTime: endTime for VCPrivateSale.

Uint256 _lockTime: set LockTime – during LockTime, Only the token Owner can call the function to send 1/10 of investors #DG token to VCs wallets.

Address _USDC_ADDRESS: sets USDC token address.

checkFunds:

Function checkFunds( address addr ) public view returns(uint256)
Description This function gets the USDC balance of the addr user.
Parameter address addr: address of the user to get USDC balance.
Return This function returns the balance of USDC of addr wallet in uint256.

checkDataGenFunds:

Function checkDataGenFunds( address addr ) public view returns(uint256)
Description This function gets the #DG token balance of the addr user.
Parameter address addr: address of the user to get #DG token balance
Return This function returns the balance of #DG token of addr wallet in uint256.

setLockTime:

Function setLockTime(uint256 _lockTime) public
Description This function sets lockTime.

invest:

Function invest( uint256 amountDG) external
Description This function makes an investment.

Investors can call this function after startTime and before endTime of VCPrivateSale amountDG should be bigger than 20000 #DG and less than 2350000 #DG.

tokenPrice:
  if amountDG <= 300000 #DG → 1#DG = 0.7 USD
  if amountDG <= 1300000 #DG → 1#DG = 0.9 USDC
  if amountDG > 1300000 #DG → 1#DG = 1.1 USDC

warning: Before calling this function the user must approve to use USDC first.
Parameter uint256 amountDG: #DG token amount for investment.

claimDataGen:

Function claimDataGen( ) public afterClosed nonReentrant onlyOwner
Description This function distributes #DG tokens that they bought during VCPrivateSale.
This function can only be called after VCPrivateSale finishes and only the owner can call.
Before lockTime, only the token owner can call the function to send 1/10 VCs #DG token to VCs wallets.
After lockTime, only the token owner can call the function to send only 1/10 of the remaining (the total amount sub the 10%) amount per 30 days.

withdrawUSDC:

Function withdrawUSDC( ) public onlyOwner
Description This function withdraws USDC from the smart contract to the owner's wallet.
This function can only be called by the owner.

withdrawDataGen:

Function withdrawDataGen( ) public onlyOwner afterClosed
Description This function withdraws the correct amount of #DG token from smart contract to owner wallet leaving the #DG for the claim.
This function can only be called by the owner, after the private sale is finished.

RetailPrivateSale.sol

Description:

This smart contract is used for private sale for retailers. This smart contract has 150,000 #DG tokens locked until the end of the presale. After the end of the presale, the owner distributes the #DG tokens to the investors. The USDC can be claimed by the token owner during the sale.

Functions:

constructor

Function constructor (
  IERC20 _dataGen,
  uint256 _startTime,
  uint256 _endTime,
  address _USDC_ADDRESS )
Description Constructor of RetailPrivateSale smart contract.
Parameter IERC20 _dataGen: DataGen Token Address.
uint256 _startTime: retail start time.
uint256 _endTime: retail end time.
address _USDC_ADDRESS: USDC token address.

checkFunds

Function checkFunds( address addr ) external view returns(uint256)
Description Gets addr wallet USDC balance.
Parameter address addr: wallet address for get USDC balance in this smart contract.
Return returns USDC balance in this smart contract of addr wallet.

checkDataGenFunds

Function checkDataGenFunds( address addr ) external view returns(uint256)
Description Gets addr wallet #DG token balance.
Parameter address addr: wallet address for get #DG token balance in this smart contract.
Return returns #DG token balance in this smart contract of addr wallet

invest

Function invest( uint256 amountDG ) external
Description This function makes an investment.

Only callable if the private sale started and hasn't been closed already and the maxGoal wasn't reached yet.
The current token price is looked up and the corresponding number of tokens is transferred to the receiver.
The sent value is directly forwarded to a safe multisig wallet.
This method allows users to purchase tokens on behalf of another address.

Before 15000 #DG → 1#DG = 0.7 USDC
After 15000 #DG → 1#DG = 1 USDC
Parameter uint256 amountDG: amount of #DG token to invest.

claimDataGen

Function claimDataGen() external nonReentrant afterClosed
Description This function claims #DG token that they invest.
After retail is finished only the Token Owner can send to retailers the tokens.

withdrawUSDC

Function withdrawUSDC() external onlyOwner
Description This function withdraws USDC in this smart contract.
Only Owner can withdraw USDC.

withdrawDataGen

Function withdrawDataGen () external nonReentrant afterClosed
Description This function withdraws the correct amount of #DG token from smart contract to owner wallet leaving the #DG for the claim.
This function can only be called by the Owner, after the private sale is finished.

TeamBonusPool.sol

Description:

This smart contract is used to give bonuses to team members. This smart contract has 300,000.00 #DG tokens. Tokens will be locked until the 1st of August 2022. Then the tokens are released in 10 equal release events( in each of them, 10% of the liquidity is made available for withdrawal; one every 30 days.

Functions:

constructor

Function constructor( IERC20 _dataGen)
Description Constructor of TeamBonusPool smart contract
Parameter IERC20 _dataGen: DataGen Token Address

sendBonus

Function sendBonus( address _receiver, uint256 _amount ) external onlyOwner
Description This function gives _amount of #DG token to _receiver as a bonus.
This function can be called by only Owner.
Parameter address_ receiver: address of a team member who receives the bonus.

uint256 _amount: amount of #DG token for bonus.

releaseBonus

Function releaseBonus( ) external noonReentrant
Description This function gets #DG tokens as a bonus.
Before the 1st of August 2022, we can not call this function.
From the 1st of August 2022, they can only withdraw 10% of their bonus.
(They can only claim 10% of their salary every 30 days).

checkBonus

Function checkBonus(address _checker ) public view returns(uint256)
Description This function returns the left Bonus amount of _checker.

checkBalance

Function checkBalance( ) public view returns(uint256)
Description This function returns the left Amount of #DG tokens in this smart contract.

setLockTime

Function setLockTime( ) external onlyOwner
Description This function sets lockTime for releaseBonus to current time.
This function can only be called by the owner.

Airdrop.sol

Description:

This smart contract is used to give #DG tokens for the airdrop. Users input their code on the website. And If the code is right and we save an amount of #DG token for this code to the back-end with wallet address. Once the airdrop is ready, the owner will release the airdrop to users.

Functions:

constructor

Function constructor( IERC20 _dataGen)
Description Constructor of Airdrop smart contract
Parameter IERC20 _dataGen: DataGen Token Address

setReferralCode

Function setReferralCode ( string[] memory codes, uint256 value) onlyOwner external
Description Sets airdrop referral codes
Parameter string[] memory codes: referral codes

uint256 value: #DG value

getAirdrop

Function getAirdrop ( string memory code ) external
Description This function checks the code and sends the value of #DG tokens to the user's wallet.
Users can’t input more than 2 codes.
Parameter string memory code: referral code

tokensAvailable

Function tokensAvailable () public view returns (uint256)
Description This function returns remained #DG token count in this smart contract.
Return amount of remained #DG token

withdraw

Function withdraw () external onlyOwner
Description This function sends remained #DG tokens in this smart contract to the owner’s wallet.

CoFounderPool.sol

Description:

This smart contract is used to give #DG tokens to CoFounders(Angela and Luca). This smart contract has 3,000,000.00 #DG token( 1,500,000.00 #DG for Angela and 1,500,000.00 #DG for Luca).

150,000.00 #DG (300,000.00 #DG in total) unlocked and available from the beginning. The other 1,350,000.00 #DG (2,700,000.00 #DG in total) will be totally locked in the smart-contract for 3 years (1,095 days). Then the smart contract will automatically unlock 270 #DG daily for each (520 #DG daily in total). So that they will be totally unlocked in 5,000 days.

Functions:

constructor

Function constructor( IERC20 _dataGen, address _aWallet, address _lWallet, uint256 _deployedTime)
Description Constructor of CoFounderPool smart contract
Parameter IERC20 _dataGen: DataGen Token Address

address _aWallet: Angela’s wallet address

address _lWallet: Luca’s wallet address

uint256 _deployedTime: smart contract deployed Time, after 1095 days from deployed time, they can get their #DG token each day.

releaseDataGen

Function releaseDataGen () external nonReentrant
Description This function releases #DG token to CoFounder.
At the beginning they can withdraw 150,000 #DG and after 1095 days, then they can withdraw 270 #DG daily.

setaWallet

Function setaWallet (address _aWallet) external onlyAngela(msg.sender)
Description This function sets angela’s wallet address (only Angela can change her address).
Parameter address _aWallet: new Angela’s wallet address.

setlWallet

Function setlWallet (address _aWallet) external onlyLuca(msg.sender)
Description This function sets Luca’s wallet address( onlyLuca can change his address).
Parameter address _lWallet: new Luca’s wallet address.

checkFunds

Function checkFunds () public view returns(uint256)
Description This function gets remained #DG token in this smart contract.
Return returns remained #DG token count

MiningReservation.sol

Description:

This smart contract has 15.000.000,00 #DG tokens. 100% locked until 1st april 2024. After that, they are gradually released. The minimum rate is 71.25 #DG.

The contract implements a voting mechanism. A user who is staking more than 100,000.00 #DG in the contract can select a new address for the distribution and start a vote (in a period greater than 3 days and shorter than 60 days from the initial stake).

All users who stake more than 20 #DG can vote. The voting duration is 30 days long.

This smart contract is used to manage the transition from Polygon blockchain to the Datagen native blockchain sending the #DG to a MiningManager smart-contract / bridge, in order to pay the miners for the computational power they are supplying to the Datagen Network.

A table of the distribution of #DG for mining through time.

4560,00 #DG x day H2: 2280,00 #DG x day H3: 1.140,00 #DG x day H4: 570,00 #DG x day H5: 285,00 #DG x day H6: 142,50 #DG x day H7: 71,25 #DG x day
H1 (days 0-1095) 4.993.200 0 0 0 0 0 0
H2 (days 1095-2190) 4.993.200 2.496.600 0 0 0 0 0
H3 (days 2190-3285) 4.993.200 2.496.600 1.248.300 0 0 0 0
H4 (days 3285-4350) 4.993.200 2.496.600 1.248.300 624.150 0 0 0
H5: 285,00 #DG x day 4.993.200 2.496.600 1.248.300 624.150 312.075 0 0
H6: 142,50 #DG x day 4.993.200 2.496.600 1.248.300 624.150 312.075 156.037,50 0
H7: 71,25 #DG x day 4.993.200 2.496.600 1.248.300 624.150 312.075 156.037,50 78.018,75

Functions:

constructor

Function constructor( IERC20 _dataGen)
Description Constructor of MiningReservation smart contract

setMiningLogicManagerAddress

Function setMiningLogicManagerAddress (
  address[] memory _newMiningLogicManagerAddress,
  uint[] memory _percent ) internal afterVotation )
Description Sets new mining logic manager addresses and percents.
Parameter address[] memory _newMiningLogicManagerAddress: new mining logic manager addresses

uint[] memory _percent: percent of each address

stake

Function stake( uint256 amount) external nonReentrant
Description Users stake their amount of #DG token to vote.
After voting, they can get back their staked DG token.

Stakers who stake more than 100,000.00 #DG has to set new MiningLogicAddresses and voting start time.
Parameter uint256 amount: the amount of #DG token to stake

voteOptionSet

Function voteOptionSet(
  address[] memory _newMiningLogicManagerAddress,
  uint[] memory _percent,
  uint _voteStartTime) external onlyVoteSetter duringVoteSetTime
Description Used to set MiningLogicAddresses and voting start time.
Parameter address[] memory _newMiningLogicManagerAddress: new mining logic manager addresses
uint[] memory _percent: percent of each address
uint _voteStartTime: votation start time.

vote

Function vote( uint256 position) external duringVotation nonReentrant
Description Users who stake more than 20 #DG tokens can vote.
They can vote in 2 options:
1 - deadAddress
2 - new mining logic manager addresses (wallets or smart contracts, including bridges)
Parameter uint256 position the position where to vote.

getVoteInfo

Function getVoteInfo( uint256 position) external view returns(uint256)
Description Returns how many users vote in this position.
Parameter uint256 position: position for get vote info
Return vote in this position

getWinner

Function getWinner() external afterVotation returns(uint256)
Description Calculate the winner.
This function must be called after voting only by a staker.
After calculating the winner, this function sets a new mining wallet address-based winner.
And also return staked #DG token to stakers.
Return Returns winner( 1: deadAddress, 2: new mining logic manager addresses)

releaseDataGen

Function releaseDataGen() public nonReentrant
Description This function releases #DG tokens to mining logic manager addresses.

After 1st June 2024, this function withdraw the amount of #DG token to MiningLogicManagerWallet – default wallet is deadAddress.

ReservedPool.sol

Description:

This smart contract has 1,500,000.00 #DG tokens. It holds in storage the treasury of the company (B-Datagray Limited). 100% locked until 21st December 2023.

750,000.00 #DGs will be released between 21st December 2023 and 15th December 2024, releasing them in 12 events, one every 30 days.

Other 750,000.00 #DGs will be locked in the Reserved Pool and from 15th December 2024, releasing them in 24 events, one every 30 days.

Functions:

constructor

Function constructor( IERC20 _dataGen, address _companyWallet)
Description Constructor of ReservedPool smart contract
Parameter IERC20 _dataGen: DataGen Token Address.

address _companyWallet: company wallet address.

setCompanyWallet

Function setCompanyWallet( address _companyWallet) public onlyOwner
Description Set a new company wallet address. onlyOwner can call this function.
Parameter address _companyWallet: company wallet address.

checkFunds

Function checkFunds( ) public view returns(uint256)
Description Gets remained #DG token in this smart contract.
Return Returns remained #DG token in this smart contract.

releaseDataGen

Function releaseDataGen( ) public firstRelease nonReentrant
Description This function releases #DG tokens to the company’s wallet(s).

Before 15th December 2024, this function withdraws an amount of #DG tokens to the company wallet(s) every 30days from 21st December 2023 – 12 events and each event can withdraw 62500 #DG tokens.

After 15th December 2024, this function withdraws an amount of #DG tokens to the company wallet every 30days.
24 events – each event can withdraw 31,250.00 #DG token.