Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: action to add deployed token manager to tenderly project [AXE-2356] #86

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const axios = require('axios').default;

const URL = 'https://api.tenderly.co/api/v2/accounts/axelarEng/projects/ITS/contracts';
const TOKEN_MANAGER_DEPLOYED_TOPIC0 = '0x5284c2478b9c1a55e973429331078be39b5fb3eeb9d87d10b34d65a4c89ee4eb';
blockchainguyy marked this conversation as resolved.
Show resolved Hide resolved

const addToProjectFn = async (context, event) => {
blockchainguyy marked this conversation as resolved.
Show resolved Hide resolved
const logs = event.logs;
const contracts = [];

for (let index = 0; index < logs.length; ++index) {
if (logs[index].topics[0] === TOKEN_MANAGER_DEPLOYED_TOPIC0) {
const deployedAddress = '0x' + logs[index].data.substring(26, 66);
blockchainguyy marked this conversation as resolved.
Show resolved Hide resolved
const name = `TokenManager-${context.metadata.getNetwork()}-${deployedAddress}`; // TokenManager + network + address

contracts.push({
address: deployedAddress,
display_name: name,
network_id: event.network,
});
}
}

if (contracts.length === 0) throw Error('NO_DEPLOYED_CONTRACT_FOUND');

try {
await axios.post(
URL,
{ contracts },
{
headers: {
'X-Access-Key': await context.secrets.get('API_TOKEN'),
},
},
);
} catch (error) {
console.log(error.response.status);
console.error(error.response.data);
throw Error('CONTRACT_ADDITION_FAILED');
}
};

module.exports = { addToProjectFn };
13 changes: 13 additions & 0 deletions tenderly-suite/add-to-project-action/tenderly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
account_id: "axelarEng"
actions:
axelareng/its:
runtime: v2
sources: add-to-project
specs:
add-to-project:
description: This action adds newly deployed TokenManagers to a tenderly project.
function: addToProject:addToProjectFn
trigger:
type: transaction
execution_type: sequential
project_slug: "ITS"
Loading