Bikram Samvat (Vikram Sambat, abbr: B.S./V.S.) is one of the ancient Hindu calendar system currently used as official calendar of Nepal. This DApp is optimized to calculate unix timestamps to B.S. dates and vice versa. It currently supports a range of dates from B.S. 2027 to 2090 (i.e., 1980-2034 A.D.)
Basic UI :
https://nepal-blockchain.github.io/bikram-samvat/
Github Repo: https://github.com/nepal-blockchain/bikram-samvat
This Dapp is deployed on Rinkeby Testnet and source code verified on etherscan 0x7ffa4942bfc4b25f9bfe56e21110d9df45c301f4
Example use of Datetime Library in other smart contracts.
pragma solidity >0.5.0;
contract HodlNepal {
iBikram public _bs; // interface
struct Vault {
uint timestamp;
uint value;
}
mapping(address => Vault) internal _vault;
constructor() public {
_bs = iBikram(0x7fFa4942bfC4b25f9Bfe56e21110d9dF45C301f4);
// Rinkeby Testnet
}
function info(address _addr)
external view
returns (uint _wei, uint year, uint8 month, uint8 date,
uint8 day, uint timestamp) {
Vault memory _v = _vault[_addr];
_wei = _v.value;
(year, month, date, , , , day, timestamp) = _bs.TS2BS(_v.timestamp);
}
function unHodl() // withdraw afterwards
external {
Vault storage _v = _vault[msg.sender];
require(_v.timestamp < now, "HODL_TIME");
uint _wei = _v.value;
_v.value = 0;
(msg.sender).transfer(_wei);
}
function hodl(uint year, uint8 month, uint8 date) // Hodl ETH / time locked
external payable {
uint _ts = _helper(year, month, date);
require(_ts > now, "PAST_DATE_NOT_VALID");
Vault storage _v = _vault[msg.sender];
if(_v.value > 0) {
_ts = (_v.timestamp + _ts) / 2;
}
_v.timestamp = _ts;
_v.value += msg.value;
}
function _helper(uint year, uint8 month, uint8 date)
internal view
returns(uint _ts) {
uint8 _d = _bs.getDaysInMonth(year, month);
if(date == 0) {
date = 1;
} else if(date > _d) {
date = _d;
}
( , , , , , , , _ts) = _bs.BS2TS(year, month, date);
}
function () external payable {
revert();
}
}
Interface :
interface iBikram {
function getDaysInMonth(uint256 _year, uint8 _month)
external view
returns(uint8);
function isLeapYear(uint _year)
external view
returns(bool);
function maxBSYear()
external view
returns(uint);
function nowBS() // latest block time
external view
returns(uint256 year, uint8 month, uint8 date,
uint8 hour, uint8 min, uint8 sec,
uint8 day, uint256 timestamp);
function BS2TS(uint256 _year, uint8 _month, uint8 _date)
external view
returns(uint256 year, uint8 month, uint8 date,
uint8 hour, uint8 min, uint8 sec,
uint8 day, uint256 timestamp);
function NST2TS(
uint256 _year, uint8 _month, uint8 _date,
uint8 _hour, uint8 _min, uint8 _sec)
external view
returns(uint256 year, uint8 month, uint8 date,
uint8 hour, uint8 min, uint8 sec,
uint8 day, uint256 timestamp);
function TS2BS(uint256 _timestamp)
external view
returns(uint256 year, uint8 month, uint8 date,
uint8 hour, uint8 min, uint8 sec,
uint8 day, uint256 timestamp);
}
Who are you nepal bitcoin? You are in discord?
Our discord server is down for almost year.
Send me inv.
ok, meet me in this server. @pathi
https://discord.gg/8NmrtUg
Hi @teamnepal - sent you msg on discord. Revival time?
Posted using Partiko iOS
Congratulations @nepalbitcoin! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word
STOP
Hello @nepalbitcoin! This is a friendly reminder that you have 3000 Partiko Points unclaimed in your Partiko account!
Partiko is a fast and beautiful mobile app for Steem, and it’s the most popular Steem mobile app out there! Download Partiko using the link below and login using SteemConnect to claim your 3000 Partiko points! You can easily convert them into Steem token!
https://partiko.app/referral/partiko
Congratulations @nepalbitcoin! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!