Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
85addc6
delete .vscode file
veigajoao Dec 6, 2022
6822c21
add .vscode to gitignore
veigajoao Dec 6, 2022
95eceb3
feat(CICD): add prod deployment script
veigajoao Dec 6, 2022
1160628
add envs
veigajoao Dec 6, 2022
8c99fc5
add db envs
veigajoao Dec 6, 2022
2d30988
add graphql link
veigajoao Dec 6, 2022
e1ea068
docs(contracts): fix api docs for deposits in nft staking
veigajoao Dec 6, 2022
55ad2eb
fix(indexer-ts): fetch last processed block as max block in DB
veigajoao Dec 7, 2022
807152b
fix(graphql): support null tokens
veigajoao Dec 7, 2022
b2e4b0c
UI remove fake tokens
veigajoao Dec 7, 2022
a7603f2
feat(web): conditionally render get testnet tokens button only in tes…
veigajoao Dec 7, 2022
96b45ad
web divide by number of staked nfts
veigajoao Dec 7, 2022
18f48a7
fix web build
veigajoao Dec 7, 2022
f9f0c3d
set deploy to prod
veigajoao Dec 8, 2022
cab3a97
test
veigajoao Dec 8, 2022
c94d12e
retry
veigajoao Dec 8, 2022
9d4c7ed
big js
veigajoao Dec 8, 2022
ddeac41
bug fixes
veigajoao Dec 20, 2022
cd0191e
Merge branch 'main' into deploy-prod
veigajoao Dec 20, 2022
e1cbbe8
test
veigajoao Dec 20, 2022
c0aba98
wording/ allocation cal update
ymc182 Jan 8, 2023
53782dc
Merge pull request #147 from hack-a-chain-software/neko-prelaunch
ymc182 Jan 8, 2023
956eb17
Allocation ballance Fix
ymc182 Jan 9, 2023
787ae19
Merge pull request #150 from hack-a-chain-software/neko-prelaunch
ymc182 Jan 9, 2023
09585c2
Revert "Allocation ballance Fix"
ymc182 Jan 9, 2023
5cbd698
Merge pull request #151 from hack-a-chain-software/revert-150-neko-pr…
ymc182 Jan 9, 2023
d79a9bc
temp fix allocation balance
ymc182 Jan 9, 2023
61f8ce1
alloc temp fix
ymc182 Jan 9, 2023
7ffe345
backspace bug fix
ymc182 Jan 9, 2023
edb39ea
all allocation
ymc182 Jan 9, 2023
acfc243
websites
ymc182 Jan 9, 2023
672ed3a
pre-sender
ymc182 Jan 11, 2023
b100cbe
fix wallet connect mobile view
ymc182 Jan 12, 2023
7c7a232
header hidden from mobile view to spare space
ymc182 Jan 12, 2023
b86eb70
contract : withdraw 100% , web : token price
ymc182 Jan 13, 2023
7694fb9
ve
ymc182 Jan 13, 2023
2896499
prod
ymc182 Jan 13, 2023
cf2fa87
user claim at 100% sales
ymc182 Jan 14, 2023
b97264d
Merge pull request #153 from hack-a-chain-software/preview
ymc182 Jan 14, 2023
232dca3
NFT image fix
ymc182 Jan 14, 2023
b7a29e8
Merge pull request #154 from hack-a-chain-software/fix-storage-nft-st…
ymc182 Jan 14, 2023
a18ef50
bigjs error fix
ymc182 Jan 14, 2023
27be3c2
fix overflow
ymc182 Jan 15, 2023
ea73dfb
Merge pull request #156 from hack-a-chain-software/ymc182/fix-vesting…
ymc182 Jan 15, 2023
bee61f1
neartopia collection staking fix
ymc182 Jan 17, 2023
a5b9897
jump fix
ymc182 Jan 17, 2023
85930ea
modal
ymc182 Jan 17, 2023
522c665
view total staked
ymc182 Jan 17, 2023
901ff08
fixes
ymc182 Jan 17, 2023
20060e5
nft per collection fix
ymc182 Jan 17, 2023
0b9c657
remove 0
ymc182 Jan 17, 2023
706bfa5
only hide0 blaance jump
ymc182 Jan 17, 2023
50a77cc
Merge pull request #157 from hack-a-chain-software/ymc182/nft-staking…
ymc182 Jan 17, 2023
9c332dd
pewview
ymc182 Jan 18, 2023
8ceb269
pre-fixv1
ymc182 Jan 18, 2023
a508c83
Merge pull request #158 from hack-a-chain-software/hotfix/kangaroo
ymc182 Jan 18, 2023
cf81734
fix non-contract placeholder
ymc182 Jan 18, 2023
68464b8
image fix
ymc182 Jan 18, 2023
5d27c0b
reverse reward back to graphql
ymc182 Jan 19, 2023
848d2cd
nn fix
ymc182 Jan 19, 2023
1d00fee
skellies
ymc182 Jan 20, 2023
12a33d1
balance wording
ymc182 Jan 23, 2023
8158738
balance
ymc182 Jan 23, 2023
188a84b
fix total rewards
ymc182 Jan 23, 2023
a3098db
farm update
ymc182 Jan 24, 2023
717f66d
nightly
ymc182 Jan 25, 2023
edb67eb
analtics
ymc182 Jan 25, 2023
b6ff45a
plugin
ymc182 Jan 25, 2023
cd8887b
aaa
ymc182 Jan 25, 2023
cd93161
Revert "analtics"
ymc182 Jan 25, 2023
a7589ec
google analytics
ymc182 Jan 25, 2023
36d7209
remove google analytics
ymc182 Jan 25, 2023
5114ed3
init
ymc182 Jan 25, 2023
aca488e
Merge pull request #159 from hack-a-chain-software/feat/google-analytics
ymc182 Jan 25, 2023
86bc80e
storage fix temp
ymc182 Jan 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/utilities/set_mainnet_environments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require("fs");

