Skip to content

Commit

Permalink
feature(smart-contracts): Airdrops (#15550)
Browse files Browse the repository at this point in the history
* add contract

* linting and cleanup

* apply suggestions

* blocklist feature

* cleanup

* update contract

* add comprehensive tests

* linting

* more cleanup

* more cleanup

* more cleanup

* more cleanup

* refactored contracts

* using the campaign name

* adding the chainalisys oracle

* adding more tests

* fixed tests

* linting

* moved file

* updated version

* make contract upgradeable

* move released contract to UP folder
using `yarn hardhat release --contract contracts/tokens/UP/Airdrops.sol --dest-folder UP` from `smart-contracts` folder

* add airdrops deployment script

---------

Co-authored-by: Julien Genestoux <[email protected]>
Co-authored-by: Clément Renaud <[email protected]>
  • Loading branch information
3 people authored Feb 26, 2025
1 parent 1d302bd commit efdb5e7
Show file tree
Hide file tree
Showing 10 changed files with 3,298 additions and 6 deletions.
46 changes: 46 additions & 0 deletions governance/scripts/deployments/airdrop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const {
getNetwork,
deployUpgradeableContract,
copyAndBuildContractsAtVersion,
} = require('@unlock-protocol/hardhat-helpers')

// from https://go.chainalysis.com/chainalysis-oracle-docs.html
const chainalysisOracle = '0x3A91A31cB3dC49b4db9Ce721F50a9D076c8D739B'

async function main() {
// fetch chain info
const base = await getNetwork(8453)
const { address: upAddress } = base.tokens.find(
(token) => token.symbol === 'UP'
)
const { id: chainId } = await getNetwork()

console.log(`Deploying UP Airdrops to ${chainId}`)

const [qualifiedPath] = await copyAndBuildContractsAtVersion(__dirname, [
{ contractName: 'Airdrops', subfolder: 'UP' },
])

console.log(` waiting for tx to be mined for contract verification...`)
const { address: airdropAddress } = await deployUpgradeableContract(
qualifiedPath,
[upAddress, chainalysisOracle],
{
wait: 5,
}
)

console.log(`UP Airdrops deployed at ${airdropAddress}`)
}

// execute as standalone
if (require.main === module) {
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
}

module.exports = main
4 changes: 4 additions & 0 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.0.33

- Adding Airdrops contract

## 0.0.32

- PublicLock v15 : Minor changes to reduce contract size (see (https://github.com/unlock-protocol/unlock/pull/15242)[#15242])
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unlock-protocol/contracts",
"version": "0.0.32",
"version": "0.0.33",
"main": "dist/index.js",
"scripts": {
"clean": "rm -rf dist docs src/index.ts",
Expand Down
Loading

0 comments on commit efdb5e7

Please sign in to comment.