Skip to content

Implementation payable check data (imitation via sort) on NEAR Protocol

License

Notifications You must be signed in to change notification settings

ilyar/near-merge-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

near-merge-data

Implementation payable check data (imitation via sort) on NEAR Protocol

Feature

  1. Input parameters — arrays, at least 2
  2. Sorting options for arrays: ascending (true), descending (false), do not sort (undefined)
  3. Make sure that all arrays are not empty — otherwise throw an error
  4. Check that attached deposit is not zero — otherwise it throws an error
  5. Sort each array separately — depending on the input sort parameter
  6. Merge arrays according to their order of passing in function parameters
  7. Transfer funds in the amount of 1 yocto per array to the one who called the contract (predecessor)
  8. Return the resulting array
  9. Test coverage (unit, integration)

Usage

accountId=ilyar.testnet
contractName="merge-data.ilyar.testnet"
near --accountId $accountId --amount 0.25 call $contractName merge '{"data": [[102, 111], [98, 97, 114]]}'
near --accountId $accountId --amount 0.25 call $contractName merge '{"data": [[102, 111], [98, 97, 114]], "sort": true}'
near --accountId $accountId --amount 0.25 call $contractName merge '{"data": [[102, 111], [98, 97, 114]], "sort": false}'

Develop

make fix 
make qa
make build
make clean

Run CI local

Installation act:

brew install act

Setup env vars:

echo "GITHUB_TOKEN=%GITHUB_TOKEN%" | tee .secrets

Run

act --help

Deploy test

accountId=ilyar.testnet
make build
near dev-deploy
contractName=$(cat neardev/dev-account)
near state $contractName
near delete $contractName $accountId
near clean

Deploy

make qa
make build
export NEAR_ENV=testnet
accountId=ilyar.testnet
contractName="merge-data.$accountId"
near create-account --masterAccount $accountId $contractName 
near deploy $contractName
contractName=$(cat neardev/dev-account)
near state $contractName

About

Implementation payable check data (imitation via sort) on NEAR Protocol

Topics

Resources

License

Stars

Watchers

Forks