Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Note: Keep safe your mnemonic.
MNEMONIC_KEY="blossom spatial metal assault riot bullet truck update forward brave slide way"

DEPLOYER_PRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE

# Alchemy key used to deploy smart contracts (includes archive nodes)
# Key should be the full URL
ALCHEMY_MAINNET_KEY=add-your-alchemy-key-here
Expand All @@ -25,6 +27,9 @@ INFURA_KEY=add-your-infura-key-here
# Etherscan API key. This is used to verify smart contract in the Ethereum networks.
ETHERSCAN_API_KEY=add-your-etherscan-api-key-here

# Safe Global API key for proposing transactions to Gnosis Safe
SAFE_GLOBAL_API_KEY=add-your-safe-global-api-key-here

# CoinMarketCap API key used for gas reporting
CMC_KEY=add-your-coinmarketcap-key-here

Expand Down
51 changes: 51 additions & 0 deletions contracts/nft/distributor/entry/manage-admins.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Contracts
import "../../../contexts/access-control/modifiers/only-owner.sol";

// Utils
import { ADMIN } from "../data.sol";
import { AccessControlEvents, RoleData } from "../../../contexts/access-control/data.sol";

contract ent_manageAdmins_NFTDistributor_v1 is
mod_onlyOwner_AccessControl_v1
{
bytes32 private constant ROLES_POS =
keccak256("teller_protocol.storage.access_control.roles");

struct AccessControlRolesStorage {
mapping(bytes32 => RoleData) roles;
}

function _rolesStore()
private
pure
returns (AccessControlRolesStorage storage s)
{
bytes32 position = ROLES_POS;
assembly {
s.slot := position
}
}

/**
* @notice Grants ADMIN role to an account.
* @param account The address to grant ADMIN.
*/
function grantAdmin(address account) external onlyOwner {
if (_rolesStore().roles[ADMIN].members[account]) return;
_rolesStore().roles[ADMIN].members[account] = true;
emit AccessControlEvents.RoleGranted(ADMIN, account, msg.sender);
}

/**
* @notice Revokes ADMIN role from an account.
* @param account The address to revoke ADMIN from.
*/
function revokeAdmin(address account) external onlyOwner {
if (!_rolesStore().roles[ADMIN].members[account]) return;
_rolesStore().roles[ADMIN].members[account] = false;
emit AccessControlEvents.RoleRevoked(ADMIN, account, msg.sender);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,17 @@ contract NFTMainnetBridgingToPolygonFacet {
EnumerableSet.UintSet storage stakedNFTs = NFTLib.s().stakedNFTs[
msg.sender
];



// we are creating a new array so that we can overrwrite each element
// with a newTokenId.
if (EnumerableSet.contains(stakedNFTs, tokenId)) {
NFTLib.unstake(tokenId, msg.sender);
} else if (TELLER_NFT_V1.ownerOf(tokenId) == msg.sender) {
} else {

require(TELLER_NFT_V1.ownerOf(tokenId) == msg.sender);

TELLER_NFT_V1.transferFrom(msg.sender, address(this), tokenId);
}

Expand Down
8 changes: 4 additions & 4 deletions deploy/markets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import colors from 'colors'
import { ContractTransaction } from 'ethers'
import { ContractTransactionResponse } from 'ethers'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import { DeployFunction } from 'hardhat-deploy/types'

Expand Down Expand Up @@ -66,11 +66,11 @@ const initializeMarkets: DeployFunction = async (hre) => {
)
const collateralTokensToAdd = new Set(
market.collateralTokens.map((sym) =>
ethers.utils.getAddress(tokenAddresses.all[sym])
ethers.getAddress(tokenAddresses.all[sym])
)
)
for (const token of existingCollateralTokens) {
const tokenAddress = ethers.utils.getAddress(token)
const tokenAddress = ethers.getAddress(token)
if (collateralTokensToAdd.has(tokenAddress))
collateralTokensToAdd.delete(tokenAddress)
}
Expand Down Expand Up @@ -150,7 +150,7 @@ const initializeMarkets: DeployFunction = async (hre) => {

const waitAndLog = async (
msg: string,
tx: Promise<ContractTransaction>,
tx: Promise<ContractTransactionResponse>,
hre: HardhatRuntimeEnvironment
): Promise<void> => {
const receipt = await tx.then(({ wait }) => wait())
Expand Down
4 changes: 2 additions & 2 deletions deploy/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const deployNFT: DeployFunction = async (hre) => {
methodName: 'initialize',
args: [
// Initial minters
ethers.utils.defaultAbiCoder.encode(
ethers.AbiCoder.defaultAbiCoder().encode(
['address[]'],
[minterAddresses]
),
Expand All @@ -71,7 +71,7 @@ const deployNFT: DeployFunction = async (hre) => {
})

// Add the distributor as a minter if not already
const minterRole = ethers.utils.id('MINTER')
const minterRole = ethers.id('MINTER')
const distributorIsDictAdmin = await nft.hasRole(
minterRole,
nftDistributor.address
Expand Down
2 changes: 1 addition & 1 deletion deploy/platform-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const createPlatformSettings: DeployFunction = async (hre) => {
const { max, min, processOnDeployment, value } = setting

if (processOnDeployment) {
const keccak = ethers.utils.id(settingName)
const keccak = ethers.id(settingName)
log(`${settingName}: `, { indent: 2, star: true, nl: false })

// Check if the platform setting has already been created
Expand Down
16 changes: 8 additions & 8 deletions deploy/price-agg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const registerPriceAggregators: DeployFunction = async (hre) => {

const definedPricer = await priceAgg.chainlinkPricer()
if (
ethers.utils.getAddress(definedPricer) !=
ethers.utils.getAddress(chainlinkPricer.address)
ethers.getAddress(definedPricer) !=
ethers.getAddress(chainlinkPricer.address)
) {
await priceAgg.setChainlinkPricer(chainlinkPricer.address)
}
Expand Down Expand Up @@ -120,12 +120,12 @@ export const deployChainlinkENS = async (
})

const tld = 'eth'
const tldLabel = hre.ethers.utils.id(tld)
const tldNode = hre.ethers.utils.namehash(tld)
const tldLabel = hre.ethers.id(tld)
const tldNode = hre.ethers.namehash(tld)

const mainDomain = 'data'
const dataLabel = hre.ethers.utils.id(mainDomain)
const dataNode = hre.ethers.utils.namehash(`${mainDomain}.${tld}`)
const dataLabel = hre.ethers.id(mainDomain)
const dataNode = hre.ethers.namehash(`${mainDomain}.${tld}`)

if (ensRegistry.deployResult.newlyDeployed) {
await ensRegistry
Expand Down Expand Up @@ -161,8 +161,8 @@ export const deployChainlinkENS = async (
for (const config of Object.values(chainlink)) {
const chainlinkAggSubdomain = `${config.baseTokenName.toLowerCase()}-${config.quoteTokenName.toLowerCase()}`
const chainlinkAggDomain = `${chainlinkAggSubdomain}.${mainDomain}.${tld}`
const chainlinkAggLabel = hre.ethers.utils.id(chainlinkAggSubdomain)
const chainlinkAggNode = hre.ethers.utils.namehash(chainlinkAggDomain)
const chainlinkAggLabel = hre.ethers.id(chainlinkAggSubdomain)
const chainlinkAggNode = hre.ethers.namehash(chainlinkAggDomain)
const address = await resolver['addr(bytes32)'](chainlinkAggNode)

hre.log(`${colors.underline(chainlinkAggSubdomain)}: ${config.address}`, {
Expand Down
22 changes: 8 additions & 14 deletions deploy/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@ const deployProtocol: DeployFunction = async (hre) => {
// Try to get deployment of TellerDiamond
await contracts.get('TellerDiamond')

// If deployment exists execute upgrade function
const executeMethod = 'init2'
const upgradeExecute = {
methodName: executeMethod,
args: [wrappedNativeToken, priceAggregator.address],
}

execute = upgradeExecute
// If deployment exists, skip execute (init2 already called)
execute = undefined
} catch {
// Else execute initialize function
const executeMethod = 'init'
Expand Down Expand Up @@ -274,8 +268,8 @@ const deployLoansEscrowBeacon = async (
// Check to see if we need to upgrade
const currentImpl = await beacon.implementation()
if (
ethers.utils.getAddress(currentImpl) !==
ethers.utils.getAddress(loansEscrowLogic.address)
ethers.getAddress(currentImpl) !==
ethers.getAddress(loansEscrowLogic.address)
) {
log(`Upgrading Loans Escrow logic: ${loansEscrowLogic.address}`, {
indent: 5,
Expand Down Expand Up @@ -328,8 +322,8 @@ const deployCollateralEscrowBeacon = async (
// Check to see if we need to upgrade
const currentImpl = await beacon.implementation()
if (
ethers.utils.getAddress(currentImpl) !==
ethers.utils.getAddress(collateralEscrowLogic.address)
ethers.getAddress(currentImpl) !==
ethers.getAddress(collateralEscrowLogic.address)
) {
log(`Upgrading Collateral Escrow logic: ${collateralEscrowLogic.address}`, {
indent: 5,
Expand Down Expand Up @@ -382,8 +376,8 @@ const deployTTokenBeacon = async (
// Check to see if we need to upgrade
const currentImpl = await beacon.implementation()
if (
ethers.utils.getAddress(currentImpl) !==
ethers.utils.getAddress(tTokenLogic.address)
ethers.getAddress(currentImpl) !==
ethers.getAddress(tTokenLogic.address)
) {
log(`Upgrading Teller Token logic: ${tTokenLogic.address}`, {
indent: 5,
Expand Down
Loading
Loading