const environment_file_web = `
VITE_BASE_TOKEN=jumptoken.jumpfinance.near
VITE_LOCKED_CONTRACT=lockedjumptoken.jumpfinance.near
VITE_STAKING_CONTRACT=xjumptoken.jumpfinance.near
VITE_NFT_STAKING_CONTRACT=nftstaking.jumpfinance.near
VITE_JUMP_LAUNCHPAD_CONTRACT=launchpad.jumpfinance.near
VITE_TOKEN_LAUNCHER_CONTRACT=laboratory.jumpfinance.near
VITE_NEAR_NETWORK=${process.env.NEAR_NETWORK}
`;

fs.writeFileSync("./packages/web/.env", environment_file_web);

const environment_file_graphql = `
SERVER_PORT=80
DB_USERNAME=${process.env.DB_USER}
DB_PASSWORD=${process.env.DB_PASS}
DB_HOST=${process.env.DB_HOST}
DB_PORT=5432
DB_NAME=${process.env.DB_NAME}
NFT_STAKING_CONTRACT=nftstaking.jumpfinance.near
JUMP_LAUNCHPAD_CONTRACT=launchpad.jumpfinance.near
ENV=MAINNET
NEAR_RPC_URL=https://rpc.mainnet.near.org
`;

fs.writeFileSync("./packages/graphql/.env", environment_file_graphql);
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ yarn-error.log*
**/target
.eslintcache
.vercel
.vscode
55 changes: 0 additions & 55 deletions .vscode/settings.json

This file was deleted.

110 changes: 110 additions & 0 deletions old/prod_deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Staging Deploy
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_TESTNET_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_TESTNET_PROJECT_ID }}
VITE_GRAPHQL_API_URI: https://prodgraphql.jumpdefi.xyz/
NEAR_NETWORK: mainnet
DB_HOST: ${{ secrets.PROD_DB_HOST }}
DB_NAME: ${{ secrets.PROD_DB_NAME }}
DB_USER: ${{ secrets.PROD_DB_USER }}
DB_PASS: ${{ secrets.PROD_DB_PASS }}
DB_PORT: 5432
AWS_REGION: us-east-1
ECS_SERVICE: staging-indexer-service
ECS_CLUSTER: staging-indexer-cluster
ECS_TASK_DEFINITION: services/indexer/task-definition.json
CONTAINER_NAME: staging-indexer

on:
push:
branches:
- prod
- deploy-prod

jobs:
vercel_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# - name: Get timestamp
# uses: gerred/actions/current-time@master
# id: current-time

# - name: Run string replace
# uses: frabert/replace-string-action@master
# id: format-time
# with:
# pattern: '[:\.]+'
# string: "${{ steps.current-time.outputs.time }}"
# replace-with: "-"
# flags: "g"

# - name: Install Rust
# run: |
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# source $HOME/.cargo/env
# rustup component add rustfmt
# rustup target add wasm32-unknown-unknown

- name: Install Vercel CLI
run: npm install --global vercel@canary

- name: Install Yarn Globally
run: npm install -g yarn

- name: Installing Dependencies
run: yarn

# Set envs for builds
- name: Set Mainnet environment variables
run: yarn setup:mainnet:env

# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: ${{ env.AWS_REGION }}

# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@aaf69d68aa3fb14c1d5a6be9ac61fe15b48453a2

