
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
@perp/contract
Advanced tools
Perpetual Protocol is a decentralized perpetual contract protocol for every asset, made possible by a Virtual Automated Market Maker (henceforth referred to as a “vAMM” or “vAMMs”). >*For those who aren’t familiar with perpetual contracts: A perpetual con
Perpetual Protocol is a decentralized perpetual contract protocol for every asset, made possible by a Virtual Automated Market Maker (henceforth referred to as a “vAMM” or “vAMMs”).
For those who aren’t familiar with perpetual contracts: A perpetual contract is a derivative similar to a futures contract but without an expiry date. For conventional futures contracts such as WTI, the contract’s price will gradually converge with the underlying asset’s spot market price as the expiry date approaches. Perpetual contracts are futures contracts that automatically roll over on a given time period, e.g. 1 hour, 8 hours, etc. In order to keep the perpetual contract in line with the underlying index, one side of the market pays the other a funding rate. The funding rate effectively implies a cost of capital and the steepness of the futures curve. You can learn more about how funding works by reading our documentation.
Please refer to the Perpetual Protocol documentation for more details.
Welcome to contribute to this project. Please join our Discord to discuss.
You should have Node 12 installed. Use nvm to install it.
Clone this repository, install NodeJS dependencies, and build the source code:
git clone git@github.com:perpetual-protocol/perp-contract.git
npm i
npm run build
Deploy in the local enviroment, deployed contract addresses listed in build/system-local.json
.
npm run dev
To learn more use cases, please refer to the development guide.
To run all the test cases,
npm run test
If you only want to run partial test cases, add .only
and pass the title of test cases or test sections. For example,
describe.only("Amm Unit Test", () => { ... }
or
it.only("admin open amm", async () => { ... }
Test cases can be found in the ./tests
folder.
Deploy contracts on rinkeby without versioning requires two environment variables: WEB3_RINKEBY_ENDPOINT & RINKEBY_MNEMONIC.
Once these two variables are set, the deployment script is needed. For example, we want to deploy the "PerpRewardVesting" contract, and the deploy script should be similar to this code snippet:
import { ethers, upgrades } from "@nomiclabs/buidler"
import { ContractName } from "../publish/ContractName"
async function main() {
const perpAddress = "0xaFfB148304D38947193785D194972a7d0d9b7F68"
const options = {
unsafeAllowCustomTypes: true,
}
const Vesting = await ethers.getContractFactory(ContractName.PerpRewardVesting)
const instance = await upgrades.deployProxy(Vesting, [perpAddress], options)
await instance.deployed()
}
main()
execute the below commands:
./node_modules/.bin/buidler --network rinkeby run scripts/deploy-reward-vesting.ts
And the contract should be deployed on rinkeby, and the file ".openzeppelin/rinkeby.json" is modified with new contract addresses, but the changes can be ignored for testing purposes.
GPL3.0 or later
FAQs
Perpetual Protocol is a decentralized perpetual contract protocol for every asset, made possible by a Virtual Automated Market Maker (henceforth referred to as a “vAMM” or “vAMMs”). >*For those who aren’t familiar with perpetual contracts: A perpetual con
We found that @perp/contract demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.