# # Set AWS deployments - Graphql
# - name: Build, tag, and push GRAPHQL image to Amazon ECR
# id: build-image-graphql
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# ECR_REPOSITORY: jump-graphql
# ECR_IMAGE: graphql
# run: |
# docker build . -f services/graphql/Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$ECR_IMAGE
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$ECR_IMAGE
# echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$ECR_IMAGE"

# - name: Deploy GRAPHQL to EB
# uses: einaregilsson/beanstalk-deploy@v14
# with:
# aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# application_name: prod-backend-graphql
# environment_name: Prodbackendgraphql-env
# version_label: "prod-backend-graphql-${{ steps.format-time.outputs.replaced }}"
# region: us-east-1
# deployment_package: services/graphql/Dockerrun.aws.json

# Deploy Vercel app
#- name: Pull vercel setup
# run: vercel pull --yes --token=${{ secrets.VERCEL_TESTNET_TOKEN }}

#- name: Build Project Artifacts
# run: vercel build --prod --token=${{ secrets.VERCEL_TESTNET_TOKEN }}

# - name: Deploy Project Artifacts to Vercel
# run: >
# vercel
# deploy
# --prod
# --prebuilt
# --token=${{ secrets.VERCEL_TESTNET_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"setup:lake:consumer": "node .github/utilities/build_aws_lake_credentials.js",
"setup:testnet:env": "node .github/utilities/set_testnet_environments.js",
"setup:staging:env": "node .github/utilities/set_staging_environments.js",
"setup:mainnet:env": "node .github/utilities/set_mainnet_environments.js",
"setup:staging:db": "node .github/utilities/database_reset.js",
"setup:staging:db:populate": "node .github/utilities/database_basic_populate.js",

Expand Down
26 changes: 22 additions & 4 deletions packages/apollo/src/generated/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,17 @@ export const NftStakingProjectsConnectionDocument = gql`
}
}
`;

/**
* rewards {
spec
name
symbol
icon
decimals
perMonth
account_id
}
*/
/**
* __useNftStakingProjectsConnectionQuery__
*
Expand Down Expand Up @@ -874,8 +884,6 @@ export const StakingProjectDocument = gql`
collection_image
collection_modal_image
token_address
min_staking_period
early_withdraw_penalty
rewards {
spec
name
Expand All @@ -885,11 +893,21 @@ export const StakingProjectDocument = gql`
perMonth
account_id
}
min_staking_period
early_withdraw_penalty
}
}
`;

/**
/** rewards {
spec
name
symbol
icon
decimals
perMonth
account_id
}
* __useStakingProjectQuery__
*
* To run a query within a React component, call `useStakingProjectQuery` and pass it any options that fit your needs.
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
18 changes: 12 additions & 6 deletions packages/contracts/launchpad/src/listing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,10 @@ impl Listing {
project_promise
}
ListingStatus::Funded => {
if env::block_timestamp() > self.final_sale_2_timestamp {
let allocation_sold_percentage = self.allocations_sold as u128 * self.token_allocation_size
/ (self.total_amount_sale_project_tokens);

if env::block_timestamp() > self.final_sale_2_timestamp || allocation_sold_percentage >= 1 {
self.status = ListingStatus::SaleFinalized;
self.withdraw_project_funds()
} else {
Expand Down Expand Up @@ -493,11 +496,14 @@ impl Listing {
((self.token_allocation_size * self.fraction_cliff_release) / FRACTION_BASE) * allocations;
let final_release = self.token_allocation_size * allocations - initial_release - cliff_release;
let mut total_release = initial_release;
if timestamp >= self.cliff_timestamp
&& timestamp < self.end_cliff_timestamp
{
total_release += (cliff_release * (timestamp - self.cliff_timestamp) as u128)
/ (self.end_cliff_timestamp - self.cliff_timestamp) as u128
if timestamp >= self.cliff_timestamp && timestamp < self.end_cliff_timestamp {
let time_fraction = 100;
let time_passed = timestamp - self.cliff_timestamp;
let time_total = self.end_cliff_timestamp - self.cliff_timestamp;

let acc_release = time_passed as u128 * ((cliff_release * time_fraction) / time_total as u128);

total_release += acc_release / time_fraction as u128;
} else if timestamp >= self.end_cliff_timestamp {
total_release += cliff_release + final_release;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/nft_staking/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The owner is responsible for 5 functions in the contract: (1) adding guardians,
msg: String -> { "type": "Deposit", "data": { "type": "ContractTreasury" } }

```shell
near call <tokenContractAddress> "ft_transfer_call" '{"receiver_id": "<nftStakingAddress>", "amount": "<amount>", "msg": "{ \"type\": \"Deposit\", \"data\": { \"type\": \"ContractTreasury\" } }" }' --accountId <ownerAccountId> --depositYocto 1
near call <tokenContractAddress> "ft_transfer_call" '{"receiver_id": "<nftStakingAddress>", "amount": "<amount>", "msg": "{ \"type\": \"Deposit\", \"data\": { \"type\": \"Deposit\", \"data\": { \"type\": \"ContractTreasury\" } } }" }' --accountId <ownerAccountId> --depositYocto 1
```

7. transfer
Expand Down Expand Up @@ -224,7 +224,7 @@ There are 3 actions that must be performed by collection owners: (1) depositing
msg: String -> {"type": "CollectionTreasury", "collection": {"type": "NFTContract", "account_id": "<NFTContractAccountId>"} }

```shell
near call <rewardTokenAddress> "ft_transfer_call" '{"receiver_id": "<contractAccount>", "amount": "<quantityToDeposit>", "msg": "{ \"type\": \"CollectionTreasury\", \"collection\": {\"type\": \"NFTContract\", \"account_id\": \"<NFTContractAccountId>\"} }" }' --accountId <collectionOwnerAccountId> --depositYocto 1
near call <rewardTokenAddress> "ft_transfer_call" '{"receiver_id": "<contractAccount>", "amount": "<quantityToDeposit>", "msg": "{ \"type\": \"Deposit\", \"data\": { \"type\": \"CollectionTreasury\", \"collection\": {\"type\": \"NFTContract\", \"account_id\": \"<NFTContractAccountId>\"} } }" }' --accountId <collectionOwnerAccountId> --depositYocto 1
```

2. transfer
Expand Down
14 changes: 8 additions & 6 deletions packages/contracts/nft_staking/src/actions/view.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::collections::HashMap;

use near_sdk::{near_bindgen, AccountId, json_types::U128};
use near_sdk::{json_types::U128, near_bindgen, AccountId};

use crate::{
types::{
NFTCollection, NonFungibleTokenID, SerializableFungibleTokenBalance, SerializableStakedNFT,
SerializableStakingProgram, FungibleTokenBalance,
FungibleTokenBalance, NFTCollection, NonFungibleTokenID, SerializableFungibleTokenBalance,
SerializableStakedNFT, SerializableStakingProgram,
},
Contract, ContractExt,
};
Expand Down Expand Up @@ -44,6 +44,10 @@ impl Contract {
.collect()
}

pub fn view_total_staked_amount_for_collection(&self, collection: NFTCollection) -> U128 {
let staking_program = self.staking_programs.get(&collection).unwrap();
U128(staking_program.staked_nfts.len() as u128)
}
pub fn view_staked(
&self,
collection: NFTCollection,
Expand Down Expand Up @@ -97,9 +101,7 @@ impl Contract {
balance.into()
}

pub fn view_contract_treasury_balance(
&self
) -> HashMap<AccountId, U128> {
pub fn view_contract_treasury_balance(&self) -> HashMap<AccountId, U128> {
let mut result = HashMap::new();
for (key, value) in self.contract_treasury.iter() {
result.insert(key.clone(), U128(*value));
Expand Down
12 changes: 6 additions & 6 deletions packages/contracts/nft_staking/src/models/farm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ impl Farm {
let mut rewards_map = HashMap::new();

for (k, prev_dist) in self.distributions.clone().iter() {
let rps = *token_rps.get(k).unwrap();
if let Some(rps) = token_rps.get(k) {
let (dist, claimed) = prev_dist.claim(*rps);

let (dist, claimed) = prev_dist.claim(rps);
token_rps.insert(k.clone(), dist.rps);
self.distributions.insert(k.clone(), dist);

token_rps.insert(k.clone(), dist.rps);
self.distributions.insert(k.clone(), dist);

rewards_map.insert(k.clone(), claimed);
rewards_map.insert(k.clone(), claimed);
}
}

(rewards_map, token_rps)
Expand Down
1 change: 1 addition & 0 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@types/express": "^4.17.13",
"@types/jsonwebtoken": "^8.5.8",
"apollo-server": "^3.9.0",
"big.js": "^6.2.1",
"bn.js": "^5.2.1",
"dotenv": "^16.0.1",
"express": "^4.18.1",
Expand Down
2 changes: 0 additions & 2 deletions packages/graphql/src/modules/launchpad/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export default {
async project_allocations_sold({ listing_id }: LaunchpadListing) {
const { allocations_sold } = await findProjectInfo(listing_id);

console.log("projectallocationssold", allocations_sold);

return allocations_sold;
},
async project_total_amount_sale_project_tokens({
Expand Down
Loading